def add_default_conn(self, manager): # Only add default if no connections are currently known if self.config.get_conn_uris(): return # Manager fail message msg = _( "Could not detect a default hypervisor. Make\n" "sure the appropriate virtualization packages\n" "are installed (kvm, qemu, libvirt, etc.), and\n" "that libvirtd is running.\n\n" "A hypervisor connection can be manually\n" "added via File->Add Connection" ) logging.debug("Determining default libvirt URI") ret = None did_install_libvirt = False try: libvirt_packages = self.config.libvirt_packages packages = self.config.hv_packages + libvirt_packages ret = packageutils.check_packagekit(self.err, packages, True) except: logging.exception("Error talking to PackageKit") if ret is not None: did_install_libvirt = False for p in libvirt_packages: if p in ret: did_install_libvirt = True break tryuri = "qemu:///system" else: tryuri = default_uri() if tryuri is None: manager.set_startup_error(msg) return if did_install_libvirt: didstart = packageutils.start_libvirtd() warnmsg = _( "Libvirt was just installed, so the 'libvirtd' service will\n" "will need to be started.\n" "virt-manager will connect to libvirt on the next application\n" "start up." ) 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)
def add_default_conn(self, manager): # Only add default if no connections are currently known if self.config.get_conn_uris(): return # Manager fail message msg = _("Could not detect a default hypervisor. Make\n" "sure the appropriate virtualization packages\n" "are installed (kvm, qemu, libvirt, etc.), and\n" "that libvirtd is running.\n\n" "A hypervisor connection can be manually\n" "added via File->Add Connection") logging.debug("Determining default libvirt URI") ret = None did_install_libvirt = False try: libvirt_packages = self.config.libvirt_packages packages = self.config.hv_packages + libvirt_packages ret = packageutils.check_packagekit(self.err, packages, True) except: logging.exception("Error talking to PackageKit") if ret is not None: did_install_libvirt = False for p in libvirt_packages: if p in ret: did_install_libvirt = True break tryuri = "qemu:///system" else: tryuri = default_uri() if tryuri is None: manager.set_startup_error(msg) return if did_install_libvirt: didstart = packageutils.start_libvirtd() warnmsg = _( "Libvirt was just installed, so the 'libvirtd' service will\n" "will need to be started.\n" "virt-manager will connect to libvirt on the next application\n" "start up.") 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)
def idle_connect(): do_start = packageutils.start_libvirtd() 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)
def idle_connect(): do_start = packageutils.start_libvirtd() if not do_start: manager.err.ok(_("Libvirt service must be started"), warnmsg) self.connect_to_uri(tryuri, autoconnect=True, do_start=do_start)