[virt-tools-list] [PATCH 1/1] connection: Avoid repeated default pool creation attempts

Cole Robinson crobinso at redhat.com
Tue Nov 12 19:35:41 UTC 2019


On 10/25/19 3:27 PM, Michael Weiser wrote:
> 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 at gmx.de>
> ---
>  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:
> 

Indeed, changes to how we check for pre-existing 'default' pool started
causing this

I tweaked the comment a bit and pushed this patch. Thanks!

- Cole




More information about the virt-tools-list mailing list