diff --git a/virtManager/addstorage.py b/virtManager/addstorage.py index d6f0fe6db..64b594dbb 100644 --- a/virtManager/addstorage.py +++ b/virtManager/addstorage.py @@ -20,6 +20,7 @@ import logging import os import statvfs +import time from gi.repository import GObject from gi.repository import Gtk @@ -78,9 +79,9 @@ class vmmAddStorage(vmmGObjectUI): avail = 0 if pool and pool.is_active(): - # FIXME: make sure not inactive? - # FIXME: use a conn specific function after we send pool-added - pool.refresh() + # Rate limit this, since it can be spammed at dialog startup time + if ((time.time() - pool.get_last_refresh_time()) > 10): + pool.refresh() avail = int(pool.get_available()) elif not self.conn.is_remote() and os.path.exists(path): diff --git a/virtManager/storagepool.py b/virtManager/storagepool.py index e1bd7a012..89315f7dd 100644 --- a/virtManager/storagepool.py +++ b/virtManager/storagepool.py @@ -19,6 +19,7 @@ # import logging +import time from gi.repository import GObject @@ -104,6 +105,7 @@ class vmmStoragePool(vmmLibvirtObject): self._active = True self._support_isactive = None + self._last_refresh_time = 0 self._volumes = {} @@ -182,6 +184,10 @@ class vmmStoragePool(vmmLibvirtObject): self.refresh_xml() self._update_volumes() self.idle_emit("refreshed") + self._last_refresh_time = time.time() + + def get_last_refresh_time(self): + return self._last_refresh_time def define_name(self, newname): return self._define_name_helper("storagepool",