[PATCH v2 01/25] src/xenxs:Refactor code parsing memory config

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

 



From: Kiarie Kahurani <davidkiarie4@xxxxxxxxx>

Introduce function
 xenParseXMMem(virConfPtr conf,......);
which parses memory config instead

signed-off-by: David Kiarie<davidkiarie4@xxxxxxxxx>
---
 src/xenxs/xen_xm.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index f6492b5..5e26e5e 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -244,6 +244,23 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
     return 0;
 }
 
+
+static
+int xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+    if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
+                                MIN_XEN_GUEST_SIZE * 2) < 0)
+        return -1;
+
+    if (xenXMConfigGetULongLong(conf, "maxmem", &def->mem.max_balloon,
+                                def->mem.cur_balloon) < 0)
+        return -1;
+
+    def->mem.cur_balloon *= 1024;
+    def->mem.max_balloon *= 1024;
+
+    return 0;
+}
 #define MAX_VFB 1024
 /*
  * Turn a config record into a lump of XML describing the
@@ -360,17 +377,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
         }
     }
 
-    if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
-                                MIN_XEN_GUEST_SIZE * 2) < 0)
+    if (xenParseXMMem(conf, def) < 0)
         goto cleanup;
-
-    if (xenXMConfigGetULongLong(conf, "maxmem", &def->mem.max_balloon,
-                                def->mem.cur_balloon) < 0)
-        goto cleanup;
-
-    def->mem.cur_balloon *= 1024;
-    def->mem.max_balloon *= 1024;
-
     if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
         MAX_VIRT_CPUS < count)
         goto cleanup;
-- 
1.8.4.5

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]