Skip to content
Snippets Groups Projects
Commit f6437771 authored by Anael Beutot's avatar Anael Beutot
Browse files

Added tag type for storage pools.

Type is the same as returned by libvirt (for now).
One of dir, fs, netfs, logical, disk, iscsi, mpath, rbd.
parent 6f4e2eec
No related branches found
No related tags found
No related merge requests found
import logging
import weakref
from StringIO import StringIO
from itertools import chain, imap
from xml.etree import cElementTree as et
import libvirt
from sjrpc.utils import threadless
......@@ -83,6 +85,7 @@ class Handler(HostHandler):
Tag('sto%s_free' % name, lambda: storage.available, 5, 5),
Tag('sto%s_used' % name,
lambda: storage.capacity - storage.available, 5, 5),
Tag('sto%s_type' % name, lambda: storage.type, 5, 5),
))
# register domains
......@@ -138,6 +141,7 @@ class Handler(HostHandler):
'sto%s_size' % storage,
'sto%s_free' % storage,
'sto%s_used' % storage,
'sto%s_type' % storage,
))
# unregister sub objects (for the same reason)
for sub_id in self.tag_db.keys():
......@@ -715,6 +719,9 @@ class Storage(object):
self.state, self.capacity, self.allocation, self.available = lv_storage.info()
self.state = STORAGE_STATES[self.state]
self.type = et.ElementTree().parse(
StringIO(lv_storage.XMLDesc(0))).get('type')
self.volumes = dict((v.name, v) for v in imap(
Volume,
(lv_storage.storageVolLookupByName(n) for n in
......
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