def test_migrate_service_id_mon_one(cephadm_module: CephadmOrchestrator): with with_host(cephadm_module, 'host1'): cephadm_module.set_store( SPEC_STORE_PREFIX + 'mon.wrong', json.dumps( { 'spec': { 'service_type': 'mon', 'service_id': 'wrong', 'placement': { 'hosts': ['host1'] } }, 'created': datetime.utcnow().strftime(DATEFMT), }, sort_keys=True), ) cephadm_module.spec_store.load() assert len(cephadm_module.spec_store.specs) == 1 assert cephadm_module.spec_store.specs['mon.wrong'].service_name( ) == 'mon' cephadm_module.migration_current = 1 cephadm_module.migration.migrate() assert cephadm_module.migration_current == 2 assert len(cephadm_module.spec_store.specs) == 1 assert cephadm_module.spec_store.specs['mon'] == ServiceSpec( service_type='mon', unmanaged=True, placement=PlacementSpec(hosts=['host1']))
def test_migrate_service_id_mds_one(cephadm_module: CephadmOrchestrator): with with_host(cephadm_module, 'host1'): cephadm_module.set_store( SPEC_STORE_PREFIX + 'mds', json.dumps( { 'spec': { 'service_type': 'mds', 'placement': { 'hosts': ['host1'] } }, 'created': datetime.utcnow().strftime(DATEFMT), }, sort_keys=True), ) cephadm_module.spec_store.load() # there is nothing to migrate, as the spec is gone now. assert len(cephadm_module.spec_store.specs) == 0