Пример #1
0
    def test_remove_osds(self, cephadm_module):
        with with_host(cephadm_module, 'test'):
            CephadmServe(cephadm_module)._refresh_host_daemons('test')
            c = cephadm_module.list_daemons()
            wait(cephadm_module, c)

            c = cephadm_module.remove_daemons(['osd.0'])
            out = wait(cephadm_module, c)
            assert out == ["Removed osd.0 from host 'test'"]

            cephadm_module.to_remove_osds.enqueue(
                OSD(osd_id=0,
                    replace=False,
                    force=False,
                    hostname='test',
                    fullname='osd.0',
                    process_started_at=datetime_now(),
                    remove_util=cephadm_module.to_remove_osds.rm_util))
            cephadm_module.to_remove_osds.process_removal_queue()
            assert cephadm_module.to_remove_osds == OSDRemovalQueue(
                cephadm_module)

            c = cephadm_module.remove_osds_status()
            out = wait(cephadm_module, c)
            assert out == []
Пример #2
0
    def test_load(self, cephadm_module, rm_util):
        data = json.dumps([{
            "osd_id": 35,
            "started": True,
            "draining": True,
            "stopped": False,
            "replace": False,
            "force": False,
            "nodename": "node2",
            "drain_started_at": "2020-09-14T11:41:53.960463",
            "drain_stopped_at": None,
            "drain_done_at": None,
            "process_started_at": "2020-09-14T11:41:52.245832"
        }])
        cephadm_module.set_store('osd_remove_queue', data)
        cephadm_module.to_remove_osds.load_from_store()

        expected = OSDRemovalQueue(cephadm_module)
        expected.osds.add(OSD(osd_id=35, remove_util=rm_util, draining=True))
        assert cephadm_module.to_remove_osds == expected
Пример #3
0
def osd_obj():
    with mock.patch("cephadm.services.osd.RemoveUtil"):
        o = OSD(0, mock.MagicMock())
        yield o