diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index b1c3bfca3e..7601aaaf54 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1601,7 +1601,16 @@
pool and volume. Attribute pool
specifies the name of storage pool (managed by libvirt) where the disk
source resides, and attribute volume specifies the name of
- storage volume (managed by libvirt) used as the disk source.
+ storage volume (managed by libvirt) used as the disk source. For a
+ "volume" type disk, if the underlying storage pool is "iscsi", attribute
+ mode (since 1.1.1) can be used
+ to indicate how to represent the LUN as the disk source. The value
+ "host" indicates to use the LUN's path as it shows up on host, e.g.
+ /dev/disk/by-path/ip-10.11.12.9:3260-iscsi-iqn.2013-06.fc:iscsi.iscsi0-lun-1).
+ The value "direct" indicates to use the storage pool's
+ source element host attribute as the
+ disk source for the libiscsi URI, e.g.
+ file=iscsi://demo.org:6000/iqn.1992-01.com.example/1.
Since 0.0.3; type='dir' since
0.7.5; type='network' since
0.8.7; protocol='iscsi' since 1.0.4;
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7a6852b377..745b959a8f 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1173,6 +1173,14 @@
+
+
+
+ host
+ direct
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 308a96beef..297553c23a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -761,6 +761,11 @@ VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST,
"default",
"unmap",
"ignore")
+VIR_ENUM_IMPL(virDomainDiskSourcePoolMode,
+ VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST,
+ "default",
+ "host",
+ "direct")
#define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE
#define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE
@@ -4645,10 +4650,12 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
{
char *pool = NULL;
char *volume = NULL;
+ char *mode = NULL;
int ret = -1;
pool = virXMLPropString(node, "pool");
volume = virXMLPropString(node, "volume");
+ mode = virXMLPropString(node, "mode");
/* CD-ROM and Floppy allows no source */
if (!pool && !volume)
@@ -4664,6 +4671,14 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
if (VIR_ALLOC(def->srcpool) < 0)
goto cleanup;
+ if (mode && (def->srcpool->mode =
+ virDomainDiskSourcePoolModeTypeFromString(mode)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("unknown source mode '%s' for volume type disk"),
+ mode);
+ goto cleanup;
+ }
+
def->srcpool->pool = pool;
pool = NULL;
def->srcpool->volume = volume;
@@ -4674,6 +4689,7 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
cleanup:
VIR_FREE(pool);
VIR_FREE(volume);
+ VIR_FREE(mode);
return ret;
}
@@ -14157,9 +14173,13 @@ virDomainDiskSourceDefFormat(virBufferPtr buf,
case VIR_DOMAIN_DISK_TYPE_VOLUME:
virBufferAddLit(buf, "