connection: Avoid repeated default pool creation attempts

During startup virtinst.StoragePool.build_default_pool() tries to
determine whether the default storage pool already exists. Because
events have not yet been processed, the list of existing storage pools
is still empty. Therefore it seems as if it does not exist yet and
build_default_pool() falls back to creating it which causes an error
message from libvirtd in the system log:

libvirtd: operation failed: pool 'default' already exists with uuid.

Move default pool creation after event processing to avoid these
redundant creation attempts.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This commit is contained in:
Michael Weiser 2019-10-25 21:27:18 +02:00 committed by Cole Robinson
parent ae19d6d6ec
commit 51d84c54cb

View File

@ -990,13 +990,6 @@ class vmmConnection(vmmGObject):
log.debug("%s capabilities:\n%s", log.debug("%s capabilities:\n%s",
self.get_uri(), self.caps.get_xml()) self.get_uri(), self.caps.get_xml())
# Try to create the default storage pool
# We want this before events setup to save some needless polling
try:
virtinst.StoragePool.build_default_pool(self.get_backend())
except Exception as e:
log.debug("Building default pool failed: %s", str(e))
self._add_conn_events() self._add_conn_events()
try: try:
@ -1025,6 +1018,14 @@ class vmmConnection(vmmGObject):
self._init_object_event = None self._init_object_event = None
self._init_object_count = None self._init_object_count = None
# Try to create the default storage pool
# We need this after events setup so we can determine if the default
# pool already exists
try:
virtinst.StoragePool.build_default_pool(self.get_backend())
except Exception as e:
log.debug("Building default pool failed: %s", str(e))
def _open_thread(self): def _open_thread(self):
ConnectError = None ConnectError = None
try: try: