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

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

 



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@xxxxxxxxxxx>
---
 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

_______________________________________________
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