[PATCH v2 5/6] details: Disallow removing the scsi controller if disks attached to it

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

 



Through virt-manager, After we removed a virtio-scsi controller which
virtual disks still attach to it, Libvirt will add a LSI scsi controller
for this guest automatically and trigger a lifecycle event, virt-manager
updates and shows this new scsi controller in details panel once it got
the lifecycle event.

It may confuse user that a LSI scsi controller occurs while one removes
the virtio-scsi controller.

This patch prevents removing a scsi controller if any disks attaching to
it.

Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
 virtManager/details.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/virtManager/details.py b/virtManager/details.py
index d67361d2..f284690e 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -3013,6 +3013,11 @@ class vmmDetails(vmmGObjectUI):
             can_remove = False
         if controller.type == "pci":
             can_remove = False
+        if controller.type == "scsi":
+            for disk in self.vm.get_disk_devices():
+                if disk.address.compare_controller(controller, disk.bus):
+                    can_remove = False
+                    break
         self.widget("config-remove").set_sensitive(can_remove)
 
         type_label = controller.pretty_desc()
-- 
2.14.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