[libvirt] (how much) support for kqemu domain

I am wondering about the extent to which "old" qemu-0.11.1 and kqemu-1.4.0 are supported by virt-manager. I see I can specify --virt-type=kqemu on virt-install and it remembers domain type='kqemu', and does things such as refusing to start the vm if the kqemu kernel mod not loaded, but it seems it does not tack on the -enable-kqemu -kernel-kqemu options on to the qemu command line. There is really not much point in trying to start a qemu-based vm with neither hardware kvm nor kqemu ... I can work around it with an override script to intercept the qemu command, but does anyone think virt-manager ought to do this for me? John Lumby _________________________________________________________________

On Wed, Jul 14, 2010 at 11:11:48AM -0400, John Lumby wrote:
I am wondering about the extent to which "old" qemu-0.11.1 and kqemu-1.4.0 are supported by virt-manager.
I see I can specify --virt-type=kqemu on virt-install and it remembers domain type='kqemu', and does things such as refusing to start the vm if the kqemu kernel mod not loaded, but it seems it does not tack on the -enable-kqemu -kernel-kqemu options on to the qemu command line. There is really not much point in trying to start a qemu-based vm with neither hardware kvm nor kqemu ...
It looks for presence of /dev/kqemu and a -no-kqemu arg in QEMU's help. I had no idea that arg had been changed to be -enable-kqemu. Patches welcome to support that new arg. See qemudBuildCommandLine() & qemudComputeCmdFlags() methods in src/qemu/qemu_conf.c Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Date: Wed, 14 Jul 2010 16:21:47 +0100 From: berrange@redhat.com To: johnlumby@hotmail.com CC:
Subject: Re: [libvirt] (how much) support for kqemu domain
On Wed, Jul 14, 2010 at 11:11:48AM -0400, John Lumby wrote:
I am wondering about
libvir-list@redhat.com the extent to which "old" qemu-0.11.1
and kqemu-1.4.0 are supported by virt-manager.
It looks for presence of /dev/kqemu and a -no-kqemu arg in
QEMU's help. I had no idea that arg had been changed to
be -enable-kqemu. Patches welcome to support that new arg. See qemudBuildCommandLine() & qemudComputeCmdFlags() methods in src/qemu/qemu_conf.c
Daniel
Thanks Daniel for the pointer to the source code . Interesting "interface". Here's my patch - works for me but tested only on my own qemu-1.11.1 --- src/qemu/qemu_conf.h.orig 2010-04-23 11:52:47.000000000 -0400 +++ src/qemu/qemu_conf.h 2010-07-15 15:27:44.000000000 -0400 @@ -88,6 +88,13 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NO_HPET = (1LL << 33), /* -no-hpet flag is supported */ QEMUD_CMD_FLAG_NO_KVM_PIT = (1LL << 34), /* -no-kvm-pit-reinjection supported */ QEMUD_CMD_FLAG_TDF = (1LL << 35), /* -tdf flag (user-mode pit catchup) */ + + /* features added in qemu-0.11.x jel */ + QEMUD_CMD_FLAG_KQEMU_EXPLICIT = (1LL << 36) /* KQEMU is available but must be explicitly requested + ** using options -enable-kqemu -kernel-kqemu + ** note we either specify both or neither + ** since qemu domain is always system mode (I think?) jel + */ }; /* Main driver state */ --- src/qemu/qemu_conf.c.orig 2010-04-30 08:46:09.000000000 -0400 +++ src/qemu/qemu_conf.c 2010-07-15 21:15:12.000000000 -0400 @@ -1130,6 +1130,14 @@ static unsigned long long qemudComputeCm if (strstr(help, "-no-kqemu")) flags |= QEMUD_CMD_FLAG_KQEMU; + /* here we check for qemu version of *exactly* 0.11.x, + ** which requires different options to select kqemu jel */ + if ( ( version >= 11000 ) && ( version <= 11999 ) + && ( ( strstr(help, "-enable-kqemu") ) + || ( strstr(help, "-kernel-kqemu") ) + ) + ) + flags |= ( QEMUD_CMD_FLAG_KQEMU | QEMUD_CMD_FLAG_KQEMU_EXPLICIT ); if (strstr(help, "-no-kvm")) flags |= QEMUD_CMD_FLAG_KVM; if (strstr(help, "-enable-kvm")) @@ -3431,7 +3439,10 @@ int qemudBuildCommandLine(virConnectPtr char memory[50]; char boot[VIR_DOMAIN_BOOT_LAST]; struct utsname ut; - int disableKQEMU = 0; + int disableKQEMU = 0; /* 0 means don't enable or disable + ** +1 means do explicitly disable + ** -1 means do explicitly enable (double-negative) + */ int disableKVM = 0; int enableKVM = 0; int qargc = 0, qarga = 0; @@ -3484,10 +3495,24 @@ int qemudBuildCommandLine(virConnectPtr /* Need to explicitly disable KQEMU if * 1. Guest domain is 'qemu' * 2. The qemu binary has the -no-kqemu flag + * + * and need to explicitly enable KQEMU if + * 1. Guest domain is 'kqemu' + * 2. The qemu binary has the -enable-kqemu flag */ - if ((qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) && - def->virtType == VIR_DOMAIN_VIRT_QEMU) - disableKQEMU = 1; + + if (qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) { + /* we need to decide whether to explictly enable, + ** explicitly disable, or neither (default) */ + if (def->virtType == VIR_DOMAIN_VIRT_QEMU) { + disableKQEMU = 1; + } else + if ( ( def->virtType == VIR_DOMAIN_VIRT_KQEMU ) + && ( qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU_EXPLICIT ) + ) { + disableKQEMU = -1; /* explicitly enable */ + } + } /* Need to explicitly disable KVM if * 1. Guest domain is 'qemu' @@ -3617,8 +3642,12 @@ int qemudBuildCommandLine(virConnectPtr VIR_FREE(cpu); } - if (disableKQEMU) + if (disableKQEMU == 1) ADD_ARG_LIT("-no-kqemu"); + else if (disableKQEMU == -1) { + ADD_ARG_LIT("-enable-kqemu"); + ADD_ARG_LIT("-kernel-kqemu"); + } if (disableKVM) ADD_ARG_LIT("-no-kvm"); if (enableKVM) John Lumby _________________________________________________________________ Game on: Challenge friends to great games on Messenger http://go.microsoft.com/?linkid=9734387

Date: Wed, 14 Jul 2010 16:21:47 +0100 From: berrange@redhat.com To: johnlumby@hotmail.com CC:
Subject: Re: [libvirt] (how much) support for kqemu domain
On Wed, Jul 14, 2010 at 11:11:48AM -0400, John Lumby wrote:
I am wondering about
libvir-list@redhat.com the extent to which "old" qemu-0.11.1
and kqemu-1.4.0 are supported by virt-manager.
It looks for presence of /dev/kqemu and a -no-kqemu arg in
QEMU's help. I had no idea that arg had been changed to
be -enable-kqemu. Patches welcome to support that new arg. See qemudBuildCommandLine() & qemudComputeCmdFlags() methods in src/qemu/qemu_conf.c
Daniel
Thanks Daniel for the pointer to the source code . Interesting "interface". Here's my patch - works for me but tested only on my own qemu-1.11.1 --- src/qemu/qemu_conf.h.orig 2010-04-23 11:52:47.000000000 -0400 +++ src/qemu/qemu_conf.h 2010-07-15 15:27:44.000000000 -0400 @@ -88,6 +88,13 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NO_HPET = (1LL << 33), /* -no-hpet flag is supported */ QEMUD_CMD_FLAG_NO_KVM_PIT = (1LL << 34), /* -no-kvm-pit-reinjection supported */ QEMUD_CMD_FLAG_TDF = (1LL << 35), /* -tdf flag (user-mode pit catchup) */ + + /* features added in qemu-0.11.x jel */ + QEMUD_CMD_FLAG_KQEMU_EXPLICIT = (1LL << 36) /* KQEMU is available but must be explicitly requested + ** using options -enable-kqemu -kernel-kqemu + ** note we either specify both or neither + ** since qemu domain is always system mode (I think?) jel + */ }; /* Main driver state */ --- src/qemu/qemu_conf.c.orig 2010-04-30 08:46:09.000000000 -0400 +++ src/qemu/qemu_conf.c 2010-07-15 21:15:12.000000000 -0400 @@ -1130,6 +1130,14 @@ static unsigned long long qemudComputeCm if (strstr(help, "-no-kqemu")) flags |= QEMUD_CMD_FLAG_KQEMU; + /* here we check for qemu version of *exactly* 0.11.x, + ** which requires different options to select kqemu jel */ + if ( ( version >= 11000 ) && ( version <= 11999 ) + && ( ( strstr(help, "-enable-kqemu") ) + || ( strstr(help, "-kernel-kqemu") ) + ) + ) + flags |= ( QEMUD_CMD_FLAG_KQEMU | QEMUD_CMD_FLAG_KQEMU_EXPLICIT ); if (strstr(help, "-no-kvm")) flags |= QEMUD_CMD_FLAG_KVM; if (strstr(help, "-enable-kvm")) @@ -3431,7 +3439,10 @@ int qemudBuildCommandLine(virConnectPtr char memory[50]; char boot[VIR_DOMAIN_BOOT_LAST]; struct utsname ut; - int disableKQEMU = 0; + int disableKQEMU = 0; /* 0 means don't enable or disable + ** +1 means do explicitly disable + ** -1 means do explicitly enable (double-negative) + */ int disableKVM = 0; int enableKVM = 0; int qargc = 0, qarga = 0; @@ -3484,10 +3495,24 @@ int qemudBuildCommandLine(virConnectPtr /* Need to explicitly disable KQEMU if * 1. Guest domain is 'qemu' * 2. The qemu binary has the -no-kqemu flag + * + * and need to explicitly enable KQEMU if + * 1. Guest domain is 'kqemu' + * 2. The qemu binary has the -enable-kqemu flag */ - if ((qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) && - def->virtType == VIR_DOMAIN_VIRT_QEMU) - disableKQEMU = 1; + + if (qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) { + /* we need to decide whether to explictly enable, + ** explicitly disable, or neither (default) */ + if (def->virtType == VIR_DOMAIN_VIRT_QEMU) { + disableKQEMU = 1; + } else + if ( ( def->virtType == VIR_DOMAIN_VIRT_KQEMU ) + && ( qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU_EXPLICIT ) + ) { + disableKQEMU = -1; /* explicitly enable */ + } + } /* Need to explicitly disable KVM if * 1. Guest domain is 'qemu' @@ -3617,8 +3642,12 @@ int qemudBuildCommandLine(virConnectPtr VIR_FREE(cpu); } - if (disableKQEMU) + if (disableKQEMU == 1) ADD_ARG_LIT("-no-kqemu"); + else if (disableKQEMU == -1) { + ADD_ARG_LIT("-enable-kqemu"); + ADD_ARG_LIT("-kernel-kqemu"); + } if (disableKVM) ADD_ARG_LIT("-no-kvm"); if (enableKVM) John Lumby _________________________________________________________________ Game on: Challenge friends to great games on Messenger http://go.microsoft.com/?linkid=9734387

[digging through old mail] On 07/17/2010 10:58 AM, John Lumby wrote:
I am wondering about the extent to which "old" qemu-0.11.1 and kqemu-1.4.0 are supported by virt-manager.
It looks for presence of /dev/kqemu and a -no-kqemu arg in
QEMU's help. I had no idea that arg had been changed to
be -enable-kqemu. Patches welcome to support that new arg. See qemudBuildCommandLine() & qemudComputeCmdFlags() methods in src/qemu/qemu_conf.c
Daniel
Thanks Daniel for the pointer to the source code . Interesting "interface".
Here's my patch - works for me but tested only on my own qemu-1.11.1
I never saw a reply to this. Is this a patch that should be revived and rebased onto the latest git?
--- src/qemu/qemu_conf.h.orig 2010-04-23 11:52:47.000000000 -0400 +++ src/qemu/qemu_conf.h 2010-07-15 15:27:44.000000000 -0400 @@ -88,6 +88,13 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NO_HPET = (1LL << 33), /* -no-hpet flag is supported */ QEMUD_CMD_FLAG_NO_KVM_PIT = (1LL << 34), /* -no-kvm-pit-reinjection supported */ QEMUD_CMD_FLAG_TDF = (1LL << 35), /* -tdf flag (user-mode pit catchup) */ + + /* features added in qemu-0.11.x jel */ + QEMUD_CMD_FLAG_KQEMU_EXPLICIT = (1LL << 36) /* KQEMU is available but must be explicitly requested + ** using options -enable-kqemu -kernel-kqemu + ** note we either specify both or neither + ** since qemu domain is always system mode (I think?) jel + */ };
/* Main driver state */ --- src/qemu/qemu_conf.c.orig 2010-04-30 08:46:09.000000000 -0400 +++ src/qemu/qemu_conf.c 2010-07-15 21:15:12.000000000 -0400 @@ -1130,6 +1130,14 @@ static unsigned long long qemudComputeCm
if (strstr(help, "-no-kqemu")) flags |= QEMUD_CMD_FLAG_KQEMU; + /* here we check for qemu version of *exactly* 0.11.x, + ** which requires different options to select kqemu jel */ + if ( ( version >= 11000 ) && ( version <= 11999 ) + && ( ( strstr(help, "-enable-kqemu") ) + || ( strstr(help, "-kernel-kqemu") ) + ) + ) + flags |= ( QEMUD_CMD_FLAG_KQEMU | QEMUD_CMD_FLAG_KQEMU_EXPLICIT ); if (strstr(help, "-no-kvm")) flags |= QEMUD_CMD_FLAG_KVM; if (strstr(help, "-enable-kvm")) @@ -3431,7 +3439,10 @@ int qemudBuildCommandLine(virConnectPtr char memory[50]; char boot[VIR_DOMAIN_BOOT_LAST]; struct utsname ut; - int disableKQEMU = 0; + int disableKQEMU = 0; /* 0 means don't enable or disable + ** +1 means do explicitly disable + ** -1 means do explicitly enable (double-negative) + */ int disableKVM = 0; int enableKVM = 0; int qargc = 0, qarga = 0; @@ -3484,10 +3495,24 @@ int qemudBuildCommandLine(virConnectPtr /* Need to explicitly disable KQEMU if * 1. Guest domain is 'qemu' * 2. The qemu binary has the -no-kqemu flag + * + * and need to explicitly enable KQEMU if + * 1. Guest domain is 'kqemu' + * 2. The qemu binary has the -enable-kqemu flag */ - if ((qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) && - def->virtType == VIR_DOMAIN_VIRT_QEMU) - disableKQEMU = 1; + + if (qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) { + /* we need to decide whether to explictly enable, + ** explicitly disable, or neither (default) */ + if (def->virtType == VIR_DOMAIN_VIRT_QEMU) { + disableKQEMU = 1; + } else + if ( ( def->virtType == VIR_DOMAIN_VIRT_KQEMU ) + && ( qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU_EXPLICIT ) + ) { + disableKQEMU = -1; /* explicitly enable */ + } + }
/* Need to explicitly disable KVM if * 1. Guest domain is 'qemu' @@ -3617,8 +3642,12 @@ int qemudBuildCommandLine(virConnectPtr VIR_FREE(cpu); }
- if (disableKQEMU) + if (disableKQEMU == 1) ADD_ARG_LIT("-no-kqemu"); + else if (disableKQEMU == -1) { + ADD_ARG_LIT("-enable-kqemu"); + ADD_ARG_LIT("-kernel-kqemu"); + } if (disableKVM) ADD_ARG_LIT("-no-kvm"); if (enableKVM)
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Hello Eric. I am fairly sure I remember *someone* saying they had integrated a modified version of the fix into libvirt but can't find any email saying so now. Maybe Daniel? On a very quick look at 0.9.2 source, it *appears* to have been implemented in qemu_command.c (but I didn't verify running it). Cheers, John Lumby On 06/06/11 13:49, Eric Blake wrote:
[digging through old mail]
On 07/17/2010 10:58 AM, John Lumby wrote:
I am wondering about the extent to which "old" qemu-0.11.1 and kqemu-1.4.0 are supported by virt-manager.
It looks for presence of /dev/kqemu and a -no-kqemu arg in
QEMU's help. I had no idea that arg had been changed to
be -enable-kqemu. Patches welcome to support that new arg. See qemudBuildCommandLine()& qemudComputeCmdFlags() methods in src/qemu/qemu_conf.c Daniel
Thanks Daniel for the pointer to the source code . Interesting "interface".
Here's my patch - works for me but tested only on my own qemu-1.11.1 I never saw a reply to this. Is this a patch that should be revived and rebased onto the latest git?
--- src/qemu/qemu_conf.h.orig 2010-04-23 11:52:47.000000000 -0400 +++ src/qemu/qemu_conf.h 2010-07-15 15:27:44.000000000 -0400 @@ -88,6 +88,13 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NO_HPET = (1LL<< 33), /* -no-hpet flag is supported */ QEMUD_CMD_FLAG_NO_KVM_PIT = (1LL<< 34), /* -no-kvm-pit-reinjection supported */ QEMUD_CMD_FLAG_TDF = (1LL<< 35), /* -tdf flag (user-mode pit catchup) */ + + /* features added in qemu-0.11.x jel */ + QEMUD_CMD_FLAG_KQEMU_EXPLICIT = (1LL<< 36) /* KQEMU is available but must be explicitly requested + ** using options -enable-kqemu -kernel-kqemu + ** note we either specify both or neither + ** since qemu domain is always system mode (I think?) jel + */ };
/* Main driver state */ --- src/qemu/qemu_conf.c.orig 2010-04-30 08:46:09.000000000 -0400 +++ src/qemu/qemu_conf.c 2010-07-15 21:15:12.000000000 -0400 @@ -1130,6 +1130,14 @@ static unsigned long long qemudComputeCm
if (strstr(help, "-no-kqemu")) flags |= QEMUD_CMD_FLAG_KQEMU; + /* here we check for qemu version of *exactly* 0.11.x, + ** which requires different options to select kqemu jel */ + if ( ( version>= 11000 )&& ( version<= 11999 ) +&& ( ( strstr(help, "-enable-kqemu") ) + || ( strstr(help, "-kernel-kqemu") ) + ) + ) + flags |= ( QEMUD_CMD_FLAG_KQEMU | QEMUD_CMD_FLAG_KQEMU_EXPLICIT ); if (strstr(help, "-no-kvm")) flags |= QEMUD_CMD_FLAG_KVM; if (strstr(help, "-enable-kvm")) @@ -3431,7 +3439,10 @@ int qemudBuildCommandLine(virConnectPtr char memory[50]; char boot[VIR_DOMAIN_BOOT_LAST]; struct utsname ut; - int disableKQEMU = 0; + int disableKQEMU = 0; /* 0 means don't enable or disable + ** +1 means do explicitly disable + ** -1 means do explicitly enable (double-negative) + */ int disableKVM = 0; int enableKVM = 0; int qargc = 0, qarga = 0; @@ -3484,10 +3495,24 @@ int qemudBuildCommandLine(virConnectPtr /* Need to explicitly disable KQEMU if * 1. Guest domain is 'qemu' * 2. The qemu binary has the -no-kqemu flag + * + * and need to explicitly enable KQEMU if + * 1. Guest domain is 'kqemu' + * 2. The qemu binary has the -enable-kqemu flag */ - if ((qemuCmdFlags& QEMUD_CMD_FLAG_KQEMU)&& - def->virtType == VIR_DOMAIN_VIRT_QEMU) - disableKQEMU = 1; + + if (qemuCmdFlags& QEMUD_CMD_FLAG_KQEMU) { + /* we need to decide whether to explictly enable, + ** explicitly disable, or neither (default) */ + if (def->virtType == VIR_DOMAIN_VIRT_QEMU) { + disableKQEMU = 1; + } else + if ( ( def->virtType == VIR_DOMAIN_VIRT_KQEMU ) +&& ( qemuCmdFlags& QEMUD_CMD_FLAG_KQEMU_EXPLICIT ) + ) { + disableKQEMU = -1; /* explicitly enable */ + } + }
/* Need to explicitly disable KVM if * 1. Guest domain is 'qemu' @@ -3617,8 +3642,12 @@ int qemudBuildCommandLine(virConnectPtr VIR_FREE(cpu); }
- if (disableKQEMU) + if (disableKQEMU == 1) ADD_ARG_LIT("-no-kqemu"); + else if (disableKQEMU == -1) { + ADD_ARG_LIT("-enable-kqemu"); + ADD_ARG_LIT("-kernel-kqemu"); + } if (disableKVM) ADD_ARG_LIT("-no-kvm"); if (enableKVM)

On 06/06/2011 02:19 PM, John Lumby wrote:
Hello Eric.
I am fairly sure I remember *someone* saying they had integrated a modified version of the fix into libvirt but can't find any email saying so now. Maybe Daniel? On a very quick look at 0.9.2 source, it *appears* to have been implemented in qemu_command.c (but I didn't verify running it).
Thanks for your reply; I see it in the current sources as well. Looks like commit 6e44ec7a was the winner. Oh well, a bit more digging and I could have spared wasting time on email. :)
+ else if (disableKQEMU == -1) { + ADD_ARG_LIT("-enable-kqemu"); + ADD_ARG_LIT("-kernel-kqemu");
The code uses a new variable enableKQEMU, as a nicer spelling than overloading disableKQEMU into a tri-state with double-negative interpretation. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
John Lumby