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

Message ID 382a9b141829f6ed3f854bc575227590762d3e88.1453489951.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 22, 2016, 7:30 p.m.
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(-)

-- 
2.5.0

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

Patch

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