Blame SOURCES/libvirt-conf-Split-memory-related-post-parse-stuff-into-separate-function.patch

7a3408
From db2a67e72870284bcf40584d405bb74bd7437786 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <db2a67e72870284bcf40584d405bb74bd7437786@dist-git>
7a3408
From: Peter Krempa <pkrempa@redhat.com>
7a3408
Date: Tue, 22 Sep 2015 16:59:42 +0200
7a3408
Subject: [PATCH] conf: Split memory related post parse stuff into separate
7a3408
 function
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1252685
7a3408
7a3408
The post parse func is growing rather large. Since later patches will
7a3408
introduce more logic in the memory post parse code, split it into a
7a3408
separate handler.
7a3408
7a3408
(cherry picked from commit 849b5fc4f609885b9976b633c6efaba0beee2fe3)
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/conf/domain_conf.c | 32 +++++++++++++++++++++-----------
7a3408
 1 file changed, 21 insertions(+), 11 deletions(-)
7a3408
7a3408
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
7a3408
index 3a3c238..1e32557 100644
7a3408
--- a/src/conf/domain_conf.c
7a3408
+++ b/src/conf/domain_conf.c
7a3408
@@ -3640,18 +3640,8 @@ virDomainDefRemoveDuplicateMetadata(virDomainDefPtr def)
7a3408
 
7a3408
 
7a3408
 static int
7a3408
-virDomainDefPostParseInternal(virDomainDefPtr def,
7a3408
-                              virCapsPtr caps ATTRIBUTE_UNUSED)
7a3408
+virDomainDefPostParseMemory(virDomainDefPtr def)
7a3408
 {
7a3408
-    size_t i;
7a3408
-
7a3408
-    /* verify init path for container based domains */
7a3408
-    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
7a3408
-        virReportError(VIR_ERR_XML_ERROR, "%s",
7a3408
-                       _("init binary must be specified"));
7a3408
-        return -1;
7a3408
-    }
7a3408
-
7a3408
     if (virDomainDefGetMemoryInitial(def) == 0) {
7a3408
         virReportError(VIR_ERR_XML_ERROR, "%s",
7a3408
                        _("Memory size must be specified via <memory> or in the "
7a3408
@@ -3679,6 +3669,26 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
7a3408
         return -1;
7a3408
     }
7a3408
 
7a3408
+    return 0;
7a3408
+}
7a3408
+
7a3408
+
7a3408
+static int
7a3408
+virDomainDefPostParseInternal(virDomainDefPtr def,
7a3408
+                              virCapsPtr caps ATTRIBUTE_UNUSED)
7a3408
+{
7a3408
+    size_t i;
7a3408
+
7a3408
+    /* verify init path for container based domains */
7a3408
+    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
7a3408
+        virReportError(VIR_ERR_XML_ERROR, "%s",
7a3408
+                       _("init binary must be specified"));
7a3408
+        return -1;
7a3408
+    }
7a3408
+
7a3408
+    if (virDomainDefPostParseMemory(def) < 0)
7a3408
+        return -1;
7a3408
+
7a3408
     /*
7a3408
      * Some really crazy backcompat stuff for consoles
7a3408
      *
7a3408
-- 
7a3408
2.5.3
7a3408