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

[libvirt] [PATCH 5/6] conf: Move check that validates disk info to virDomainDefValidate



Now that we have a good place for this check let's move it there.
---
 src/conf/domain_conf.c   | 11 +++++++----
 src/conf/domain_conf.h   |  6 ++----
 src/libvirt_private.syms |  1 -
 src/qemu/qemu_process.c  |  3 ---
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7359dc7..2beb825 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24263,8 +24263,8 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)


 int
-virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
-                                   virDomainDiskDefPtr b)
+virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
+                                   const virDomainDiskDef *b)
 {
     if (STREQ(a->dst, b->dst)) {
         virReportError(VIR_ERR_XML_ERROR,
@@ -24293,8 +24293,8 @@ virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
 }


-int
-virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
+static int
+virDomainDefCheckDuplicateDiskInfo(const virDomainDef *def)
 {
     size_t i;
     size_t j;
@@ -24392,6 +24392,9 @@ virDomainDefValidate(const virDomainDef *def)
     /* check configuration of individual devices */
     VIR_DOMAIN_DEF_VALIDATE_DEVICES(disk, virDomainDiskDefValidate);

+    if (virDomainDefCheckDuplicateDiskInfo(def) < 0)
+        return -1;
+
     return 0;
 }

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f2704c0..3c219ea 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3160,11 +3160,9 @@ virDomainParseMemory(const char *xpath,
 bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
     ATTRIBUTE_NONNULL(1);

-int virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
-                                       virDomainDiskDefPtr b)
+int virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
+                                       const virDomainDiskDef *b)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);

 int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
                                      int maplen,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index cc5d6c9..99975ed 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -206,7 +206,6 @@ virDomainDefAddController;
 virDomainDefAddImplicitDevices;
 virDomainDefAddUSBController;
 virDomainDefCheckABIStability;
-virDomainDefCheckDuplicateDiskInfo;
 virDomainDefClearCCWAddresses;
 virDomainDefClearDeviceAliases;
 virDomainDefClearPCIAddresses;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ae435e4..15c0bf9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4627,9 +4627,6 @@ qemuProcessStartValidateXML(virDomainObjPtr vm,
     if (!migration && !snapshot) {
         if (qemuDomainDefValidate(vm->def) < 0)
             return -1;
-
-        if (virDomainDefCheckDuplicateDiskInfo(vm->def) < 0)
-            return -1;
     }

     /* checks below validate config that would make qemu fail to start */
-- 
2.8.2


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