Loading ccnode/hypervisor/__init__.py +13 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from itertools import chain, imap import libvirt from ccnode.host import Handler as HostHandler from ccnode.tags import tag_inspector, get_tags from ccnode.tags import Tag, tag_inspector, get_tags from ccnode.hypervisor import tags from ccnode.hypervisor import lib as _libvirt from ccnode.hypervisor.lib import EVENTS, EventLoop Loading Loading @@ -37,6 +37,16 @@ class Handler(HostHandler): self.hypervisor = weakref.proxy(hypervisor) # register hypervisor storage tags for name, storage in self.hypervisor.storage.storages.iteritems(): for t in ( Tag('sto%s_size' % name, lambda: storage.capacity, 5), Tag('sto%s_free' % name, lambda: storage.available, 5), Tag('sto%s_used' % name, lambda: storage.capacity - storage.available, 5), ): self.tags[t.name] = t # register domains proxy = kwargs.pop('proxy') for dom in hypervisor.domains.itervalues(): Loading Loading @@ -214,6 +224,8 @@ class Storage(object): self.uuid = lv_storage.UUID() self.name = lv_storage.name() self.capacity, self.allocation, self.available = lv_storage.info()[1:] self.volumes = map( partial(Volume, storage=self), (lv_storage.storageVolLookupByName(n) for n in Loading ccnode/hypervisor/tags.py +2 −3 Original line number Diff line number Diff line Loading @@ -55,12 +55,11 @@ def rjobs(): # storage pools def sto(): def sto(handl): """Storage pool names.""" return u' '.join(handl.hypervisor.storage.storages.iterkeys()) # dynamic sto # Vm related tags def nvm(handl): """Number of VMS in the current hypervisor.""" Loading Loading
ccnode/hypervisor/__init__.py +13 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from itertools import chain, imap import libvirt from ccnode.host import Handler as HostHandler from ccnode.tags import tag_inspector, get_tags from ccnode.tags import Tag, tag_inspector, get_tags from ccnode.hypervisor import tags from ccnode.hypervisor import lib as _libvirt from ccnode.hypervisor.lib import EVENTS, EventLoop Loading Loading @@ -37,6 +37,16 @@ class Handler(HostHandler): self.hypervisor = weakref.proxy(hypervisor) # register hypervisor storage tags for name, storage in self.hypervisor.storage.storages.iteritems(): for t in ( Tag('sto%s_size' % name, lambda: storage.capacity, 5), Tag('sto%s_free' % name, lambda: storage.available, 5), Tag('sto%s_used' % name, lambda: storage.capacity - storage.available, 5), ): self.tags[t.name] = t # register domains proxy = kwargs.pop('proxy') for dom in hypervisor.domains.itervalues(): Loading Loading @@ -214,6 +224,8 @@ class Storage(object): self.uuid = lv_storage.UUID() self.name = lv_storage.name() self.capacity, self.allocation, self.available = lv_storage.info()[1:] self.volumes = map( partial(Volume, storage=self), (lv_storage.storageVolLookupByName(n) for n in Loading
ccnode/hypervisor/tags.py +2 −3 Original line number Diff line number Diff line Loading @@ -55,12 +55,11 @@ def rjobs(): # storage pools def sto(): def sto(handl): """Storage pool names.""" return u' '.join(handl.hypervisor.storage.storages.iterkeys()) # dynamic sto # Vm related tags def nvm(handl): """Number of VMS in the current hypervisor.""" Loading