mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Fix detection of running libvirtd via systemd
This commit is contained in:
parent
35bab2cc98
commit
2163ba3a30
@ -178,8 +178,11 @@ class vmmEngine(vmmGObject):
|
||||
manager.set_startup_error(msg)
|
||||
return
|
||||
|
||||
do_start = not did_install_libvirt
|
||||
if did_install_libvirt:
|
||||
didstart = packageutils.start_libvirtd()
|
||||
do_start = didstart
|
||||
|
||||
warnmsg = _(
|
||||
"Libvirt was just installed, so the 'libvirtd' service will\n"
|
||||
"will need to be started.\n"
|
||||
@ -189,8 +192,7 @@ class vmmEngine(vmmGObject):
|
||||
if not didstart:
|
||||
self.err.ok(_("Libvirt service must be started"), warnmsg)
|
||||
|
||||
self.connect_to_uri(tryuri, autoconnect=True,
|
||||
do_start=not did_install_libvirt)
|
||||
self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)
|
||||
|
||||
|
||||
def load_stored_uris(self):
|
||||
|
@ -217,7 +217,7 @@ def start_libvirtd():
|
||||
state = props.Get("org.freedesktop.systemd1.Unit", "ActiveState")
|
||||
|
||||
logging.debug("libvirtd state=%s", state)
|
||||
if state == "Active":
|
||||
if str(state).lower() == "active":
|
||||
logging.debug("libvirtd already active, not starting")
|
||||
return True
|
||||
except:
|
||||
@ -226,12 +226,15 @@ def start_libvirtd():
|
||||
|
||||
# Connect to system-config-services and offer to start
|
||||
try:
|
||||
logging.debug("libvirtd not running, asking system-config-services "
|
||||
"to start it")
|
||||
scs = dbus.Interface(bus.get_object(
|
||||
"org.fedoraproject.Config.Services",
|
||||
"/org/fedoraproject/Config/Services/systemd1"),
|
||||
"org.freedesktop.systemd1.Manager")
|
||||
scs.StartUnit(unitname, "replace")
|
||||
time.sleep(2)
|
||||
logging.debug("Starting libvirtd appeared to succeed")
|
||||
return True
|
||||
except:
|
||||
logging.exception("Failed to talk to system-config-services")
|
||||
|
Loading…
Reference in New Issue
Block a user