[virt-tools-list] [virt-manager PATCH v2 1/3] cli: disk: Add options to support SCSI persistent reservation
Lin Ma
lma at suse.com
Wed Oct 10 09:50:33 UTC 2018
Create the managed or the unmanaged PR object to enable SCSI persistent
reservation for LUN Passthrough
Signed-off-by: Lin Ma <lma at suse.com>
---
tests/cli-test-xml/compare/virt-install-many-devices.xml | 9 +++++++++
tests/clitest.py | 1 +
virtinst/cli.py | 5 +++++
virtinst/devices/disk.py | 5 +++++
4 files changed, 20 insertions(+)
diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 25070b1b..20071439 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -160,6 +160,15 @@
<source file="/tmp/brand-new.img"/>
<target dev="vdn" bus="virtio"/>
</disk>
+ <disk type="block" device="lun">
+ <driver name="qemu" type="raw"/>
+ <source dev="/dev/sda">
+ <reservations managed="no">
+ <source type="unix" path="/var/run/test/pr-helper0.sock" mode="client"/>
+ </reservations>
+ </source>
+ <target dev="sdd" bus="scsi"/>
+ </disk>
<controller type="usb" index="0" model="ich9-ehci1">
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
</controller>
diff --git a/tests/clitest.py b/tests/clitest.py
index e995ef87..89aa74d1 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -437,6 +437,7 @@ c.add_compare(""" \
--disk /var,device=floppy,address.type=ccw,address.cssid=0xfe,address.ssid=0,address.devno=01 \
--disk %(NEWIMG2)s,size=1,backing_store=/tmp/foo.img,backing_format=vmdk \
--disk /tmp/brand-new.img,size=1,backing_store=/dev/default-pool/iso-vol \
+--disk path=/dev/sda,device=lun,bus=scsi,reservations.managed=no,reservations.source.type=unix,reservations.source.path=/var/run/test/pr-helper0.sock,reservations.source.mode=client \
\
--network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo \
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 346b99f6..a8dfc8ac 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2115,6 +2115,11 @@ ParserDisk.add_arg("geometry_heads", "geometry.heads")
ParserDisk.add_arg("geometry_secs", "geometry.secs")
ParserDisk.add_arg("geometry_trans", "geometry.trans")
+ParserDisk.add_arg("reservations_managed", "reservations.managed")
+ParserDisk.add_arg("reservations_source_type", "reservations.source.type")
+ParserDisk.add_arg("reservations_source_path", "reservations.source.path")
+ParserDisk.add_arg("reservations_source_mode", "reservations.source.mode")
+
#####################
# --network parsing #
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index 75a31f46..b925817b 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -835,6 +835,11 @@ class DeviceDisk(Device):
geometry_secs = XMLProperty("./geometry/@secs", is_int=True)
geometry_trans = XMLProperty("./geometry/@trans")
+ reservations_managed = XMLProperty("./source/reservations/@managed")
+ reservations_source_type = XMLProperty("./source/reservations/source/@type")
+ reservations_source_path = XMLProperty("./source/reservations/source/@path")
+ reservations_source_mode = XMLProperty("./source/reservations/source/@mode")
+
#################################
# Validation assistance methods #
--
2.19.0
More information about the virt-tools-list
mailing list