[virt-tools-list] [virt-manager PATCH 3/5] details: Disallow removing virtio-serial controller if devices attach to it

Lin Ma lma at suse.com
Wed Jul 18 10:00:21 UTC 2018


Signed-off-by: Lin Ma <lma at suse.com>
---
 virtManager/details.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/virtManager/details.py b/virtManager/details.py
index e3edbe86..00e18949 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -3041,6 +3041,19 @@ class vmmDetails(vmmGObjectUI):
                     model.append([infoStr])
             uiutil.set_grid_row_visible(self.widget("device-list-label"), True)
             uiutil.set_grid_row_visible(self.widget("controller-device-box"), True)
+        elif controller.type == "virtio-serial":
+            for dev in self.vm.xmlobj.devices.channel:
+                if dev.address.compare_controller(controller, dev.address.type):
+                    can_remove = False
+                    break
+            for dev in self.vm.xmlobj.devices.console:
+                '''
+                From libvirt's perspective, So far the console only works well
+                on virtio-serial controller 0
+                '''
+                if controller.index == 0 and dev.target_type == "virtio":
+                    can_remove = False
+                    break
 
         self.widget("config-remove").set_sensitive(can_remove)
 
-- 
2.16.2




More information about the virt-tools-list mailing list