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