Bug 505450 - virt-install can't find a usable connection for kvm guests.
Summary: virt-install can't find a usable connection for kvm guests.
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python-virtinst
Version: 5.4
Hardware: All
OS: Linux
high
high
Target Milestone: beta
: ---
Assignee: Cole Robinson
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-11 22:58 UTC by Gurhan Ozen
Modified: 2013-11-04 01:42 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-06-15 01:33:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Defer to libvirt's default connection (2.80 KB, text/plain)
2009-06-12 18:43 UTC, Cole Robinson
no flags Details

Description Gurhan Ozen 2009-06-11 22:58:33 UTC
Description of problem:
kvm guest installation guests fail with the error:

"ERROR    Could not find usable default libvirt connection." Because of the recent change of location of qemu-kvm program in kvm package. 


Version-Release number of selected component (if applicable):
# rpm -qa | egrep "kvm|python-virtinst|libvirt"
etherboot-zroms-kvm-5.4.4-10.el5
kvm-83-74.el5
libvirt-0.6.3-8.el5
kmod-kvm-83-74.el5
libvirt-0.6.3-8.el5
kvm-qemu-img-83-74.el5
libvirt-python-0.6.3-8.el5
python-virtinst-0.400.3-2.el5


How reproducible:
Very

Steps to Reproduce:
1. Try to install a kvm guest in RHEL5.4-Server-20090611.nightly tree with selinux-policy-2.4.6-245.el5 and selinux-policy-targeted-2.4.6-245.el5 packages.

2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Daniel Berrangé 2009-06-12 09:47:18 UTC
Hmm, this is the result of two flaws in virtinst code

First in cli.getConnect() 

    if connect is None:
        fail(_("Could not find usable default libvirt connection."))

    logging.debug("Using libvirt URI '%s'" % connect)
    return libvirt.open(connect)


This 'connect is None' check is bogus. It is fine to pass 'None' straight through to libvirt.open(), allowing libvirt's automatic probe logic to choose the connection.


Before this point though, in util.default_connect()


def default_connection():
    if os.path.exists('/var/lib/xend'):
        if os.path.exists('/dev/xen/evtchn'):
            return 'xen' 
        if os.path.exists("/proc/xen"):
            return 'xen' 

    if os.path.exists("/usr/bin/qemu") or \
        os.path.exists("/usr/bin/qemu-kvm") or \
        os.path.exists("/usr/bin/kvm") or \
        os.path.exists("/usr/bin/xenner"):
        if User.current().has_priv(User.PRIV_QEMU_SYSTEM):
            return "qemu:///system"
        else:
            return "qemu:///session"
    return None


All this code should now be removed IMHO, as it is poorly replicating the automatic probe logic libvirt will now do. This code is a left-over from the old days when libvirt would not automatically detect a KVM/QEMU connection.

Comment 2 Cole Robinson 2009-06-12 13:37:48 UTC
Ahh! Right, I forgot that auto probing was added to libvirt. I'll draw up a patch for that.

Comment 3 Gurhan Ozen 2009-06-12 18:13:02 UTC
Forgot to mention the workaround when opening the bug. Workaround for this issue is to add "--connect qemu:///system" to virt-install arguments.

Comment 4 Cole Robinson 2009-06-12 18:43:44 UTC
Created attachment 347646 [details]
Defer to libvirt's default connection

Comment 5 Cole Robinson 2009-06-15 01:33:43 UTC
Built into python-virtinst-0.400.3-3.el5. Since this issue hasn't hit a released package, I'm closing this as NEXTRELEASE.


Note You need to log in before you can comment on or make changes to this bug.