From a62075772680bd30ced25d7177048ab26db8ea09 Mon Sep 17 00:00:00 2001 Message-Id: From: Pavel Hrdina Date: Fri, 21 May 2021 14:16:06 +0200 Subject: [PATCH] conf: introduce virDomainDefParseBootKernelOptions Extract the code to it's own function. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik (cherry picked from commit bf9b3f8e573092cc98ea647f25cf116e22bbfe3c) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357 Signed-off-by: Pavel Hrdina Message-Id: <936428a5fa6d4104361ac8080639a55111c14965.1621599207.git.phrdina@redhat.com> Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9eb418c7c0..432ad938f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19365,6 +19365,18 @@ virDomainDefParseBootInitOptions(virDomainDefPtr def, } +static void +virDomainDefParseBootKernelOptions(virDomainDefPtr def, + xmlXPathContextPtr ctxt) +{ + def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt); + def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt); + def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt); + def->os.dtb = virXPathString("string(./os/dtb[1])", ctxt); + def->os.root = virXPathString("string(./os/root[1])", ctxt); +} + + static int virDomainDefParseBootOptions(virDomainDefPtr def, xmlXPathContextPtr ctxt) @@ -19394,11 +19406,7 @@ virDomainDefParseBootOptions(virDomainDefPtr def, g_autofree char *firmware = NULL; xmlNodePtr loader_node; - def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt); - def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt); - def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt); - def->os.dtb = virXPathString("string(./os/dtb[1])", ctxt); - def->os.root = virXPathString("string(./os/root[1])", ctxt); + virDomainDefParseBootKernelOptions(def, ctxt); if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && (firmware = virXPathString("string(./os/@firmware)", ctxt))) { -- 2.31.1