651
def _connect_error(self, conn, shortmsg, tb, warnconsole):
652
shortmsg = shortmsg.strip(" \n")
651
def _connect_error(self, conn, errmsg, tb, warnconsole):
652
errmsg = errmsg.strip(" \n")
653
653
tb = tb.strip(" \n")
654
msg = _("Unable to connect to libvirt:\n\n%s\n\n") % shortmsg
656
if conn.is_xen() and not conn.is_remote():
657
msg += _("Verify that:\n"
658
" - A Xen host kernel was booted\n"
659
" - The Xen service has been started\n")
660
msg = msg.strip("\n")
661
details = "%s\n\n%s" % (msg, tb)
658
logging.debug(conn.get_transport())
659
if re.search(r"nc: .* -- 'U'", tb):
660
hint += _("The remote host requires a version of netcat/nc\n"
661
"which supports the -U option.")
663
elif conn.get_transport()[0] == "ssh" and re.search(r"ssh-askpass", tb):
664
hint += _("You need to install openssh-askpass or similar\n"
665
"to connect to this host.")
668
hint += _("Verify that the 'libvirtd' daemon is running\n"
669
"on the remote host.")
672
hint += _("Verify that:\n"
673
" - A Xen host kernel was booted\n"
674
" - The Xen service has been started")
665
if conn.is_remote() and re.search(r"nc: .* -- 'U'", tb):
667
_("\n - The remote netcat understands the '-U' option"))
670
msg += _("Could not detect a local session: if you are \n"
671
"running virt-manager over ssh -X or VNC, you \n"
672
"may not be able to connect to libvirt as a \n"
673
"regular user. Try running as root.\n\n")
675
msg += _("Verify that:\n" +
676
" - The 'libvirtd' daemon has been started\n" +
678
hint += _("Could not detect a local session: if you are \n"
679
"running virt-manager over ssh -X or VNC, you \n"
680
"may not be able to connect to libvirt as a \n"
681
"regular user. Try running as root.")
683
elif re.search(r"libvirt-sock", tb):
684
hint += _("Verify that:\n" +
677
685
" - The 'libvirt-bin' package is installed\n" +
678
686
" - The 'libvirtd' daemon has been started" +
679
(conn.is_qemu_system() and "\n - You are member of the 'libvirtd' group" or '')),
684
msg = msg.strip("\n")
685
details = (("%s\n\n" % msg) +
686
(_("Libvirt URI is: %s\n\n") % conn.get_uri()) +
689
self.err.show_err(msg, details,
690
title=_("Virtual Machine Manager Connection Failure"))
687
(conn.is_qemu_system() and "\n - You are member of the 'libvirtd' group" or ''))
690
msg = _("Unable to connect to libvirt.")
692
msg += "\n\n%s" % errmsg
694
msg += "\n\n%s" % hint
696
msg = msg.strip("\n")
699
details += "Libvirt URI is: %s\n\n" % conn.get_uri()
702
self.err.show_err(msg, details, title=_("Virtual Machine Manager Connection Failure"))
693
705
####################################