From 137b73df75c4290aced33f7509ce5dce189697a5 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 25 Jan 2020 16:04:12 -0500 Subject: [PATCH] virtManager: Only allow editing disk bus for new VM This was proposed here: https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html """ * disk: bus editing: maybe keep this for the customize wizard, but it should go away for existing disks, changing it for an existing VM is definitely a 'shoot yourself in the foot' type of thing for most users """ Signed-off-by: Cole Robinson --- tests/uitests/details.py | 9 +- tests/uitests/newvm.py | 15 ++ ui/details.ui | 274 ++++++++++++++++----------------- virtManager/details/details.py | 8 + 4 files changed, 157 insertions(+), 149 deletions(-) diff --git a/tests/uitests/details.py b/tests/uitests/details.py index 7ec4f6f3c..eb978c1d8 100644 --- a/tests/uitests/details.py +++ b/tests/uitests/details.py @@ -227,15 +227,8 @@ class Details(uiutils.UITestCase): tab.find("Shareable:", "check box").click() tab.find("Readonly:", "check box").click() tab.find("Advanced options", "toggle button").click_expander() - tab.find("Disk bus:", "text").text = "usb" - tab.find("Performance options", "toggle button").click_expander() tab.find("Cache mode:", "text").text = "unsafe" - appl.click() - uiutils.check_in_loop(lambda: not appl.sensitive) - # Device is now 'USB Disk 1' - c = hwlist.find("USB Disk 1", "table cell") - self.assertTrue(c.state_selected) - tab.find("Removable:", "check box").click() + tab.find("Discard mode:", "text").text = "unmap" appl.click() uiutils.check_in_loop(lambda: not appl.sensitive) diff --git a/tests/uitests/newvm.py b/tests/uitests/newvm.py index 780095a8c..18192c8a7 100644 --- a/tests/uitests/newvm.py +++ b/tests/uitests/newvm.py @@ -195,6 +195,21 @@ class NewVM(uiutils.UITestCase): addhw.find("Finish", "push button").click() uiutils.check_in_loop(lambda: vmwindow.active) + # Select the new disk, change the bus to USB + vmwindow.find_fuzzy("IDE Disk 2", "table cell").click() + appl = vmwindow.find("config-apply", "push button") + hwlist = vmwindow.find("hw-list") + tab = vmwindow.find("disk-tab") + tab.find("Disk bus:", "text").text = "usb" + appl.click() + uiutils.check_in_loop(lambda: not appl.sensitive) + # Device is now 'USB Disk 1' + c = hwlist.find("USB Disk 1", "table cell") + self.assertTrue(c.state_selected) + tab.find("Removable:", "check box").click() + appl.click() + uiutils.check_in_loop(lambda: not appl.sensitive) + # Start the install, close via the VM window vmwindow.find_fuzzy("Begin Installation", "button").click() uiutils.check_in_loop(lambda: newvm.showing is False) diff --git a/ui/details.ui b/ui/details.ui index 83bcf6b53..598114ab1 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -2705,7 +2705,7 @@ 0 - 3 + 4 @@ -2719,7 +2719,7 @@ 0 - 4 + 5 @@ -2732,7 +2732,7 @@ 1 - 3 + 4 @@ -2746,7 +2746,7 @@ 1 - 4 + 5 @@ -2758,7 +2758,7 @@ 0 - 2 + 3 @@ -2770,7 +2770,7 @@ 1 - 2 + 3 @@ -2896,7 +2896,7 @@ 0 - 5 + 6 @@ -2911,7 +2911,63 @@ 1 - 5 + 6 + + + + + True + False + end + Disk b_us: + True + disk-bus-text + + + 0 + 2 + + + + + True + False + 3 + + + True + False + start + True + + + + True + + + + + False + True + 0 + + + + + True + False + disk-bus-label + + + False + True + 1 + + + + + 1 + 2 @@ -2932,19 +2988,19 @@ vertical 6 - + True False 3 8 - + True False end - Disk b_us: + Cac_he mode: True - disk-bus-text + disk-cache-text 0 @@ -2952,13 +3008,13 @@ - + True False True - + - + True @@ -2968,6 +3024,68 @@ 0 + + + True + False + end + Discard mod_e: + True + disk-discard-text + + + 0 + 1 + + + + + True + False + True + + + + True + + + + + 1 + 1 + + + + + True + False + end + Detect _zeroes: + True + disk-detect-zeroes-text + + + 0 + 2 + + + + + True + False + True + + + + True + + + + + 1 + 2 + + False @@ -2975,132 +3093,6 @@ 0 - - - True - True - - - True - False - 3 - 8 - - - True - False - end - Cac_he mode: - True - disk-cache-text - - - 0 - 0 - - - - - True - False - True - - - - True - - - - - 1 - 0 - - - - - True - False - end - Discard mod_e: - True - disk-discard-text - - - 0 - 2 - - - - - True - False - True - - - - True - - - - - 1 - 2 - - - - - True - False - end - Detect _zeroes: - True - disk-detect-zeroes-text - - - 0 - 3 - - - - - True - False - True - - - - True - - - - - 1 - 3 - - - - - - - - - - - - - True - False - _Performance options - True - - - - - False - True - 1 - - diff --git a/virtManager/details/details.py b/virtManager/details/details.py index c67e26bca..e062f7054 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -846,6 +846,12 @@ class vmmDetails(vmmGObjectUI): # Disk bus combo disk_bus = self.widget("disk-bus") vmmAddHardware.build_disk_bus_combo(self.vm, disk_bus) + self.widget("disk-bus-label").set_visible( + not self.is_customize_dialog) + self.widget("disk-bus").set_visible(self.is_customize_dialog) + if not self.is_customize_dialog: + # Remove the mnemonic + self.widget("disk-bus-labeller").set_text(_("Disk bus:")) # Network model net_model = self.widget("network-model") @@ -2174,6 +2180,8 @@ class vmmDetails(vmmGObjectUI): vmmAddHardware.populate_disk_bus_combo(self.vm, devtype, self.widget("disk-bus").get_model()) uiutil.set_list_selection(self.widget("disk-bus"), bus) + self.widget("disk-bus-label").set_text( + vmmAddHardware.disk_pretty_bus(bus) or "-") is_removable = disk.is_cdrom() or disk.is_floppy() self.widget("disk-source-box").set_visible(is_removable)