Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-22 Thread Daniel P. Berrange
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 j...@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 j...@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 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-22 Thread Daniel Veillard
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.
 
 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.

  Okidoc, apllied and commited,

thanks !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Jun Koi
Hi,

I have a VM running under libvirt, and it is currently run with
-no-kvm option (I saw that in ps output).
Now I want to run this VM with KVM. How can I reconfigure it for that?

I looked into its configuration file under /etc/libvirt/qemu, but
didnt see any option to turn KVM on.

Thanks,
J

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Daniel P. Berrange
On Tue, Jul 21, 2009 at 05:47:15PM +0900, Jun Koi wrote:
 Hi,
 
 I have a VM running under libvirt, and it is currently run with
 -no-kvm option (I saw that in ps output).
 Now I want to run this VM with KVM. How can I reconfigure it for that?
 
 I looked into its configuration file under /etc/libvirt/qemu, but
 didnt see any option to turn KVM on.

Run 'virsh edit GUEST'  and on the top domain element, change the
type attribute to be 'kvm' instead of 'qemu'. ALso in the 
emulator element change the path to point to /usr/bin/qemu-kvm


NB, make sure you have the kvm modules loaded of course, otherwise it'll
still fallback to emulation

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 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Jun Koi
On Tue, Jul 21, 2009 at 7:14 PM, Daniel P. Berrangeberra...@redhat.com wrote:
 On Tue, Jul 21, 2009 at 05:47:15PM +0900, Jun Koi wrote:
 Hi,

 I have a VM running under libvirt, and it is currently run with
 -no-kvm option (I saw that in ps output).
 Now I want to run this VM with KVM. How can I reconfigure it for that?

 I looked into its configuration file under /etc/libvirt/qemu, but
 didnt see any option to turn KVM on.

 Run 'virsh edit GUEST'  and on the top domain element, change the
 type attribute to be 'kvm' instead of 'qemu'. ALso in the
 emulator element change the path to point to /usr/bin/qemu-kvm


exellent, thanks!

J

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Jim Paris
Daniel P. Berrange wrote:
 On Tue, Jul 21, 2009 at 05:47:15PM +0900, Jun Koi wrote:
  Hi,
  
  I have a VM running under libvirt, and it is currently run with
  -no-kvm option (I saw that in ps output).
  Now I want to run this VM with KVM. How can I reconfigure it for that?
  
  I looked into its configuration file under /etc/libvirt/qemu, but
  didnt see any option to turn KVM on.
 
 Run 'virsh edit GUEST'  and on the top domain element, change the
 type attribute to be 'kvm' instead of 'qemu'.

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?
It seems that this comment in qemu_conf.c:

/* 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
 */

might need to expand #1 to consider i686 == x86_64?

-jim

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Daniel P. Berrange
On Tue, Jul 21, 2009 at 09:46:17AM -0400, Jim Paris wrote:
 Daniel P. Berrange wrote:
  On Tue, Jul 21, 2009 at 05:47:15PM +0900, Jun Koi wrote:
   Hi,
   
   I have a VM running under libvirt, and it is currently run with
   -no-kvm option (I saw that in ps output).
   Now I want to run this VM with KVM. How can I reconfigure it for that?
   
   I looked into its configuration file under /etc/libvirt/qemu, but
   didnt see any option to turn KVM on.
  
  Run 'virsh edit GUEST'  and on the top domain element, change the
  type attribute to be 'kvm' instead of 'qemu'.
 
 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 !

 It seems that this comment in qemu_conf.c:
 
 /* 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
  */
 
 might need to expand #1 to consider i686 == x86_64?

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.

Regards,
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 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to config my VM to use KVM with libvirt?

2009-07-21 Thread Jim Paris
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.

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.

-jim

From f7edd4c887512e4fc7c97b12a4f2409244af9eb3 Mon Sep 17 00:00:00 2001
From: Jim Paris j...@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 j...@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;
 
-- 
1.6.1.3


--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list