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)
|
manager.set_startup_error(msg)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
do_start = not did_install_libvirt
|
||||||
if did_install_libvirt:
|
if did_install_libvirt:
|
||||||
didstart = packageutils.start_libvirtd()
|
didstart = packageutils.start_libvirtd()
|
||||||
|
do_start = didstart
|
||||||
|
|
||||||
warnmsg = _(
|
warnmsg = _(
|
||||||
"Libvirt was just installed, so the 'libvirtd' service will\n"
|
"Libvirt was just installed, so the 'libvirtd' service will\n"
|
||||||
"will need to be started.\n"
|
"will need to be started.\n"
|
||||||
@ -189,8 +192,7 @@ class vmmEngine(vmmGObject):
|
|||||||
if not didstart:
|
if not didstart:
|
||||||
self.err.ok(_("Libvirt service must be started"), warnmsg)
|
self.err.ok(_("Libvirt service must be started"), warnmsg)
|
||||||
|
|
||||||
self.connect_to_uri(tryuri, autoconnect=True,
|
self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)
|
||||||
do_start=not did_install_libvirt)
|
|
||||||
|
|
||||||
|
|
||||||
def load_stored_uris(self):
|
def load_stored_uris(self):
|
||||||
|
@ -217,7 +217,7 @@ def start_libvirtd():
|
|||||||
state = props.Get("org.freedesktop.systemd1.Unit", "ActiveState")
|
state = props.Get("org.freedesktop.systemd1.Unit", "ActiveState")
|
||||||
|
|
||||||
logging.debug("libvirtd state=%s", state)
|
logging.debug("libvirtd state=%s", state)
|
||||||
if state == "Active":
|
if str(state).lower() == "active":
|
||||||
logging.debug("libvirtd already active, not starting")
|
logging.debug("libvirtd already active, not starting")
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
@ -226,12 +226,15 @@ def start_libvirtd():
|
|||||||
|
|
||||||
# Connect to system-config-services and offer to start
|
# Connect to system-config-services and offer to start
|
||||||
try:
|
try:
|
||||||
|
logging.debug("libvirtd not running, asking system-config-services "
|
||||||
|
"to start it")
|
||||||
scs = dbus.Interface(bus.get_object(
|
scs = dbus.Interface(bus.get_object(
|
||||||
"org.fedoraproject.Config.Services",
|
"org.fedoraproject.Config.Services",
|
||||||
"/org/fedoraproject/Config/Services/systemd1"),
|
"/org/fedoraproject/Config/Services/systemd1"),
|
||||||
"org.freedesktop.systemd1.Manager")
|
"org.freedesktop.systemd1.Manager")
|
||||||
scs.StartUnit(unitname, "replace")
|
scs.StartUnit(unitname, "replace")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
logging.debug("Starting libvirtd appeared to succeed")
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
logging.exception("Failed to talk to system-config-services")
|
logging.exception("Failed to talk to system-config-services")
|
||||||
|
Loading…
Reference in New Issue
Block a user