[virt-tools-list] [virt-manager PATCH] Prohibit adding PCI host devices to container

Pavel Fedin p.fedin at samsung.com
Wed Dec 23 12:01:29 UTC 2015


libvirt does not allow this and attempt to do so causes error during domain
startup. Prevent this in the beginning instead with correct explanation.

Signed-off-by: Pavel Fedin <p.fedin at samsung.com>
---
 virtManager/addhardware.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 8de710d..6d812e3 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -376,9 +376,14 @@ class vmmAddHardware(vmmGObjectUI):
                       self.conn.is_nodedev_capable(),
                       _("Connection does not support host device enumeration"),
                       "usb")
+        if self.vm.is_container():
+            enabled = False
+            errstr = _("Not supported for this guest type")
+        else:
+            enabled = self.conn.is_nodedev_capable()
+            errstr = _("Connection does not support host device enumeration")
         add_hw_option("PCI Host Device", "system-run", PAGE_HOSTDEV,
-                      self.conn.is_nodedev_capable(),
-                      _("Connection does not support host device enumeration"),
+                      enabled, errstr,
                       "pci")
         add_hw_option("Video", "video-display", PAGE_VIDEO, True,
                       _("Libvirt version does not support video devices."))
-- 
2.1.4




More information about the virt-tools-list mailing list