diff --git a/cloudcontrol/node/hypervisor/__init__.py b/cloudcontrol/node/hypervisor/__init__.py index 37f5a604962dab2c09307c1af5a9cd1cf0d86f20..d5607e7ba317d8bc259b4b12093a867e1d3af4ec 100644 --- a/cloudcontrol/node/hypervisor/__init__.py +++ b/cloudcontrol/node/hypervisor/__init__.py @@ -149,6 +149,8 @@ class Handler(HostHandler): # unregister tags that will be re registered later for storage in self.hypervisor.storage.storages: + if storage.name.startswith('_'): + continue # Ignore internal storages self.tag_db.remove_tags(( 'sto%s_state' % storage, 'sto%s_size' % storage, diff --git a/cloudcontrol/node/hypervisor/domains/__init__.py b/cloudcontrol/node/hypervisor/domains/__init__.py index 958d6ad6b8edc57b005eb17083bd6f353a118e65..0c7148012e8d41ee0f0aec331abf3d6c3449e6a0 100644 --- a/cloudcontrol/node/hypervisor/domains/__init__.py +++ b/cloudcontrol/node/hypervisor/domains/__init__.py @@ -286,6 +286,9 @@ class VirtualMachine(object): pool = d.find('source').get('pool') vol = d.find('source').get('volume') volume = self.hypervisor.storage.get_volume_by_pool(pool, vol) + elif type_ == 'network': + vol = d.find('source').get('name') + volume = self.hypervisor.storage.get_volume_by_pool('_standalone', vol) else: continue @@ -600,6 +603,8 @@ class VirtualMachine(object): # Refresh shared pools on the destination to avoid unknown volumes: for pool_name in shared_pools: + if pool_name.startswith('_'): + continue # Ignore internal storages pool = dconn.storagePoolLookupByName(pool_name) pool.refresh() diff --git a/cloudcontrol/node/hypervisor/lib.py b/cloudcontrol/node/hypervisor/lib.py index 4e72409d459edcc42d8cd529a6f6539f9f583fba..14ac39f3d20b23c862eb1cb8a8d71008115375bc 100644 --- a/cloudcontrol/node/hypervisor/lib.py +++ b/cloudcontrol/node/hypervisor/lib.py @@ -346,6 +346,10 @@ class StorageIndex(object): Tag('sto%s_shared' % s.name, partial(lambda x: {True: 'yes', False: 'no'}[s.is_shared], s)), )) + # Add a special storage for standalone drives: + if '_standalone' not in self.storages: + self.storages['_standalone'] = DummyStorage('_standalone') + self.update_path_index() def update_path_index(self): @@ -510,6 +514,32 @@ class SharedStorage(Storage): pass # Do nothing. +class DummyStorage(Storage): + """Dummy storage abstraction.""" + + def __init__(self, name, shared=True): + """ + :param lv_storage: Libvirt pool storage instance + """ + self.uuid = None + self.name = name + self.shared = shared + + self.state, self.capacity = None, None + self.allocation, self.available = None, None + + self.type = 'dummy' + + self.volumes = DummyStorageVolumeDispenser(self) + + @property + def is_shared(self): + return self.shared + + def update(self, retry=1): + pass # Do nothing + + class Volume(object): """Volume abstraction.""" def __init__(self, storage, lv_volume):