diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5887939bd0..34664f7903 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2733,6 +2733,17 @@
</source>
<target dev='sdb' bus='scsi'/>
</disk>
+ </disk>
+ <disk type='network' device='lun'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'>
+ <host name='example.com' port='3260'/>
+ <initiator>
+ <iqn name='iqn.2013-07.com.example:client'/>
+ </initiator>
+ </source>
+ <target dev='sdb' bus='scsi'/>
+ </disk>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw'/>
<source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
@@ -3090,6 +3101,15 @@
It's recommended to allow libvirt manage the persistent
reservations.
+
initiator
+ Since libvirt 4.7.0, the
+ initiator
element is supported for a disk
+ type
"network" that is using a source
+ element with the protocol
attribute "iscsi".
+ If present, the initiator
element provides the
+ initiator IQN needed to access the source via mandatory
+ attribute name
.
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ac04af51a1..1a786968cc 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1699,6 +1699,9 @@
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b6035d45ab..8fd774b531 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8853,6 +8853,8 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
virStorageSourceNetworkAssignDefaultPorts(src);
+ virStorageSourceInitiatorParseXML(ctxt, &src->initiator);
+
ret = 0;
cleanup:
@@ -23568,6 +23570,8 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virBufferEscapeString(childBuf, "\n", src->snapshot);
virBufferEscapeString(childBuf, "\n", src->configFile);
+ virStorageSourceInitiatorFormatXML(&src->initiator, childBuf);
+
return 0;
}
@@ -30194,6 +30198,12 @@ virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def,
if (virDomainDiskAddISCSIPoolSourceHost(def, pooldef) < 0)
return -1;
+ if (!def->src->initiator.iqn && pooldef->source.initiator.iqn &&
+ virStorageSourceInitiatorCopy(&def->src->initiator,
+ &pooldef->source.initiator) < 0) {
+ return -1;
+ }
+
return 0;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index fb79ceddd0..6939d0d6c9 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2272,6 +2272,9 @@ virStorageSourceCopy(const virStorageSource *src,
!(ret->pr = virStoragePRDefCopy(src->pr)))
goto error;
+ if (virStorageSourceInitiatorCopy(&ret->initiator, &src->initiator))
+ goto error;
+
if (backingChain && src->backingStore) {
if (!(ret->backingStore = virStorageSourceCopy(src->backingStore,
true)))
@@ -2503,6 +2506,8 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->tlsAlias);
VIR_FREE(def->tlsCertdir);
+ virStorageSourceInitiatorClear(&def->initiator);
+
memset(def, 0, sizeof(*def));
}
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index b6013431cc..3ff6c4f900 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -261,6 +261,8 @@ struct _virStorageSource {
bool encryptionInherited;
virStoragePRDefPtr pr;
+ virStorageSourceInitiatorDef initiator;
+
virObjectPtr privateData;
int format; /* virStorageFileFormat in domain backing chains, but