Update pool size meter when state changes.

This commit is contained in:
Cole Robinson 2008-08-26 12:58:53 -04:00
parent 047ab7ede8
commit 0560e757e4
1 changed files with 19 additions and 8 deletions

View File

@ -539,11 +539,17 @@ class vmmHost(gobject.GObject):
def refresh_storage_pool(self, src, uri, uuid):
sel = self.window.get_widget("pool-list").get_selection()
model = self.window.get_widget("pool-list").get_model()
active = sel.get_selected()
if active[1] != None:
curruuid = active[0].get_value(active[1], 0)
if curruuid == uuid:
if curruuid != uuid:
return
self.pool_selected(sel)
for row in model:
if row[0] == curruuid:
row[2] = self.get_pool_size_percent(uuid)
break
def reset_pool_state(self):
self.window.get_widget("pool-details").set_sensitive(False)
@ -577,9 +583,7 @@ class vmmHost(gobject.GObject):
def repopulate_storage_pools(self, src, uri, uuid):
self.populate_storage_pools(self.window.get_widget("pool-list").get_model())
def populate_storage_pools(self, model):
model.clear()
for uuid in self.conn.list_pool_uuids():
def get_pool_size_percent(self, uuid):
pool = self.conn.get_pool(uuid)
cap = pool.get_capacity()
all = pool.get_allocation()
@ -587,6 +591,13 @@ class vmmHost(gobject.GObject):
per = 0
else:
per = int(((float(all) / float(cap)) * 100))
return per
def populate_storage_pools(self, model):
model.clear()
for uuid in self.conn.list_pool_uuids():
per = self.get_pool_size_percent(uuid)
pool = self.conn.get_pool(uuid)
model.append([uuid, pool.get_name(), per])
def populate_storage_volumes(self):