Blame SOURCES/virt-manager-cli-fix-sysinfo-type-parsing.patch

3d61c0
From 495c36309fb0d056449ca843fea9a0ff46f29233 Mon Sep 17 00:00:00 2001
3d61c0
Message-Id: <495c36309fb0d056449ca843fea9a0ff46f29233@dist-git>
3d61c0
From: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Date: Tue, 14 May 2019 14:00:18 +0200
3d61c0
Subject: [PATCH] cli: fix sysinfo type parsing
3d61c0
3d61c0
If the optstr is "host" or "emulate" the optdict['type'] was already set
3d61c0
to the proper value so that condition is useless and we should set the
3d61c0
default optdict['type'] only if there was no type specified by user,
3d61c0
otherwise it is overwrite by our 'smbios' default.
3d61c0
3d61c0
In addition if invalid type is specified let libvirt to do the error
3d61c0
checking.
3d61c0
3d61c0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1707379
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
(cherry picked from commit 897578aee2c22cb2aae66cb23cfd8cc8b79c11c5)
3d61c0
3d61c0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1707380
3d61c0
3d61c0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3d61c0
Reviewed-by: Cole Robinson <crobinso@redhat.com>
3d61c0
---
3d61c0
 virtinst/cli.py | 6 ++----
3d61c0
 1 file changed, 2 insertions(+), 4 deletions(-)
3d61c0
3d61c0
diff --git a/virtinst/cli.py b/virtinst/cli.py
3d61c0
index 31678591..4adfd3af 100644
3d61c0
--- a/virtinst/cli.py
3d61c0
+++ b/virtinst/cli.py
3d61c0
@@ -1857,7 +1857,7 @@ class ParserSYSInfo(VirtCLIParser):
3d61c0
             self.guest.os.smbios_mode = "sysinfo"
3d61c0
             inst.type = val
3d61c0
         else:
3d61c0
-            fail(_("Unknown sysinfo flag '%s'") % val)
3d61c0
+            inst.type = val
3d61c0
 
3d61c0
     def set_uuid_cb(self, inst, val, virtarg):
3d61c0
         # If a uuid is supplied it must match the guest UUID. This would be
3d61c0
@@ -1868,9 +1868,7 @@ class ParserSYSInfo(VirtCLIParser):
3d61c0
         self.guest.uuid = val
3d61c0
 
3d61c0
     def _parse(self, inst):
3d61c0
-        if self.optstr == "host" or self.optstr == "emulate":
3d61c0
-            self.optdict['type'] = self.optstr
3d61c0
-        elif self.optstr:
3d61c0
+        if self.optstr and 'type' not in self.optdict:
3d61c0
             # If any string specified, default to type=smbios otherwise
3d61c0
             # libvirt errors. User args can still override this though
3d61c0
             self.optdict['type'] = 'smbios'
3d61c0
-- 
3d61c0
2.21.0
3d61c0