storagepool: Don't default to refreshing volume list

This needlessly hits the network too much. The places where it's
important to have up to date info will either manually call pool
refresh, or give the user an refresh button.
This commit is contained in:
Cole Robinson 2014-09-12 09:55:12 -04:00
parent 508debaf2d
commit d1c22b3b2c
2 changed files with 5 additions and 7 deletions

View File

@ -171,7 +171,7 @@ class vmmConnection(vmmGObject):
def fetch_all_vols():
ret = []
for pool in self._pools.values():
for vol in pool.get_volumes(refresh=False).values():
for vol in pool.get_volumes().values():
try:
ret.append(vol.get_xmlobj(refresh_if_nec=False))
except Exception, e:

View File

@ -181,7 +181,7 @@ class vmmStoragePool(vmmLibvirtObject):
self._backend.refresh(0)
self.refresh_xml()
self.update_volumes(refresh=True)
self._update_volumes()
self.idle_emit("refreshed")
def define_name(self, newname):
@ -193,15 +193,13 @@ class vmmStoragePool(vmmLibvirtObject):
# Volume handling #
###################
def get_volumes(self, refresh=True):
if refresh:
self.update_volumes()
def get_volumes(self):
return self._volumes
def get_volume(self, key):
return self._volumes[key]
def update_volumes(self, refresh=False):
def _update_volumes(self):
if not self.is_active():
self._volumes = {}
return
@ -211,7 +209,7 @@ class vmmStoragePool(vmmLibvirtObject):
lambda obj, key: vmmStorageVolume(self.conn, obj, key))
for volname in allvols:
if volname not in new and refresh:
if volname not in new:
allvols[volname].refresh_xml()
self._volumes = allvols