[libvirt] How to config my VM to use KVM with libvirt?
Daniel P. Berrange
berrange at redhat.com
Wed Jul 22 16:07:22 UTC 2009
On Tue, Jul 21, 2009 at 05:28:27PM -0400, Jim Paris wrote:
> Daniel P. Berrange wrote:
> > On Tue, Jul 21, 2009 at 09:46:17AM -0400, Jim Paris wrote:
> > > Speaking of this, I've noticed that
> > >
> > > <domain type='qemu'>
> > > <os>
> > > <type arch='i686' machine='pc'>hvm</type>
> > > </os>
> > > </domain>
> > >
> > > runs WITH kvm on an x86_64 system. Is that intended?
> >
> > No, its not intended !
> ...
> > I'm actually wondering why we bother with #1 at all. If the
> > binary has '-no-kvm' and the domain is 'qemu', then it should
> > be used no matter what arch.
>
> Agreed. Below is a patch which should fix the oversight (lightly
> tested).
>
> However, this is going to be a user-visible change and may cause
> people to complain that their existing 32-bit domains are unexpectedly
> running with -no-kvm. Is that OK? Technically it's a misconfiguration.
Counterpoint: people complaining that they requested 'qemu' and
got 'kvm' which they didn't want :-) As you say anyone relying on
this using KVM has mis-configured their VM.
> For the record, I think we've already broken this area once when
> 0.6.2 came out -- previous to that, even my 64-bit VMs had domain type
> "qemu", and libvirt ran my specified kvm binary without -no-kvm.
Yep, one or two people got tripped up by this, but its trivial
for them to fix it & we didn't get any large number of bug
reports.
> >From f7edd4c887512e4fc7c97b12a4f2409244af9eb3 Mon Sep 17 00:00:00 2001
> From: Jim Paris <jim at jtan.com>
> Date: Tue, 21 Jul 2009 17:07:51 -0400
> Subject: [PATCH] Always add -no-kvm and -no-kqemu, if available, for "qemu" domains.
>
> If the qemu binary supports "-no-kvm" and/or "-no-kqemu", they should
> always be added for plain "qemu" domains. Previously, we omitted them
> whenever the host and guest architectures implied that they would be
> disabled automatically, but that logic was flawed in some cases
> (such as i686 and x86_64).
>
> Signed-off-by: Jim Paris <jim at jtan.com>
> ---
> src/qemu_conf.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
> index 4043d70..f146598 100644
> --- a/src/qemu_conf.c
> +++ b/src/qemu_conf.c
> @@ -977,22 +977,18 @@ int qemudBuildCommandLine(virConnectPtr conn,
> emulator = def->emulator;
>
> /* Need to explicitly disable KQEMU if
> - * 1. Arch matches host arch
> - * 2. Guest domain is 'qemu'
> - * 3. The qemu binary has the -no-kqemu flag
> + * 1. Guest domain is 'qemu'
> + * 2. The qemu binary has the -no-kqemu flag
> */
> if ((qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) &&
> - STREQ(ut.machine, def->os.arch) &&
> def->virtType == VIR_DOMAIN_VIRT_QEMU)
> disableKQEMU = 1;
>
> /* Need to explicitly disable KVM if
> - * 1. Arch matches host arch
> - * 2. Guest domain is 'qemu'
> - * 3. The qemu binary has the -no-kvm flag
> + * 1. Guest domain is 'qemu'
> + * 2. The qemu binary has the -no-kvm flag
> */
> if ((qemuCmdFlags & QEMUD_CMD_FLAG_KVM) &&
> - STREQ(ut.machine, def->os.arch) &&
> def->virtType == VIR_DOMAIN_VIRT_QEMU)
> disableKVM = 1;
>
ACK, this looks fine.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list