Commit e20a9602 authored by Antoine Millet's avatar Antoine Millet
Browse files

Implemented disk*_shared tag on VM

parent 7ddf5120
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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)

+7 −0
Original line number Diff line number Diff line
@@ -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()