Signed-off-by: Lin Ma <[email protected]>
---
ui/addhardware.ui | 24 ++++++++++++++++++++++++
virtManager/addhardware.py | 9 +++++++++
2 files changed, 33 insertions(+)
diff --git a/ui/addhardware.ui b/ui/addhardware.ui
index dffcf8c6..b6ac8912 100644
--- a/ui/addhardware.ui
+++ b/ui/addhardware.ui
@@ -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">
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index f2d7a5b0..a5ed44e0 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -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 +
--
2.19.0
_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list