On 2013年03月21日 19:53, Paolo Bonzini wrote:
This enables usage of commands like persistent reservations.
Signed-off-by: Paolo Bonzini<pbonzini(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 9 ++++++-
.../qemuxml2argv-disk-drive-network-iscsi-lun.args | 1 +
.../qemuxml2argv-disk-drive-network-iscsi-lun.xml | 28 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 ++++
5 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.xml
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 21bc615..9529265 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -156,6 +156,7 @@ virDomainDiskIoTypeToString;
virDomainDiskPathByName;
virDomainDiskProtocolTransportTypeFromString;
virDomainDiskProtocolTransportTypeToString;
+virDomainDiskProtocolTypeToString;
Not alphabetically sorted.
virDomainDiskRemove;
virDomainDiskRemoveByName;
virDomainDiskTypeFromString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4774650..313db2c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3026,7 +3026,14 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
bus);
goto error;
}
- if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK) {
+ if (disk->protocol != VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk device='lun' is not supported for
protocol='%s'"),
+ virDomainDiskProtocolTypeToString(disk->protocol));
+ goto error;
+ }
+ } else if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk device='lun' is not supported for
type='%s'"),
virDomainDiskTypeToString(disk->type));
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.args
new file mode 100644
index 0000000..baa7760
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214
-smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait
-no-acpi -boot c -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb -drive
file=iscsi://example.org:3260/iqn.1992-01.com.example,if=none,id=drive-scsi0-0-0-0,format=raw
-device
scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.xml
b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi-lun.xml
Long line, better to break.
ACK.