mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
details: Add support for disk detect zeroes option
This commit is contained in:
parent
d13b793bfa
commit
e6c7e46a54
@ -59,7 +59,7 @@
|
||||
<total_iops_sec>5</total_iops_sec>
|
||||
<total_bytes_sec>6</total_bytes_sec>
|
||||
</iotune>
|
||||
<driver cache="writeback" discard="unmap" io="native"/>
|
||||
<driver cache="writeback" discard="unmap" detect_zeroes="unmap" io="native"/>
|
||||
<source file="/dev/default-pool/default-vol" startupPolicy="optional"/>
|
||||
<shareable/>
|
||||
</disk>
|
||||
|
@ -387,6 +387,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("driver_io", None, "threads")
|
||||
check("driver_io", "threads", "native")
|
||||
check("driver_discard", None, "unmap")
|
||||
check("driver_detect_zeroes", None, "unmap")
|
||||
check("iotune_ris", 1, 0)
|
||||
check("iotune_rbs", 2, 0)
|
||||
check("iotune_wis", 3, 0)
|
||||
|
@ -279,6 +279,30 @@
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label-storage-detect-zeroes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Detect _zeroes:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">storage-detect-zeroes</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="storage-detect-zeroes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
|
@ -3819,6 +3819,37 @@
|
||||
<property name="top_attach">2</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">detectzeroesmode-entry-box</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</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" id="detectzeroesmode-entry-box">
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
|
@ -194,6 +194,8 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
self._build_disk_device_combo()
|
||||
self.build_disk_cache_combo(self.vm, self.widget("storage-cache"))
|
||||
self.build_disk_discard_combo(self.vm, self.widget("storage-discard"))
|
||||
self.build_disk_detect_zeroes_combo(self.vm,
|
||||
self.widget("storage-detect-zeroes"))
|
||||
self.build_network_model_combo(self.vm, self.widget("net-model"))
|
||||
self._build_input_combo()
|
||||
self.build_sound_combo(self.vm, self.widget("sound-model"))
|
||||
@ -455,6 +457,13 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
values.append([m, m])
|
||||
_build_combo(combo, values, sort=False)
|
||||
|
||||
@staticmethod
|
||||
def build_disk_detect_zeroes_combo(_vm, combo):
|
||||
values = [[None, _("Hypervisor default")]]
|
||||
for m in DeviceDisk.detect_zeroes_types:
|
||||
values.append([m, m])
|
||||
_build_combo(combo, values, sort=False)
|
||||
|
||||
@staticmethod
|
||||
def build_disk_bus_combo(_vm, combo):
|
||||
_build_combo(combo, [])
|
||||
|
@ -57,6 +57,7 @@ from .graphwidgets import Sparkline
|
||||
EDIT_DISK_CACHE,
|
||||
EDIT_DISK_IO,
|
||||
EDIT_DISK_DISCARD,
|
||||
EDIT_DISK_DETECT_ZEROES,
|
||||
EDIT_DISK_BUS,
|
||||
EDIT_DISK_SERIAL,
|
||||
EDIT_DISK_FORMAT,
|
||||
@ -95,7 +96,7 @@ from .graphwidgets import Sparkline
|
||||
|
||||
EDIT_FS,
|
||||
|
||||
EDIT_HOSTDEV_ROMBAR) = range(1, 52)
|
||||
EDIT_HOSTDEV_ROMBAR) = range(1, 53)
|
||||
|
||||
|
||||
# Columns in hw list model
|
||||
@ -540,6 +541,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
"on_disk_cache_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_CACHE),
|
||||
"on_disk_io_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_IO),
|
||||
"on_disk_discard_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_DISCARD),
|
||||
"on_disk_detect_zeroes_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_DETECT_ZEROES),
|
||||
"on_disk_bus_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_BUS),
|
||||
"on_disk_format_changed": self.disk_format_changed,
|
||||
"on_disk_serial_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SERIAL),
|
||||
@ -1022,6 +1024,10 @@ class vmmDetails(vmmGObjectUI):
|
||||
combo = self.widget("disk-discard")
|
||||
vmmAddHardware.build_disk_discard_combo(self.vm, combo)
|
||||
|
||||
# Detect zeroes combo
|
||||
combo = self.widget("disk-detect-zeroes")
|
||||
vmmAddHardware.build_disk_detect_zeroes_combo(self.vm, combo)
|
||||
|
||||
# Disk bus combo
|
||||
disk_bus = self.widget("disk-bus")
|
||||
vmmAddHardware.build_disk_bus_combo(self.vm, disk_bus)
|
||||
@ -2123,6 +2129,10 @@ class vmmDetails(vmmGObjectUI):
|
||||
kwargs["discard"] = uiutil.get_list_selection(
|
||||
self.widget("disk-discard"))
|
||||
|
||||
if self.edited(EDIT_DISK_DETECT_ZEROES):
|
||||
kwargs["detect_zeroes"] = uiutil.get_list_selection(
|
||||
self.widget("disk-detect-zeroes"))
|
||||
|
||||
if self.edited(EDIT_DISK_FORMAT):
|
||||
kwargs["driver_type"] = self.widget("disk-format").get_text()
|
||||
|
||||
@ -2657,6 +2667,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
cache = disk.driver_cache
|
||||
io = disk.driver_io
|
||||
discard = disk.driver_discard
|
||||
detect_zeroes = disk.driver_detect_zeroes
|
||||
driver_type = disk.driver_type or ""
|
||||
serial = disk.serial
|
||||
|
||||
@ -2700,6 +2711,8 @@ class vmmDetails(vmmGObjectUI):
|
||||
uiutil.set_list_selection(self.widget("disk-cache"), cache)
|
||||
uiutil.set_list_selection(self.widget("disk-io"), io)
|
||||
uiutil.set_list_selection(self.widget("disk-discard"), discard)
|
||||
uiutil.set_list_selection(self.widget("disk-detect-zeroes"),
|
||||
detect_zeroes)
|
||||
|
||||
self.widget("disk-format").set_text(driver_type)
|
||||
self.widget("disk-format-warn").hide()
|
||||
|
@ -676,7 +676,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
def define_disk(self, devobj, do_hotplug,
|
||||
path=_SENTINEL, readonly=_SENTINEL, serial=_SENTINEL,
|
||||
shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL,
|
||||
io=_SENTINEL, discard=_SENTINEL,
|
||||
io=_SENTINEL, discard=_SENTINEL, detect_zeroes=_SENTINEL,
|
||||
driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL,
|
||||
sgio=_SENTINEL):
|
||||
xmlobj = self._make_xmlobj_to_define()
|
||||
@ -728,6 +728,8 @@ class vmmDomain(vmmLibvirtObject):
|
||||
editdev.driver_io = io or None
|
||||
if discard != _SENTINEL:
|
||||
editdev.driver_discard = discard or None
|
||||
if detect_zeroes != _SENTINEL:
|
||||
editdev.driver_detect_zeroes = detect_zeroes or None
|
||||
if driver_type != _SENTINEL:
|
||||
editdev.driver_type = driver_type or None
|
||||
if serial != _SENTINEL:
|
||||
|
@ -117,6 +117,12 @@ class DeviceDisk(Device):
|
||||
DISCARD_MODE_UNMAP = "unmap"
|
||||
discard_types = [DISCARD_MODE_IGNORE, DISCARD_MODE_UNMAP]
|
||||
|
||||
DETECT_ZEROES_OFF = "off"
|
||||
DETECT_ZEROES_ON = "on"
|
||||
DETECT_ZEROES_UNMAP = "unmap"
|
||||
detect_zeroes_types = [DETECT_ZEROES_OFF, DETECT_ZEROES_ON,
|
||||
DETECT_ZEROES_UNMAP]
|
||||
|
||||
DEVICE_DISK = "disk"
|
||||
DEVICE_LUN = "lun"
|
||||
DEVICE_CDROM = "cdrom"
|
||||
|
Loading…
Reference in New Issue
Block a user