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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxx>
 #
 # 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)
-- 
1.8.4

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux