mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
src/xenxs: Refactor code parsing memory config
introduce function xenParseXMMem(virConfPtr conf,.........); which parses memory config instead Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
This commit is contained in:
parent
e260a0e60a
commit
52c048b1f0
@ -244,6 +244,25 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
|
|||||||
return 0;
|
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
|
#define MAX_VFB 1024
|
||||||
/*
|
/*
|
||||||
* Turn a config record into a lump of XML describing the
|
* Turn a config record into a lump of XML describing the
|
||||||
@ -251,7 +270,7 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
|
|||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenParseXM(virConfPtr conf, int xendConfigVersion,
|
xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||||
virCapsPtr caps)
|
virCapsPtr caps)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
int hvm = 0;
|
int hvm = 0;
|
||||||
@ -360,17 +379,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
|
if (xenParseXMMem(conf, def) < 0)
|
||||||
MIN_XEN_GUEST_SIZE * 2) < 0)
|
|
||||||
goto cleanup;
|
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 ||
|
if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
|
||||||
MAX_VIRT_CPUS < count)
|
MAX_VIRT_CPUS < count)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user