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 <[email protected]>
---
 virtManager/connection.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/virtManager/connection.py b/virtManager/connection.py
index f6dc5f5b..e54e3ecd 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -990,13 +990,6 @@ class vmmConnection(vmmGObject):
         log.debug("%s capabilities:\n%s",
                       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()
 
         try:
@@ -1025,6 +1018,16 @@ class vmmConnection(vmmGObject):
         self._init_object_event = None
         self._init_object_count = None
 
+        # Try to create the default storage pool
+        # We want this after events setup to actually see an already existing
+        # default pool and avoid failing recreation attempts causing errors
+        # "libvirtd: operation failed: pool 'default' already exists with
+        # uuid" from libvirtd
+        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):
         ConnectError = None
         try:
-- 
2.23.0

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to