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 c4a8fc987..dcea4c4bf 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -204,6 +204,13 @@
+
+
+
+
+
+
+
diff --git a/tests/clitest.py b/tests/clitest.py
index 961d549fa..5a80242ea 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -597,6 +597,7 @@ vcpus.vcpu1.id=2,vcpus.vcpu1.enabled=yes
--disk /tmp/brand-new.img,size=1,backing_store=/dev/default-pool/iso-vol,boot.order=10,boot.loadparm=5
--disk path=/dev/disk-pool/diskvol7,device=lun,bus=scsi,reservations.managed=no,reservations.source.type=unix,reservations.source.path=/var/run/test/pr-helper0.sock,reservations.source.mode=client,\
source.reservations.managed=no,source.reservations.source.type=unix,source.reservations.source.path=/var/run/test/pr-helper0.sock,source.reservations.source.mode=client
+--disk vol=iscsi-direct/unit:0:0:1
--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,filterref=foobar,rom.bar=off,rom.file=/some/rom,source.portgroup=foo
diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 240dda769..ff93aeea0 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -2060,6 +2060,34 @@ ba
+
+ iscsi-direct
+ 0799697a-94dd-4115-9601-8714b1931248
+ 524287488
+ 524287488
+ 0
+
+
+
+
+
+
+
+
+
+ unit:0:0:1
+ ip-10.66.144.87:3260-iscsi-iqn.2017-12.com.virttest:emulated-iscsi-noauth.target2-lun-1
+
+
+ 1376452096
+ 1376452096
+
+ ip-10.66.144.87:3260-iscsi-iqn.2017-12.com.virttest:emulated-iscsi-noauth.target2-lun-1
+
+
+
+
+
rbd-ceph
4bcd023e-990e-fcf6-d95c-52dd0cd938c8
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index e74694b3d..128b4abd4 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -458,9 +458,12 @@ class DeviceDisk(Device):
self.source_name = self.source_name[1:]
def _set_source_network_from_storage(self, volxml, poolxml):
- self.source_protocol = poolxml.type
- logging.debug("disk.set_vol_object: poolxml=\n%s",
- dir(poolxml))
+ is_iscsi_direct = poolxml.type == "iscsi-direct"
+ protocol = poolxml.type
+ if is_iscsi_direct:
+ protocol = "iscsi"
+
+ self.source_protocol = protocol
if poolxml.auth_type:
self.auth_username = poolxml.auth_username
self.auth_secret_type = poolxml.auth_type
@@ -474,14 +477,22 @@ class DeviceDisk(Device):
obj.port = host.port
path = ""
- if poolxml.source_name:
- path += poolxml.source_name
- if poolxml.source_path:
- path += poolxml.source_path
- if not path.endswith('/'):
- path += "/"
- path += volxml.name
- self.source_name = path
+ if is_iscsi_direct:
+ # Vol path is like this:
+ # ip-10.66.144.87:3260-iscsi-iqn.2017-12.com.virttest:emulated-iscsi-noauth.target2-lun-1
+ # Always seems to have -iscsi- embedded in it
+ if "-iscsi-iqn." in volxml.target_path:
+ path = volxml.target_path.split("-iscsi-", 1)[-1]
+ else:
+ if poolxml.source_name:
+ path += poolxml.source_name
+ if poolxml.source_path:
+ path += poolxml.source_path
+ if not path.endswith('/'):
+ path += "/"
+ path += volxml.name
+ self.source_name = path or None
+
self.type = "network"
def _set_network_source_from_backend(self):