mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
addstorage: Revive disk serial UI
coreos is going to start using disk serial for ignition disk, so setting this in the UI for distro testing will become more common Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
c54da68535
commit
d073ee9a48
@ -150,6 +150,7 @@ class AddHardware(uiutils.UITestCase):
|
||||
tab.find("Advanced options", "toggle button").click_expander()
|
||||
tab.find("Shareable:", "check box").click()
|
||||
tab.find("Readonly:", "check box").click()
|
||||
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")
|
||||
|
@ -369,6 +369,7 @@ class Details(uiutils.UITestCase):
|
||||
tab.find("Advanced options", "toggle button").click_expander()
|
||||
tab.find("Shareable:", "check box").click()
|
||||
tab.find("Readonly:", "check box").click()
|
||||
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")
|
||||
|
@ -249,8 +249,8 @@
|
||||
<object class="GtkGrid" id="table19">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">3</property>
|
||||
<property name="column_spacing">8</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
@ -262,7 +262,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -279,7 +279,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -293,7 +293,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -310,7 +310,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -324,7 +324,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -341,7 +341,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -419,7 +419,6 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_disk_removable_changed" swapped="no"/>
|
||||
</object>
|
||||
@ -428,6 +427,31 @@
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Seria_l:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">disk-serial</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="disk-serial">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_disk_serial_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
|
@ -20,7 +20,8 @@ from ..baseclass import vmmGObjectUI
|
||||
_EDIT_RO,
|
||||
_EDIT_SHARE,
|
||||
_EDIT_REMOVABLE,
|
||||
) = range(1, 7)
|
||||
_EDIT_SERIAL,
|
||||
) = range(1, 8)
|
||||
|
||||
|
||||
class vmmAddStorage(vmmGObjectUI):
|
||||
@ -49,6 +50,7 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
"on_disk_readonly_changed": _e(_EDIT_RO),
|
||||
"on_disk_shareable_changed": _e(_EDIT_SHARE),
|
||||
"on_disk_removable_changed": _e(_EDIT_REMOVABLE),
|
||||
"on_disk_serial_changed": _e(_EDIT_SERIAL),
|
||||
})
|
||||
|
||||
self._active_edits = []
|
||||
@ -176,6 +178,7 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
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)
|
||||
self.widget("disk-shareable").set_active(False)
|
||||
@ -237,6 +240,8 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
disk.read_only = vals.get("readonly")
|
||||
if vals.get("shareable") is not None:
|
||||
disk.shareable = vals.get("shareable")
|
||||
if vals.get("serial") is not None:
|
||||
disk.serial = vals.get("serial")
|
||||
|
||||
if disk.wants_storage_creation():
|
||||
pool = disk.get_parent_pool()
|
||||
@ -290,6 +295,7 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
ro = disk.read_only
|
||||
share = disk.shareable
|
||||
removable = disk.removable
|
||||
serial = disk.serial
|
||||
|
||||
is_usb = (disk.bus == "usb")
|
||||
can_set_removable = (is_usb and (self.conn.is_qemu() or
|
||||
@ -304,6 +310,7 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
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)
|
||||
self.widget("disk-readonly").set_sensitive(not disk.is_cdrom())
|
||||
self.widget("disk-shareable").set_active(share)
|
||||
@ -334,6 +341,8 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
if _EDIT_REMOVABLE in self._active_edits:
|
||||
ret["removable"] = bool(
|
||||
self.widget("disk-removable").get_active())
|
||||
if _EDIT_SERIAL in self._active_edits:
|
||||
ret["serial"] = self.widget("disk-serial").get_text()
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -726,7 +726,8 @@ class vmmDomain(vmmLibvirtObject):
|
||||
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, detect_zeroes=_SENTINEL, bus=_SENTINEL,
|
||||
serial=_SENTINEL):
|
||||
xmlobj = self._make_xmlobj_to_define()
|
||||
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
|
||||
if not editdev:
|
||||
@ -744,6 +745,8 @@ class vmmDomain(vmmLibvirtObject):
|
||||
if removable != _SENTINEL:
|
||||
editdev.removable = removable
|
||||
|
||||
if serial != _SENTINEL:
|
||||
editdev.serial = serial or None
|
||||
if cache != _SENTINEL:
|
||||
editdev.driver_cache = cache or None
|
||||
if discard != _SENTINEL:
|
||||
|
Loading…
Reference in New Issue
Block a user