It's a common requirement for VMs to send SCSI PR commands in VM cluster environment. This patch adds the managed mode support of scsi persistent reservation in details page. Signed-off-by: Lin Ma <lma@xxxxxxxx> --- ui/details.ui | 25 +++++++++++++++++++++++++ virtManager/details.py | 10 +++++++++- virtManager/domain.py | 5 ++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index 6e3ec558..c18070c8 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -3647,6 +3647,31 @@ <property name="top_attach">2</property> </packing> </child> + <child> + <object class="GtkLabel" id="disk-pr-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="label" translatable="yes">Persistent _Reservations:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">disk-pr-checkbox</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="disk-pr-checkbox"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <signal name="toggled" handler="on_disk_pr_checkbox_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> diff --git a/virtManager/details.py b/virtManager/details.py index cc054e43..4640a9fb 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -66,6 +66,7 @@ from .storagebrowse import vmmStorageBrowser EDIT_DISK_FORMAT, EDIT_DISK_SGIO, EDIT_DISK_PATH, + EDIT_DISK_PR, EDIT_SOUND_MODEL, @@ -100,7 +101,7 @@ from .storagebrowse import vmmStorageBrowser EDIT_FS, - EDIT_HOSTDEV_ROMBAR) = range(1, 55) + EDIT_HOSTDEV_ROMBAR) = range(1, 56) # Columns in hw list model @@ -560,6 +561,7 @@ class vmmDetails(vmmGObjectUI): "on_disk_format_changed": self.disk_format_changed, "on_disk_serial_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SERIAL), "on_disk_sgio_entry_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SGIO), + "on_disk_pr_checkbox_toggled": lambda *x: self.enable_apply(x, EDIT_DISK_PR), "on_network_model_combo_changed": lambda *x: self.enable_apply(x, EDIT_NET_MODEL), "on_network_mac_entry_changed": lambda *x: self.enable_apply(x, @@ -2150,6 +2152,9 @@ class vmmDetails(vmmGObjectUI): sgio = uiutil.get_list_selection(self.widget("disk-sgio")) kwargs["sgio"] = sgio + if self.edited(EDIT_DISK_PR): + kwargs["managed_pr"] = self.widget("disk-pr-checkbox").get_active() + if self.edited(EDIT_DISK_BUS): bus = uiutil.get_list_selection(self.widget("disk-bus")) addr = None @@ -2692,9 +2697,12 @@ class vmmDetails(vmmGObjectUI): is_lun = disk.device == virtinst.DeviceDisk.DEVICE_LUN uiutil.set_grid_row_visible(self.widget("disk-sgio"), is_lun) + uiutil.set_grid_row_visible(self.widget("disk-pr-checkbox"), is_lun) if is_lun: self.build_disk_sgio(self.vm, self.widget("disk-sgio")) uiutil.set_list_selection(self.widget("disk-sgio"), disk.sgio) + managed = disk.reservations_managed == "yes" + self.widget("disk-pr-checkbox").set_active(managed) self.widget("disk-size").set_text(size) uiutil.set_list_selection(self.widget("disk-cache"), cache) diff --git a/virtManager/domain.py b/virtManager/domain.py index 45916ed8..c5d33b25 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -681,7 +681,7 @@ class vmmDomain(vmmLibvirtObject): shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL, io=_SENTINEL, discard=_SENTINEL, detect_zeroes=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL, - sgio=_SENTINEL): + sgio=_SENTINEL, managed_pr=_SENTINEL): xmlobj = self._make_xmlobj_to_define() editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) if not editdev: @@ -741,6 +741,9 @@ class vmmDomain(vmmLibvirtObject): if sgio != _SENTINEL: editdev.sgio = sgio or None + if managed_pr != _SENTINEL: + editdev.reservations_managed = "yes" if managed_pr else None + if bus != _SENTINEL: _change_bus() -- 2.19.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list