[virt-tools-list] [virt-manager PATCH] engine: Fix started libvirt daemon requirement

Cole Robinson crobinso at redhat.com
Mon Oct 28 15:49:11 UTC 2013


On 10/16/2013 11:50 AM, Martin Kletzander wrote:
> This patch makes virt-manager usable again without systemd (or dbus).
> When started without systemd, but with libvirtd properly working,
> there was error reported, and virt-manager didn't even try to connect
> to the destination.
> 
> This patch modifies the behavior in two ways.  When connection is
> added with "do_start=False" it will still try to connect, but won't
> error out when unsuccessful.  The second modification is that upon
> startup, the idle_connect() function will error out only if we failed
> starting libvirtd _and_ we couldn't connect to the uri.  So if we
> failed starting libvirtd, but could connect, there is no disruption
> for the user.
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  virtManager/engine.py | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/virtManager/engine.py b/virtManager/engine.py
> index 9d94664..c3f3abc 100644
> --- a/virtManager/engine.py
> +++ b/virtManager/engine.py
> @@ -1,5 +1,5 @@
>  #
> -# Copyright (C) 2006 Red Hat, Inc.
> +# Copyright (C) 2006, 2013 Red Hat, Inc.
>  # Copyright (C) 2006 Daniel P. Berrange <berrange at redhat.com>
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -217,10 +217,10 @@ class vmmEngine(vmmGObject):
>          # packagekit async dialog has a chance to go away
>          def idle_connect():
>              do_start = packageutils.start_libvirtd()
> -            if not do_start:
> +            connected = self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)
> +            if not connected and do_start:
>                  manager.err.ok(_("Libvirt service must be started"), warnmsg)
> 
> -            self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)
>          self.idle_add(idle_connect)
> 
> 
> @@ -489,6 +489,11 @@ class vmmEngine(vmmGObject):
> 
>              if do_start:
>                  conn.open()
> +            else:
> +                try:
> +                    conn.open()
> +                except:
> +                    return None
>              return conn
>          except Exception:
>              logging.exception("Error connecting to %s", uri)
> 

ACK

- Cole




More information about the virt-tools-list mailing list