1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

conf: Remove source host name check for iSCSI

https://bugzilla.redhat.com/show_bug.cgi?id=1171984
https://bugzilla.redhat.com/show_bug.cgi?id=1188463

Remove the check for the source host name for iSCSI source XML processing
declaring duplicate sources when the source device path and if present the
initiator of a proposed storage pool matches an existing storage pool.

The backend iSCSI storage driver uses 'iscsiadm --mode session' to query
available iscsid target sessions. The output displayed is the IP address
and the IQN (target path) of known targets. The displayed IP address
is a resolved address based on the session --login. Additionally, iscsid
keeps track of the various ways to define the host name (IPv4 Address,
IPv6 Address, /etc/hosts, etc.) for that IQN (see output of an 'iscsiadm
--mode node'). If an incoming IQN matches and the host name provided by
libvirt is resolved to the existing IQN, then iscsid will "reuse" the
session. Although libvirt could do the same name resolution, if there
is a difference, iscsid could still declare two seemingly different sources
to be the same and not create a new session which means libvirt now has
two storage pools looking at the same source. Thus to avoid any strange
host name resolution issues, just rely on iscsid for that and do not
allow multiple pools on the same host to use the same device path (IQN).
This commit is contained in:
John Ferlan 2015-05-11 13:51:04 -04:00
parent 6dd9297c88
commit 4b2b53f674
3 changed files with 22 additions and 8 deletions

View File

@ -78,7 +78,7 @@
...
<source>
<host name="iscsi.example.com"/>
<device path="demo-target"/>
<device path="iqn.2013-06.com.example:iscsi-pool"/>
<auth type='chap' username='myname'>
<secret usage='mycluster_myname'/>
</auth>
@ -118,8 +118,10 @@
(pool types <code>fs</code>, <code>logical</code>, <code>disk</code>,
<code>iscsi</code>, <code>zfs</code>).
May be repeated multiple times depending on backend driver. Contains
a single attribute <code>path</code> which is the fully qualified
path to the block device node. <span class="since">Since 0.4.1</span></dd>
a single attribute <code>path</code> which is either the fully
qualified path to the block device node or for <code>iscsi</code>
the iSCSI Qualified Name (IQN).
<span class="since">Since 0.4.1</span></dd>
<dt><code>dir</code></dt>
<dd>Provides the source for pools backed by directories (pool
type <code>dir</code>), or optionally to select a subdirectory
@ -292,7 +294,15 @@
or <code>device</code> element. Contains an attribute <code>name</code>
which is the hostname or IP address of the server. May optionally
contain a <code>port</code> attribute for the protocol specific
port number. <span class="since">Since 0.4.1</span></dd>
port number. Duplicate storage pool definition checks may perform
a cursory check that the same host name by string comparison in the
new pool does not match an existing pool's source host name when
combined with the <code>directory</code> or <code>device</code>
element. Name resolution of the provided hostname or IP address
is left to the storage driver backend interactions with the remote
server. See the <a href="storage.html">storage driver page</a> for
any restrictions for specific storage backends.
<span class="since">Since 0.4.1</span></dd>
<dt><code>auth</code></dt>
<dd>If present, the <code>auth</code> element provides the
authentication credentials needed to access the source by the

View File

@ -439,6 +439,12 @@
to use <code>/dev/disk/by-path</code> or <code>/dev/disk/by-id</code>
for the target path. These provide persistent stable naming for LUNs
</p>
<p>
The libvirt iSCSI storage backend does not resolve the provided
host name or IP address when finding the available target IQN's
on the host; therefore, defining two pools to use the same IQN
on the same host will fail the duplicate source pool checks.
</p>
<h3>Example pool input</h3>
<pre>
@ -446,7 +452,7 @@
&lt;name&gt;virtimages&lt;/name&gt;
&lt;source&gt;
&lt;host name="iscsi.example.com"/&gt;
&lt;device path="demo-target"/&gt;
&lt;device path="iqn.2013-06.com.example:iscsi-pool"/&gt;
&lt;/source&gt;
&lt;target&gt;
&lt;path&gt;/dev/disk/by-path&lt;/path&gt;

View File

@ -2427,9 +2427,7 @@ virStoragePoolSourceISCSIMatch(virStoragePoolObjPtr matchpool,
virStoragePoolSourcePtr poolsrc = &matchpool->def->source;
virStoragePoolSourcePtr defsrc = &def->source;
if (!virStoragePoolSourceMatchSingleHost(poolsrc, defsrc))
return false;
/* NB: Do not check the source host name */
if (STRNEQ_NULLABLE(poolsrc->initiator.iqn, defsrc->initiator.iqn))
return false;