Skip to content
Snippets Groups Projects
Commit e20a9602 authored by Antoine Millet's avatar Antoine Millet
Browse files

Implemented disk*_shared tag on VM

parent 7ddf5120
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,8 @@ class VirtualMachine(object):
Tag('disk%s_path' % i, v.path, 10),
Tag('disk%s_pool' % i, v.storage.name, 10), # FIXME: change
Tag('disk%s_vol' % i, v.name, 10),
Tag('disk%s_cache' % i, lambda: self.cache_behaviour.get(v.path), 10)
Tag('disk%s_cache' % i, lambda: self.cache_behaviour.get(v.path), 10),
Tag('disk%s_shared' % i, lambda: {True: 'yes', False: 'no'}[v.storage.is_shared])
):
self.tag_db.add_tag(t)
......
......@@ -411,6 +411,9 @@ class StorageIndex(object):
class Storage(object):
"""Storage abstraction."""
SHARED_TYPES = ['rbd']
def __init__(self, lv_storage):
"""
:param lv_storage: Libvirt pool storage instance
......@@ -428,6 +431,10 @@ class Storage(object):
self.volumes = {}
self.update()
@property
def is_shared(self):
return True if self.type in Storage.SHARED_TYPES else False
def update(self):
self.update_attr()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment