Commit cb11bdda authored by Antoine Millet's avatar Antoine Millet

Fixed closure bug in sto tag handling

parent 6c9afe17
......@@ -20,6 +20,7 @@ import logging
from itertools import chain, imap, count
from StringIO import StringIO
from xml.etree import cElementTree as et
from functools import partial
import pyev
import libvirt
......@@ -321,17 +322,17 @@ class StorageIndex(object):
self.storages[s.name] = s
# add tags
self.handler.tag_db.add_tags((
Tag('sto%s_state' % s.name, lambda: s.state, 5, 5),
Tag('sto%s_size' % s.name, lambda: s.capacity, 5, 5),
Tag('sto%s_free' % s.name, lambda: s.available, 5, 5),
Tag('sto%s_state' % s.name, partial(lambda x: x.state, s), 5, 5),
Tag('sto%s_size' % s.name, partial(lambda x: x.capacity, s), 5, 5),
Tag('sto%s_free' % s.name, partial(lambda x: x.available, s), 5, 5),
Tag('sto%s_used' % s.name,
lambda: s.capacity - s.available, 5, 5),
Tag('sto%s_type' % s.name, lambda: s.type, 5, 5),
partial(lambda x: x.capacity - x.available, s), 5, 5),
Tag('sto%s_type' % s.name, partial(lambda x: x.type, s), 5, 5),
Tag('sto%s_vol' % s.name,
lambda: ' '.join(s.volumes) if s.volumes and not s.is_shared else None,
partial(lambda x: ' '.join(x.volumes) if x.volumes and not x.is_shared else None, s),
5, 5),
Tag('sto%s_ratio' % s.name,
lambda: '%0.2f' % (1 - float(s.available) / s.capacity), 5, 5),
partial(lambda x: '%0.2f' % (1 - float(x.available) / x.capacity), s), 5, 5),
))
self.update_path_index()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment