Skip to content

Commit

Permalink
details: Remove 'detect zeroes' UI
Browse files Browse the repository at this point in the history
After checking with qemu devs, this option is not really recommended
for common usage and doesn't get used much in practice. So I don't
think it is suitable for the UI

Signed-off-by: Cole Robinson <[email protected]>
  • Loading branch information
crobinso committed Feb 3, 2022
1 parent 381aa40 commit 8377b7f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 62 deletions.
1 change: 0 additions & 1 deletion tests/uitests/test_addhardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def testAddDisks(app):
tab.find("Serial:", "text").set_text("ZZZZ")
tab.combo_select("Cache mode:", "none")
tab.combo_select("Discard mode:", "ignore")
tab.combo_select("Detect zeroes:", "unmap")
# High number but we are non-sparse by default so it won't complain
tab.find("GiB", "spin button").set_text("200000")
_finish(addhw, check=details)
Expand Down
1 change: 0 additions & 1 deletion tests/uitests/test_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def testDetailsEditDiskNet(app):
tab.find("Serial:", "text").set_text("1234-ABCD")
tab.combo_select("Cache mode:", "unsafe")
tab.combo_select("Discard mode:", "unmap")
tab.combo_select("Detect zeroes:", "unmap")
appl.click()
lib.utils.check(lambda: not appl.sensitive)

Expand Down
33 changes: 1 addition & 32 deletions ui/addstorage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<!-- n-columns=2 n-rows=7 -->
<!-- n-columns=2 n-rows=6 -->
<object class="GtkGrid" id="table19">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand Down Expand Up @@ -314,37 +314,6 @@
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label-disk-detect-zeroes">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Detect _zeroes:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">disk-detect-zeroes</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="disk-detect-zeroes">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="has-entry">True</property>
<signal name="changed" handler="on_disk_detect_zeroes_combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can-focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="permissions-label">
<property name="visible">True</property>
Expand Down
20 changes: 1 addition & 19 deletions virtManager/device/addstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
(
_EDIT_CACHE,
_EDIT_DISCARD,
_EDIT_DETECT_ZEROES,
_EDIT_RO,
_EDIT_SHARE,
_EDIT_REMOVABLE,
_EDIT_SERIAL,
) = range(1, 8)
) = range(1, 7)


class vmmAddStorage(vmmGObjectUI):
Expand All @@ -46,7 +45,6 @@ def signal_cb(*args):
"on_storage_select_toggled": self._toggle_storage_select,
"on_disk_cache_combo_changed": _e(_EDIT_CACHE),
"on_disk_discard_combo_changed": _e(_EDIT_DISCARD),
"on_disk_detect_zeroes_combo_changed": _e(_EDIT_DETECT_ZEROES),
"on_disk_readonly_changed": _e(_EDIT_RO),
"on_disk_shareable_changed": _e(_EDIT_SHARE),
"on_disk_removable_changed": _e(_EDIT_REMOVABLE),
Expand Down Expand Up @@ -110,13 +108,6 @@ def _init_ui(self):
uiutil.build_simple_combo(
self.widget("disk-discard"), values, sort=False)

# Detect zeroes combo
values = [[None, _("Hypervisor default")]]
for m in virtinst.DeviceDisk.DETECT_ZEROES_MODES:
values.append([m, m])
uiutil.build_simple_combo(
self.widget("disk-detect-zeroes"), values, sort=False)


##############
# Public API #
Expand Down Expand Up @@ -179,7 +170,6 @@ def reset_state(self):
self.widget("storage-create-box").set_sensitive(True)
self.widget("disk-cache").set_active(0)
self.widget("disk-discard").set_active(0)
self.widget("disk-detect-zeroes").set_active(0)
self.widget("disk-serial").set_text("")
self.widget("storage-advanced").set_expanded(False)
self.widget("disk-readonly").set_active(False)
Expand Down Expand Up @@ -236,8 +226,6 @@ def build_device(self, vmname,
disk.driver_cache = vals.get("cache")
if vals.get("discard") is not None:
disk.driver_discard = vals.get("discard")
if vals.get("detect_zeroes") is not None:
disk.driver_detect_zeroes = vals.get("detect_zeroes")
if vals.get("readonly") is not None:
disk.read_only = vals.get("readonly")
if vals.get("shareable") is not None:
Expand Down Expand Up @@ -307,7 +295,6 @@ def set_disk_bus(self, bus):
def set_dev(self, disk):
cache = disk.driver_cache
discard = disk.driver_discard
detect_zeroes = disk.driver_detect_zeroes
ro = disk.read_only
share = disk.shareable
removable = bool(disk.removable)
Expand All @@ -317,8 +304,6 @@ def set_dev(self, disk):

uiutil.set_list_selection(self.widget("disk-cache"), cache)
uiutil.set_list_selection(self.widget("disk-discard"), discard)
uiutil.set_list_selection(
self.widget("disk-detect-zeroes"), detect_zeroes)

self.widget("disk-serial").set_text(serial or "")
self.widget("disk-readonly").set_active(ro)
Expand All @@ -339,9 +324,6 @@ def get_values(self):
if _EDIT_DISCARD in self._active_edits:
ret["discard"] = uiutil.get_list_selection(
self.widget("disk-discard"))
if _EDIT_DETECT_ZEROES in self._active_edits:
ret["detect_zeroes"] = uiutil.get_list_selection(
self.widget("disk-detect-zeroes"))
if _EDIT_RO in self._active_edits:
ret["readonly"] = self.widget("disk-readonly").get_active()
if _EDIT_SHARE in self._active_edits:
Expand Down
4 changes: 1 addition & 3 deletions virtManager/object/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def define_boot(self, boot_order=_SENTINEL, boot_menu=_SENTINEL,
def define_disk(self, devobj, do_hotplug,
path=_SENTINEL, readonly=_SENTINEL,
shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL,
discard=_SENTINEL, detect_zeroes=_SENTINEL, bus=_SENTINEL,
discard=_SENTINEL, bus=_SENTINEL,
serial=_SENTINEL):
xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
Expand All @@ -802,8 +802,6 @@ def define_disk(self, devobj, do_hotplug,
editdev.driver_cache = cache or None
if discard != _SENTINEL:
editdev.driver_discard = discard or None
if detect_zeroes != _SENTINEL:
editdev.driver_detect_zeroes = detect_zeroes or None

if bus != _SENTINEL:
editdev.change_bus(self.xmlobj, bus)
Expand Down
6 changes: 0 additions & 6 deletions virtinst/devices/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ class DeviceDisk(Device):
DISCARD_MODE_UNMAP = "unmap"
DISCARD_MODES = [DISCARD_MODE_IGNORE, DISCARD_MODE_UNMAP]

DETECT_ZEROES_MODE_OFF = "off"
DETECT_ZEROES_MODE_ON = "on"
DETECT_ZEROES_MODE_UNMAP = "unmap"
DETECT_ZEROES_MODES = [DETECT_ZEROES_MODE_OFF, DETECT_ZEROES_MODE_ON,
DETECT_ZEROES_MODE_UNMAP]

DEVICE_DISK = "disk"
DEVICE_LUN = "lun"
DEVICE_CDROM = "cdrom"
Expand Down

0 comments on commit 8377b7f

Please sign in to comment.