[libvirt] [PATCH 02/17] qemu: Validate type != xen at parse time

Cole Robinson crobinso at redhat.com
Fri Jan 22 19:30:17 UTC 2016


There's a validation check at VM startup time that rejects type=xen
or os type=xen|linux.

The latter bit is already validated in generic domain_conf.c code,
so it can be dropped. The former bit is can be done at XML parse time,
so move it there.
---
 src/qemu/qemu_command.c | 8 --------
 src/qemu/qemu_domain.c  | 7 +++++++
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5d3ab3a..75fb352 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9557,14 +9557,6 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     virCommandAddArgList(cmd, "-uuid", uuid, NULL);
-    if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
-        def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
-        def->os.type == VIR_DOMAIN_OSTYPE_LINUX) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("qemu emulator '%s' does not support xen"),
-                       def->emulator);
-        goto error;
-    }
 
     if ((def->os.smbios_mode != VIR_DOMAIN_SMBIOS_NONE) &&
         (def->os.smbios_mode != VIR_DOMAIN_SMBIOS_EMULATE)) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9b456e8..a1dd604 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1251,6 +1251,13 @@ qemuDomainDefPostParse(virDomainDefPtr def,
         goto cleanup;
     }
 
+    if (def->virtType == VIR_DOMAIN_VIRT_XEN) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("qemu emulator '%s' does not support xen"),
+                       def->emulator);
+        goto cleanup;
+    }
+
     /* check for emulator and create a default one if needed */
     if (!def->emulator &&
         !(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
-- 
2.5.0




More information about the libvir-list mailing list