|
|
8c03ec |
From 2a019bfa26e697c60893afd09fcc2f0c3218691b Mon Sep 17 00:00:00 2001
|
|
|
8c03ec |
Message-Id: <2a019bfa26e697c60893afd09fcc2f0c3218691b@dist-git>
|
|
|
8c03ec |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
8c03ec |
Date: Fri, 21 May 2021 14:16:07 +0200
|
|
|
8c03ec |
Subject: [PATCH] conf: introduce virDomainDefParseBootFirmwareOptions
|
|
|
8c03ec |
|
|
|
8c03ec |
Extract the code to it's own function.
|
|
|
8c03ec |
|
|
|
8c03ec |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
8c03ec |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
8c03ec |
(cherry picked from commit bcf97abfc6b45694f0d789ae2bdf87c8d082fddf)
|
|
|
8c03ec |
|
|
|
8c03ec |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
|
|
|
8c03ec |
|
|
|
8c03ec |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
8c03ec |
Message-Id: <9a090d9f2a43b261ed1b6db608779a01a7594f4a.1621599207.git.phrdina@redhat.com>
|
|
|
8c03ec |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
8c03ec |
---
|
|
|
8c03ec |
src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++------------
|
|
|
8c03ec |
1 file changed, 27 insertions(+), 12 deletions(-)
|
|
|
8c03ec |
|
|
|
8c03ec |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
8c03ec |
index 432ad938f9..bb484a57c6 100644
|
|
|
8c03ec |
--- a/src/conf/domain_conf.c
|
|
|
8c03ec |
+++ b/src/conf/domain_conf.c
|
|
|
8c03ec |
@@ -19377,6 +19377,31 @@ virDomainDefParseBootKernelOptions(virDomainDefPtr def,
|
|
|
8c03ec |
}
|
|
|
8c03ec |
|
|
|
8c03ec |
|
|
|
8c03ec |
+static int
|
|
|
8c03ec |
+virDomainDefParseBootFirmwareOptions(virDomainDefPtr def,
|
|
|
8c03ec |
+ xmlXPathContextPtr ctxt)
|
|
|
8c03ec |
+{
|
|
|
8c03ec |
+ g_autofree char *firmware = virXPathString("string(./os/@firmware)", ctxt);
|
|
|
8c03ec |
+ int fw = 0;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ if (!firmware)
|
|
|
8c03ec |
+ return 0;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ fw = virDomainOsDefFirmwareTypeFromString(firmware);
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ if (fw <= 0) {
|
|
|
8c03ec |
+ virReportError(VIR_ERR_XML_ERROR,
|
|
|
8c03ec |
+ _("unknown firmware value %s"),
|
|
|
8c03ec |
+ firmware);
|
|
|
8c03ec |
+ return -1;
|
|
|
8c03ec |
+ }
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ def->os.firmware = fw;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ return 0;
|
|
|
8c03ec |
+}
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+
|
|
|
8c03ec |
static int
|
|
|
8c03ec |
virDomainDefParseBootOptions(virDomainDefPtr def,
|
|
|
8c03ec |
xmlXPathContextPtr ctxt)
|
|
|
8c03ec |
@@ -19403,23 +19428,13 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
|
|
|
8c03ec |
def->os.type == VIR_DOMAIN_OSTYPE_XENPVH ||
|
|
|
8c03ec |
def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
|
|
|
8c03ec |
def->os.type == VIR_DOMAIN_OSTYPE_UML) {
|
|
|
8c03ec |
- g_autofree char *firmware = NULL;
|
|
|
8c03ec |
xmlNodePtr loader_node;
|
|
|
8c03ec |
|
|
|
8c03ec |
virDomainDefParseBootKernelOptions(def, ctxt);
|
|
|
8c03ec |
|
|
|
8c03ec |
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM &&
|
|
|
8c03ec |
- (firmware = virXPathString("string(./os/@firmware)", ctxt))) {
|
|
|
8c03ec |
- int fw = virDomainOsDefFirmwareTypeFromString(firmware);
|
|
|
8c03ec |
-
|
|
|
8c03ec |
- if (fw <= 0) {
|
|
|
8c03ec |
- virReportError(VIR_ERR_XML_ERROR,
|
|
|
8c03ec |
- _("unknown firmware value %s"),
|
|
|
8c03ec |
- firmware);
|
|
|
8c03ec |
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
|
|
8c03ec |
+ if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
|
|
|
8c03ec |
return -1;
|
|
|
8c03ec |
- }
|
|
|
8c03ec |
-
|
|
|
8c03ec |
- def->os.firmware = fw;
|
|
|
8c03ec |
}
|
|
|
8c03ec |
|
|
|
8c03ec |
if ((loader_node = virXPathNode("./os/loader[1]", ctxt))) {
|
|
|
8c03ec |
--
|
|
|
8c03ec |
2.31.1
|
|
|
8c03ec |
|