conn: Don't process any pool REFRESHED events during conn startup

When new pool objects appear, we call refresh() on them, to ensure
we have the latest data (in case manual changes were made to the
storage pool directory behind libvirt's back, which is quite common).

However with the storage event support, this results in lots of
REFRESHED signals during initial connection startup, which kick
off redundant object polling.

Avoid storage REFRESHED events if they come in before the connection
is finished starting up to skip this redundant polling.
This commit is contained in:
Cole Robinson 2016-06-20 16:40:33 -04:00
parent 6a740ff91c
commit 53459cb0f6

View File

@ -778,6 +778,13 @@ class vmmConnection(vmmGObject):
name = pool.name()
logging.debug("storage pool lifecycle event: storage=%s event=%s "
"reason=%s", name, event, reason)
if (not self.is_active() and
event == getattr(libvirt, "VIR_STORAGE_POOL_EVENT_REFRESHED", 4)):
# We refresh() pools during connection startup, and this spams
# the logs, so skip it.
return
obj = self.get_pool(name)
if obj: