From: Kiarie Kahurani <davidkiarie4(a)gmail.com>
Introduce function xenParseXMMem(virConfPtr conf,....);
This function parses the xm memory options
signed-off-by: David Kiarie<davidkiarie4(a)gmail.com>
---
src/xenxs/xen_xm.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 1953a85..dc840e5 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -294,6 +294,21 @@ static int xenParseXMGeneral(virConfPtr conf, virDomainDefPtr def,
}
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;
+}
virDomainDefPtr
xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -372,18 +387,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
}
}
-
- if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
- MIN_XEN_GUEST_SIZE * 2) < 0)
- goto cleanup;
-
- if (xenXMConfigGetULongLong(conf, "maxmem", &def->mem.max_balloon,
- def->mem.cur_balloon) < 0)
+ if (xenParseXMMem(conf, def) < 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