125 lines
3.8 KiB
Diff
125 lines
3.8 KiB
Diff
|
From 7ba2905bfcab4dbe4a491ee8587dd4c9ef457c0b Mon Sep 17 00:00:00 2001
|
||
|
Message-Id: <7ba2905bfcab4dbe4a491ee8587dd4c9ef457c0b@dist-git>
|
||
|
From: Pavel Hrdina <phrdina@redhat.com>
|
||
|
Date: Fri, 21 May 2021 14:16:09 +0200
|
||
|
Subject: [PATCH] conf: introduce virDomainDefParseBootAcpiOptions
|
||
|
|
||
|
Extract the code to it's own function.
|
||
|
|
||
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||
|
(cherry picked from commit 108cb29c1c7eec7b9089dd431e0bdcd82a0b07f1)
|
||
|
|
||
|
Conflicts:
|
||
|
src/conf/domain_conf.c
|
||
|
- missing upstream commit d293a556d710754d8aa8d5caac0bb01a365fcbd8
|
||
|
|
||
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
|
||
|
|
||
|
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||
|
Message-Id: <5fb7ee0165340ff517b3f7f16ddc542813ac385d.1621599207.git.phrdina@redhat.com>
|
||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||
|
---
|
||
|
src/conf/domain_conf.c | 71 ++++++++++++++++++++++++------------------
|
||
|
1 file changed, 41 insertions(+), 30 deletions(-)
|
||
|
|
||
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||
|
index 493700ed6b..f8d8d33245 100644
|
||
|
--- a/src/conf/domain_conf.c
|
||
|
+++ b/src/conf/domain_conf.c
|
||
|
@@ -19429,13 +19429,51 @@ virDomainDefParseBootLoaderOptions(virDomainDefPtr def,
|
||
|
|
||
|
|
||
|
static int
|
||
|
-virDomainDefParseBootOptions(virDomainDefPtr def,
|
||
|
- xmlXPathContextPtr ctxt)
|
||
|
+virDomainDefParseBootAcpiOptions(virDomainDefPtr def,
|
||
|
+ xmlXPathContextPtr ctxt)
|
||
|
{
|
||
|
int n;
|
||
|
g_autofree xmlNodePtr *nodes = NULL;
|
||
|
g_autofree char *tmp = NULL;
|
||
|
|
||
|
+ if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0)
|
||
|
+ return -1;
|
||
|
+
|
||
|
+ if (n > 1) {
|
||
|
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
+ _("Only one acpi table is supported"));
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (n == 1) {
|
||
|
+ tmp = virXMLPropString(nodes[0], "type");
|
||
|
+
|
||
|
+ if (!tmp) {
|
||
|
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
+ _("Missing acpi table type"));
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (STREQ_NULLABLE(tmp, "slic")) {
|
||
|
+ VIR_FREE(tmp);
|
||
|
+ tmp = virXMLNodeContentString(nodes[0]);
|
||
|
+ def->os.slic_table = virFileSanitizePath(tmp);
|
||
|
+ } else {
|
||
|
+ virReportError(VIR_ERR_XML_ERROR,
|
||
|
+ _("Unknown acpi table type: %s"),
|
||
|
+ tmp);
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
+static int
|
||
|
+virDomainDefParseBootOptions(virDomainDefPtr def,
|
||
|
+ xmlXPathContextPtr ctxt)
|
||
|
+{
|
||
|
/*
|
||
|
* Booting options for different OS types....
|
||
|
*
|
||
|
@@ -19467,36 +19505,9 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
|
||
|
}
|
||
|
|
||
|
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||
|
- if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0)
|
||
|
+ if (virDomainDefParseBootAcpiOptions(def, ctxt) < 0)
|
||
|
return -1;
|
||
|
|
||
|
- if (n > 1) {
|
||
|
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
- _("Only one acpi table is supported"));
|
||
|
- return -1;
|
||
|
- }
|
||
|
-
|
||
|
- if (n == 1) {
|
||
|
- tmp = virXMLPropString(nodes[0], "type");
|
||
|
-
|
||
|
- if (!tmp) {
|
||
|
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
||
|
- _("Missing acpi table type"));
|
||
|
- return -1;
|
||
|
- }
|
||
|
-
|
||
|
- if (STREQ_NULLABLE(tmp, "slic")) {
|
||
|
- VIR_FREE(tmp);
|
||
|
- tmp = virXMLNodeContentString(nodes[0]);
|
||
|
- def->os.slic_table = virFileSanitizePath(tmp);
|
||
|
- } else {
|
||
|
- virReportError(VIR_ERR_XML_ERROR,
|
||
|
- _("Unknown acpi table type: %s"),
|
||
|
- tmp);
|
||
|
- return -1;
|
||
|
- }
|
||
|
- }
|
||
|
-
|
||
|
if (virDomainDefParseBootXML(ctxt, def) < 0)
|
||
|
return -1;
|
||
|
}
|
||
|
--
|
||
|
2.31.1
|
||
|
|