mirror of
https://github.com/ceph/go-ceph
synced 2024-12-23 22:53:47 +00:00
common admin: enhance and make public APIs for mgr module admin
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
0757a9acf9
commit
bd93e9c6d6
@ -35,14 +35,25 @@ func (fsa *MgrAdmin) DisableModule(module string) error {
|
||||
return commands.MarshalMonCommand(fsa.conn, m).NoData().End()
|
||||
}
|
||||
|
||||
// DisabledModule describes a disabled Ceph mgr module.
|
||||
// The Ceph JSON structure contains a complex module_options
|
||||
// substructure that go-ceph does not currently implement.
|
||||
type DisabledModule struct {
|
||||
Name string `json:"name"`
|
||||
CanRun bool `json:"can_run"`
|
||||
ErrorString string `json:"error_string"`
|
||||
}
|
||||
|
||||
// ModuleInfo contains fields that report the status of modules within the
|
||||
// ceph mgr.
|
||||
type ModuleInfo struct {
|
||||
// EnabledModules lists the names of the enabled modules.
|
||||
EnabledModules []string `json:"enabled_modules"`
|
||||
//DisabledModules []string `json:"disabled_modules"`
|
||||
// DisabledModules is documented in ceph as a list of string
|
||||
// but that's not what comes back from the server (on pacific).
|
||||
// Since we don't need this today, we're just going to ignore
|
||||
// it, but if we ever want to support this for external consumers
|
||||
// we'll need to figure out the real structure of this.
|
||||
// AlwaysOnModules lists the names of the always-on modules.
|
||||
AlwaysOnModules []string `json:"always_on_modules"`
|
||||
// DisabledModules lists structures describing modules that are
|
||||
// not currently enabled.
|
||||
DisabledModules []DisabledModule `json:"disabled_modules"`
|
||||
}
|
||||
|
||||
func parseModuleInfo(res commands.Response) (*ModuleInfo, error) {
|
||||
@ -53,10 +64,9 @@ func parseModuleInfo(res commands.Response) (*ModuleInfo, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// ListModules returns moduleInfo or error. it is not exported because
|
||||
// this is really not a cephfs specific thing but we needed it
|
||||
// for cephfs tests. maybe lift it somewhere else someday.
|
||||
func (fsa *MgrAdmin) listModules() (*ModuleInfo, error) {
|
||||
// ListModules returns a module info struct reporting the lists of
|
||||
// enabled, disabled, and always-on modules in the Ceph mgr.
|
||||
func (fsa *MgrAdmin) ListModules() (*ModuleInfo, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "mgr module ls",
|
||||
"format": "json",
|
||||
|
Loading…
Reference in New Issue
Block a user