提交 9ea3fdc6 编写于 作者: P Pavel Hrdina

conf: introduce initiator IQN support for domain disks

Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 be16f170
......@@ -2733,6 +2733,17 @@
&lt;/source&gt;
&lt;target dev='sdb' bus='scsi'/&gt;
&lt;/disk&gt;
&lt;/disk&gt;
&lt;disk type='network' device='lun'&gt;
&lt;driver name='qemu' type='raw'/&gt;
&lt;source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'&gt;
&lt;host name='example.com' port='3260'/&gt;
&lt;initiator&gt;
&lt;iqn name='iqn.2013-07.com.example:client'/&gt;
&lt;/initiator&gt;
&lt;/source&gt;
&lt;target dev='sdb' bus='scsi'/&gt;
&lt;/disk&gt;
&lt;disk type='volume' device='disk'&gt;
&lt;driver name='qemu' type='raw'/&gt;
&lt;source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/&gt;
......@@ -3090,6 +3101,15 @@
It's recommended to allow libvirt manage the persistent
reservations.
</dd>
<dt><code>initiator</code></dt>
<dd><span class="since">Since libvirt 4.7.0</span>, the
<code>initiator</code> element is supported for a disk
<code>type</code> "network" that is using a <code>source</code>
element with the <code>protocol</code> attribute "iscsi".
If present, the <code>initiator</code> element provides the
initiator IQN needed to access the source via mandatory
attribute <code>name</code>.
</dd>
</dl>
<p>
......
......@@ -1699,6 +1699,9 @@
<optional>
<ref name="encryption"/>
</optional>
<optional>
<ref name="initiatorinfo"/>
</optional>
</element>
</define>
......
......@@ -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, "<snapshot name='%s'/>\n", src->snapshot);
virBufferEscapeString(childBuf, "<config file='%s'/>\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;
}
......
......@@ -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));
}
......
......@@ -261,6 +261,8 @@ struct _virStorageSource {
bool encryptionInherited;
virStoragePRDefPtr pr;
virStorageSourceInitiatorDef initiator;
virObjectPtr privateData;
int format; /* virStorageFileFormat in domain backing chains, but
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册