def osd_remove(ceph_cluster, osd_id): """ osd remove Args: ceph_cluster: ceph cluster osd_id: osd id """ config = {"command": "rm", "service": "osd", "pos_args": [osd_id]} log.info(f"Executing OSD {config.pop('command')} service") osd = OSD(cluster=ceph_cluster, **config) osd.rm(config)
def run(ceph_cluster, **kw): """ Ceph-admin module to manage ceph-osd service Args: ceph_cluster (ceph.ceph.Ceph): Ceph cluster object kw: test data check ceph.ceph_admin.osd for test config """ log.info("Running Ceph-admin Monitor test") config = kw.get("config") build = config.get("build", config.get("rhbuild")) ceph_cluster.rhcs_version = build # Manage Ceph using ceph-admin orchestration command = config.pop("command") log.info("Executing OSD %s service" % command) osd = OSD(cluster=ceph_cluster, **config) try: method = fetch_method(osd, command) method(config) finally: # Get cluster state get_cluster_state(osd, CLUSTER_STATE) return 0
def set_osd_out(ceph_cluster, osd_id): """ Sets osd out Args: ceph_cluster: ceph cluster osd_id: osd id Returns: Pass->true, Fail->false """ config = {"command": "out", "service": "osd", "pos_args": [osd_id]} log.info(f"Executing OSD {config.pop('command')} service") osd = OSD(cluster=ceph_cluster, **config) out, err = osd.out(config) if f"marked out osd.{osd_id}" in err: return True return False
def set_osd_devices_unamanged(ceph_cluster, unmanaged): """ Sets osd device unmanaged as true/false Args: ceph_cluster: ceph cluster unmanaged: true/false """ config = { "command": "apply", "service": "osd", "args": {"all-available-devices": True, "unmanaged": unmanaged}, "verify": False, } log.info(f"Executing OSD {config.pop('command')} service") osd = OSD(cluster=ceph_cluster, **config) osd.apply(config)