|
|
8c03ec |
From 75470b7c297be9bdd712282b89c48465dbe8d400 Mon Sep 17 00:00:00 2001
|
|
|
8c03ec |
Message-Id: <75470b7c297be9bdd712282b89c48465dbe8d400@dist-git>
|
|
|
8c03ec |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
8c03ec |
Date: Fri, 21 May 2021 14:16:10 +0200
|
|
|
8c03ec |
Subject: [PATCH] conf: use switch in virDomainDefParseBootOptions
|
|
|
8c03ec |
|
|
|
8c03ec |
The original code used a lot of conditions and was not that obvious
|
|
|
8c03ec |
when each XML bits are parsed.
|
|
|
8c03ec |
|
|
|
8c03ec |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
8c03ec |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
8c03ec |
(cherry picked from commit 6330be1ba3af5c4d2150fe2b831f7bc5d87c6d2a)
|
|
|
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: <900c870b1720688123ed7b69850548ae308ea9a8.1621599207.git.phrdina@redhat.com>
|
|
|
8c03ec |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
8c03ec |
---
|
|
|
8c03ec |
src/conf/domain_conf.c | 42 ++++++++++++++++++++++++++----------------
|
|
|
8c03ec |
1 file changed, 26 insertions(+), 16 deletions(-)
|
|
|
8c03ec |
|
|
|
8c03ec |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
8c03ec |
index f8d8d33245..93a78f8277 100644
|
|
|
8c03ec |
--- a/src/conf/domain_conf.c
|
|
|
8c03ec |
+++ b/src/conf/domain_conf.c
|
|
|
8c03ec |
@@ -19483,33 +19483,43 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
|
|
|
8c03ec |
* - An init script (exe)
|
|
|
8c03ec |
*/
|
|
|
8c03ec |
|
|
|
8c03ec |
- if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
|
|
|
8c03ec |
- if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
|
|
|
8c03ec |
- return -1;
|
|
|
8c03ec |
- }
|
|
|
8c03ec |
-
|
|
|
8c03ec |
- if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
|
|
|
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 |
-
|
|
|
8c03ec |
+ switch ((virDomainOSType) def->os.type) {
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_HVM:
|
|
|
8c03ec |
virDomainDefParseBootKernelOptions(def, ctxt);
|
|
|
8c03ec |
|
|
|
8c03ec |
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
|
|
8c03ec |
- if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
|
|
|
8c03ec |
- return -1;
|
|
|
8c03ec |
- }
|
|
|
8c03ec |
+ if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
|
|
|
8c03ec |
+ return -1;
|
|
|
8c03ec |
|
|
|
8c03ec |
if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0)
|
|
|
8c03ec |
return -1;
|
|
|
8c03ec |
- }
|
|
|
8c03ec |
|
|
|
8c03ec |
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
|
|
8c03ec |
if (virDomainDefParseBootAcpiOptions(def, ctxt) < 0)
|
|
|
8c03ec |
return -1;
|
|
|
8c03ec |
|
|
|
8c03ec |
if (virDomainDefParseBootXML(ctxt, def) < 0)
|
|
|
8c03ec |
return -1;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ break;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_XEN:
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_XENPVH:
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_UML:
|
|
|
8c03ec |
+ virDomainDefParseBootKernelOptions(def, ctxt);
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0)
|
|
|
8c03ec |
+ return -1;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ break;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_EXE:
|
|
|
8c03ec |
+ if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
|
|
|
8c03ec |
+ return -1;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ break;
|
|
|
8c03ec |
+
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_LINUX:
|
|
|
8c03ec |
+ case VIR_DOMAIN_OSTYPE_LAST:
|
|
|
8c03ec |
+ break;
|
|
|
8c03ec |
}
|
|
|
8c03ec |
|
|
|
8c03ec |
return 0;
|
|
|
8c03ec |
--
|
|
|
8c03ec |
2.31.1
|
|
|
8c03ec |
|