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

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

 



On 07/18/2018 06:00 AM, Lin Ma wrote:
Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
  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
+                '''

We don't use this style of comment in the middle of functions (and most of the code uses """ style anyways). I tweaked it and pushed

Thanks,
Cole

+                if controller.index == 0 and dev.target_type == "virtio":
+                    can_remove = False
+                    break
self.widget("config-remove").set_sensitive(can_remove)

_______________________________________________
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