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