~ubuntu-branches/ubuntu/raring/virt-manager/raring-proposed

« back to all changes in this revision

Viewing changes to src/virtManager/manager.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-05-24 11:13:42 UTC
  • mfrom: (2.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20120524111342-5oambnc8ytrzw6un
Tags: 0.9.1-3ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/control, debian/rules: Build using dh_python2
  - debian/control: Depend on python-appindicator for appindicator
    support.
  - Add a /usr/share/pixmaps/virt-manager-icon.svg symlink to link icon to
    where the Application Indicator can find it.
  - debian/patches/more_helpful_error_message.patch: explain to the user
    why he can't connect to qemu:///system and what he can do fix it.
  - debian/control: drop python-spice-client-gtk to Suggests as it is in
    universe.
  - debian/patches/use_ubuntu_package_names.patch: Suggest installing the
    packages that are actually available in Ubuntu.
  - debian/rules: Set qemu user to libvirt-qemu so appropriate
    permissions get set.
  - debian/rules: Set Ubuntu as the preferred distro so we appear first
    in the list.
  - debian/rules: disable TUI for now, since the required dependencies
    are not available (Newt Syrup).
  - debian/rules: Drop patchsys-quilt include since dpkg-source does the
    quilt dance for us.
  - Removed python-ipy dependency as it is in universe:
    - debian/control: remove python-ipy from Depends
    - debian/series: disable 0002-Use-IPy-from-python-ipy.patch patch so
      we use the one that's included in the virt-manager source.
    - debian/rules: don't delete the IPy file.
  - debian/patches/fork_before_gtk_import.patch: work around global menu
    and appindicator not working correctly by forking before the gtk
    import.
  - debian/patches/fix_accidental_recursion.patch: fix accidental recursion
    when reporting grab keys.
  - debian/patches/fix_listen_address.patch: fix connecting when graphics
    configuration uses graphics attribute.
  - debian/patches/fix_dbus_deprecation_warning.patch: fix deprecation
    warning by switching to new way of setting up the event loop.
* Removed patches:
  - debian/patches/fix_error_reporting.patch: has equivalent Debian
    patch.
* Dropped changes:
  - debian/control: lower libvirt-bin from Recommends to Suggests: we
    depend on python-libvirt which in turn pulls in libvirt-bin anyway.
* debian/patches/fix_listen_address.patch: updated again to prevent
  regression when the remote server has a listen attribute that specifies
  "0.0.0.0". (LP: #837275)
* debian/patches/more_helpful_error_message.patch: updated for new
  version and to fix error dialog. (LP: #998724)

Show diffs side-by-side

added added

removed removed

Lines of Context:
648
648
            conn.open()
649
649
            return True
650
650
 
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
655
 
 
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)
 
654
        hint = ""
 
655
        show_errmsg = True
 
656
 
 
657
        if conn.is_remote():
 
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.")
 
662
                show_errmsg = False
 
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.")
 
666
                show_errmsg = False
 
667
            else:
 
668
                hint += _("Verify that the 'libvirtd' daemon is running\n"
 
669
                          "on the remote host.")
 
670
 
 
671
        elif conn.is_xen():
 
672
            hint += _("Verify that:\n"
 
673
                      " - A Xen host kernel was booted\n"
 
674
                      " - The Xen service has been started")
662
675
 
663
676
        else:
664
 
            hints = []
665
 
            if conn.is_remote() and re.search(r"nc: .* -- 'U'", tb):
666
 
                hints.append(
667
 
                    _("\n - The remote netcat understands the '-U' option"))
668
 
 
669
677
            if warnconsole:
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")
674
 
            else:
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.")
 
682
                show_errmsg = False
 
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 '')),
680
 
 
681
 
                for hint in hints:
682
 
                    msg += hint
683
 
 
684
 
            msg = msg.strip("\n")
685
 
            details = (("%s\n\n" % msg) +
686
 
                       (_("Libvirt URI is: %s\n\n") % conn.get_uri()) +
687
 
                       tb)
688
 
 
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 ''))
 
688
                show_errmsg = False
 
689
 
 
690
        msg = _("Unable to connect to libvirt.")
 
691
        if show_errmsg:
 
692
            msg += "\n\n%s" % errmsg
 
693
        if hint:
 
694
            msg += "\n\n%s" % hint
 
695
 
 
696
        msg = msg.strip("\n")
 
697
        details = msg
 
698
        details += "\n\n"
 
699
        details += "Libvirt URI is: %s\n\n" % conn.get_uri()
 
700
        details += tb
 
701
 
 
702
        self.err.show_err(msg, details, title=_("Virtual Machine Manager Connection Failure"))
691
703
 
692
704
 
693
705
    ####################################