virt-install doesn't automatically default to Xen in Trusty

Bug #1334749 reported by GeorgeDunlap
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Fix Released
Medium
Stefan Bader

Bug Description

If you boot under Xen in Trusty, and install virt-install, if you don't specify a URI it gives you this warning:

WARNING KVM acceleration not available, using 'qemu'

If you specify "-c xen:///" on the command-line, however, it works properly.

Similarly, if after creating a VM with virt-installer, you check it with virsh without specifying the URI, you get nothing; but if you specify Xen, then it works:

# virsh list --all
 Id Name State
----------------------------------------------------

# virsh -c xen:/// list --all
 Id Name State
----------------------------------------------------
 - u14.04 shut off

I'm not sure what the issue is here: my colleagues who are using a more recent version of libvirt (1.2.5) in Fedora 20 were unable to reproduce the issue.

Stefan Bader (smb)
Changed in libvirt (Ubuntu):
assignee: nobody → Stefan Bader (smb)
Revision history for this message
Stefan Bader (smb) wrote :

I will have to play around with that and check the newer version of libvirt. But it might be a fundamental problem. For exclusive technologies like KVM and Xen, I guess the tools could make a decission at run-time. It would need to be runtime because it is always possible to boot the same install with or without the Xen hypervisor. So the same installation could be using KVM or Xen as hypervisor.
Having said that, it might be possible that it depends on whether libvirt is installed before or after Xen (and maybe needs to be running in dom0 to make the other choice).

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Stefan, did you ever reach any conclusions about this?

no longer affects: virtinst (Ubuntu)
Changed in libvirt (Ubuntu):
status: New → Incomplete
importance: Undecided → Medium
Revision history for this message
Stefan Bader (smb) wrote :

Hi Serge, no sorry. Actually this one I totally forgot. Hm, I don't think libvirt upstream would want to make changes to the URI concept. And since on an initial install Xen HV is not running, we cannot set any static default. Which would be wrong anyway as it is possible to switch between Xen and non-Xen or KVM mode on boot.

Hm, what would you think about adding the following file for /etc/profile.d to our package? Probably it would also work when I would not set any environment in the no-Xen case.

Revision history for this message
GeorgeDunlap (dunlapg) wrote :

As the original report says, this doesn't seem to be an upstream issue. As I reported there, Fedora with libvirt 1.2.5 didn't have this problem; and on the Xen4CentOS packages, neither libvirt 0.10 nor libvirt 1.2.10 had this problem. In all cases, if you booted under Xen, virsh would find Xen without any extra hand-holding. In the case of Xen4Centos libvirt 1.2.10 packages, I can see that there are no patches changing any defaults.

It seems likely that somewhere Ubuntu has actually added something which is changing the default URI to KVM.

Revision history for this message
Stefan Bader (smb) wrote :

Hi George, hm, could it be that for the cases where that works libvirt had been installed after booting into Xen dom0? I had a quick look at the code we have in Trusty right now and the library code handling the URI basically checks LIBVIRT_DEFAULT_URI environment variable, or uri_default config variable, or falls back to qemu (in that order) [src/libvirt.c:virConnectGetDefaultURI]. This is the same as in the upstream git repo (pulled just now).
For virsh it seems looking only for the environment variable for a default or otherwise call the library with NULL which then again does the resoving as described above.

For UBUNTU (Trusty at least) the uri_default in the config file is commented out (so without anything in the environment defaulting to qemu sounds expected). Do you have something set (either in the environment or in the config file) for other distros?

Revision history for this message
Stefan Bader (smb) wrote :

And just in case you wonder why I typed Ubuntu in all capital letters... old farts brain being used to type that as a tag in git commit messages...

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

/etc/profile.d approach looks good to me.

Changed in libvirt (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.12-0ubuntu12

---------------
libvirt (1.2.12-0ubuntu12) vivid; urgency=low

  * Add profile script to automatically set the default URI based on
    the currently running hyperisor (Xen or KVM/Qemu).
    (LP: #1334749)
 -- Stefan Bader <email address hidden> Tue, 14 Apr 2015 09:02:52 -0500

Changed in libvirt (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.