go-ceph/cephfs/admin/mgrmodule.go
John Mulligan 2e8b52be8a cephfs admin: add EnableMirroringModule and DisableMirroringModule funcs
Add functions EnableMirroringModule and DisableMirroringModule for
turning on an off the mirroring module at the ceph mgr.
This also adds the lower level EnableModule and DisableModule that take
a string parameter naming the module, and are the base for
EnableMirroringModule and DisableMirroringModule.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-03 07:25:28 +00:00

55 lines
1.4 KiB
Go

package admin
import (
"github.com/ceph/go-ceph/internal/commands"
)
const mirroring = "mirroring"
// EnableModule will enable the specified manager module.
//
// Similar To:
// ceph mgr module enable <module> [--force]
func (fsa *FSAdmin) EnableModule(module string, force bool) error {
m := map[string]string{
"prefix": "mgr module enable",
"module": module,
"format": "json",
}
if force {
m["force"] = "--force"
}
// Why is this _only_ part of the mon command json? You'd think a mgr
// command would be available as a MgrCommand but I couldn't figure it out.
return commands.MarshalMonCommand(fsa.conn, m).NoData().End()
}
// DisableModule will disable the specified manager module.
//
// Similar To:
// ceph mgr module disable <module>
func (fsa *FSAdmin) DisableModule(module string) error {
m := map[string]string{
"prefix": "mgr module disable",
"module": module,
"format": "json",
}
return commands.MarshalMonCommand(fsa.conn, m).NoData().End()
}
// EnableMirroringModule will enable the mirroring module for cephfs.
//
// Similar To:
// ceph mgr module enable mirroring [--force]
func (fsa *FSAdmin) EnableMirroringModule(force bool) error {
return fsa.EnableModule(mirroring, force)
}
// DisableMirroringModule will disable the mirroring module for cephfs.
//
// Similar To:
// ceph mgr module disable mirroring
func (fsa *FSAdmin) DisableMirroringModule() error {
return fsa.DisableModule(mirroring)
}