addhardware: Add SCSI persistent reservation support for LUN Passthrough

Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
Lin Ma 2018-10-10 17:50:35 +08:00 committed by Cole Robinson
parent 280b78c96a
commit 3c44ea8810
2 changed files with 33 additions and 0 deletions

View File

@ -328,6 +328,30 @@
<property name="top_attach">3</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>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
</object>
</child>
<child type="label">

View File

@ -849,6 +849,11 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("storage-devtype"))
self._refresh_disk_bus(devtype)
# Reset the status of disk-pr-checkbox to inactive
self.widget("disk-pr-checkbox").set_active(False)
is_lun = devtype == "lun"
uiutil.set_grid_row_visible(self.widget("disk-pr-checkbox"), is_lun)
allow_create = devtype not in ["cdrom", "floppy"]
self.addstorage.widget("storage-create-box").set_sensitive(
allow_create)
@ -1202,6 +1207,8 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("storage-discard"))
detect_zeroes = uiutil.get_list_selection(
self.widget("storage-detect-zeroes"))
if device == "lun":
reservations_managed = self.widget("disk-pr-checkbox").get_active()
controller_model = None
if (bus == "scsi" and
@ -1232,6 +1239,8 @@ class vmmAddHardware(vmmGObjectUI):
disk.driver_discard = discard
if detect_zeroes:
disk.driver_detect_zeroes = detect_zeroes
if device == "lun" and reservations_managed:
disk.reservations_managed = "yes"
# Generate target
disks = (self.vm.xmlobj.devices.disk +