[virt-manager PATCH 1/2] cli: fix sysinfo type parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the optstr is "host" or "emulate" the optdict['type'] was already set
to the proper value so that condition is useless and we should set the
default optdict['type'] only if there was no type specified by user,
otherwise it is overwrite by our 'smbios' default.

In addition if invalid type is specified let libvirt to do the error
checking.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1707379

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 virtinst/cli.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 4ebdf84d..76de1367 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2336,9 +2336,7 @@ class ParserSysinfo(VirtCLIParser):
     }
 
     def _parse(self, inst):
-        if self.optstr == "host" or self.optstr == "emulate":
-            self.optdict['type'] = self.optstr
-        elif self.optstr:
+        if self.optstr and 'type' not in self.optdict:
             # If any string specified, default to type=smbios otherwise
             # libvirt errors. User args can still override this though
             self.optdict['type'] = 'smbios'
@@ -2357,7 +2355,7 @@ class ParserSysinfo(VirtCLIParser):
             self.guest.os.smbios_mode = "sysinfo"
             inst.type = val
         else:
-            fail(_("Unknown sysinfo flag '%s'") % val)
+            inst.type = val
 
     def set_uuid_cb(self, inst, val, virtarg):
         # If a uuid is supplied it must match the guest UUID. This would be
-- 
2.21.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux