]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Extract panic device def post parse code
authorPeter Krempa <pkrempa@redhat.com>
Thu, 24 May 2018 15:01:55 +0000 (17:01 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 May 2018 16:25:30 +0000 (18:25 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c

index e9a8b0c33295f4cf1606dee72e3b26ad60e4f0c3..a6b879aa7691d446eb45d561e570c276474b7fc3 100644 (file)
@@ -5765,6 +5765,23 @@ qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video,
 }
 
 
+static int
+qemuDomainDevicePanicDefPostParse(virDomainPanicDefPtr panic,
+                                  const virDomainDef *def)
+{
+    if (panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) {
+        if (qemuDomainIsPSeries(def))
+            panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
+        else if (ARCH_IS_S390(def->os.arch))
+            panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
+        else
+            panic->model = VIR_DOMAIN_PANIC_MODEL_ISA;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                              const virDomainDef *def,
@@ -5794,14 +5811,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         goto cleanup;
 
     if (dev->type == VIR_DOMAIN_DEVICE_PANIC &&
-        dev->data.panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) {
-        if (qemuDomainIsPSeries(def))
-            dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
-        else if (ARCH_IS_S390(def->os.arch))
-            dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
-        else
-            dev->data.panic->model = VIR_DOMAIN_PANIC_MODEL_ISA;
-    }
+        qemuDomainDevicePanicDefPostParse(dev->data.panic, def) < 0)
+        goto cleanup;
 
     if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
         qemuDomainControllerDefPostParse(dev->data.controller, def,