[libvirt] [PATCH 1/2] Add a new <nesting/> option in the domain config features list.

--- docs/formatdomain.html.in | 4 ++++ docs/schemas/domain.rng | 5 +++++ src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + 4 files changed, 12 insertions(+), 1 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 72bd7b9..c4eed79 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -263,6 +263,7 @@ <pae/> <acpi/> <apic/> + <nesting/> </features> ...</pre> @@ -282,6 +283,9 @@ <dd>ACPI is useful for power management, for example, with KVM guests it is required for graceful shutdown to work. </dd> + <dt><code>nesting</code></dt> + <dd>Some hypervisors support nested hardware-supported + virtualization, allowing you to run VMs inside of VMs.</dd> </dl> <h3><a name="elementsTime">Time keeping</a></h3> diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index b75f17e..78a4504 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1213,6 +1213,11 @@ <empty/> </element> </optional> + <optional> + <element name="nesting"> + <empty/> + </element> + </optional> </interleave> </element> </optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 918a5d7..653cba0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -70,7 +70,8 @@ VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST, VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "acpi", "apic", - "pae") + "pae", + "nesting") VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST, "destroy", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fadf43f..7306b0b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -517,6 +517,7 @@ enum virDomainFeature { VIR_DOMAIN_FEATURE_ACPI, VIR_DOMAIN_FEATURE_APIC, VIR_DOMAIN_FEATURE_PAE, + VIR_DOMAIN_FEATURE_NESTING, VIR_DOMAIN_FEATURE_LAST }; -- 1.6.2.1

--- src/qemu/qemu_conf.c | 7 +++++++ src/qemu/qemu_conf.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e1e24c3..452cbe0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -897,6 +897,8 @@ static unsigned int qemudComputeCmdFlags(const char *help, flags |= QEMUD_CMD_FLAG_MEM_PATH; if (strstr(help, "-chardev")) flags |= QEMUD_CMD_FLAG_CHARDEV; + if (strstr(help, "-enable-nesting")) + flags |= QEMUD_CMD_FLAG_NESTING; if (version >= 9000) flags |= QEMUD_CMD_FLAG_VNC_COLON; @@ -1837,6 +1839,9 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + if ((qemuCmdFlags & QEMUD_CMD_FLAG_NESTING) && + (def->features & (1 << VIR_DOMAIN_FEATURE_NESTING))) + ADD_ARG_LIT("-enable-nesting"); /* * NB, -nographic *MUST* come before any serial, or monitor @@ -3474,6 +3479,8 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn, fullscreen = 1; } else if (STREQ(arg, "-localtime")) { def->localtime = 1; + } else if (STREQ(arg, "-enable-nesting")) { + def->features |= (1 << VIR_DOMAIN_FEATURE_NESTING); } else if (STREQ(arg, "-kernel")) { WANT_VALUE(); if (!(def->os.kernel = strdup(val))) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 5d433d3..1b2c1c7 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -73,6 +73,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_XEN_DOMID = (1 << 20), /* -xen-domid (new style xen integration) */ QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX = (1 << 21), /* Does qemu support unix domain sockets for migration? */ QEMUD_CMD_FLAG_CHARDEV = (1 << 22), /* Is the new -chardev arg available */ + QEMUD_CMD_FLAG_NESTING = (1 << 23), /* Is the -enable-nesting flag available */ }; /* Main driver state */ -- 1.6.2.1

On Sun, Nov 08, 2009 at 01:44:02PM -0500, Evan Broder wrote:
--- docs/formatdomain.html.in | 4 ++++ docs/schemas/domain.rng | 5 +++++ src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + 4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 72bd7b9..c4eed79 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -263,6 +263,7 @@ <pae/> <acpi/> <apic/> + <nesting/> </features> ...</pre>
@@ -282,6 +283,9 @@ <dd>ACPI is useful for power management, for example, with KVM guests it is required for graceful shutdown to work. </dd> + <dt><code>nesting</code></dt> + <dd>Some hypervisors support nested hardware-supported + virtualization, allowing you to run VMs inside of VMs.</dd> </dl>
I agree that it would be useful to allow libvirt to turn on SVM/VMX inside VMs, but I think we need to represent it in a different way. I think KVM's use of the word 'nesting' is pretty awful terminology. Instead I think we want to handle this in Jirka's CPU flags work. SVM and VMX are merely CPU flags after all, so there's no compelling reason not to represent them as such, even if underlying QEMU doesn't work that way. So I imagine we'd just add 2 flags called 'vmx' and 'svm' once Jirka's work is done, and then behind the scenes map them into the '--enable-nesting' arg 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 :|
participants (2)
-
Daniel P. Berrange
-
Evan Broder