[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] (how much) support for kqemu domain



> Date: Wed, 14 Jul 2010 16:21:47 +0100
> From: berrange redhat com
> To: johnlumby hotmail com
> CC: libvir-list redhat com
> 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 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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]