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

[libvirt] [PATCH v2 10/10] qemu: Move check that validates 'min_guarantee' to qemuDomainDefValidate



Introduce a validation callback for qemu and move checking of
min_guarantee to the new callback.
---
 src/qemu/qemu_domain.c  | 17 +++++++++++++++++
 src/qemu/qemu_process.c |  7 -------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index fd6d6d2..7e64545 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2168,6 +2168,22 @@ qemuDomainDefPostParse(virDomainDefPtr def,
     return ret;
 }

+
+static int
+qemuDomainDefValidate(const virDomainDef *def,
+                      virCapsPtr caps ATTRIBUTE_UNUSED,
+                      void *opaque ATTRIBUTE_UNUSED)
+{
+    if (def->mem.min_guarantee) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Parameter 'min_guarantee' not supported by QEMU."));
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static const char *
 qemuDomainDefaultNetModel(const virDomainDef *def,
                           virQEMUCapsPtr qemuCaps)
@@ -2419,6 +2435,7 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
     .devicesPostParseCallback = qemuDomainDeviceDefPostParse,
     .domainPostParseCallback = qemuDomainDefPostParse,
     .assignAddressesCallback = qemuDomainDefAssignAddresses,
+    .domainValidateCallback = qemuDomainDefValidate,
     .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
                 VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN
 };
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7fc4e80..1a9f176 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4307,13 +4307,6 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
         virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
         return -1;

-    if (vm->def->mem.min_guarantee) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("Parameter 'min_guarantee' "
-                         "not supported by QEMU."));
-        return -1;
-    }
-
     return 0;
 }

-- 
2.8.3


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