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). Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- docs/formatstorage.html.in | 18 ++++++++++++++---- docs/storage.html.in | 8 +++++++- src/conf/storage_conf.c | 4 +--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in index 479e73c..474abd6 100644 --- a/docs/formatstorage.html.in +++ b/docs/formatstorage.html.in @@ -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 diff --git a/docs/storage.html.in b/docs/storage.html.in index b9b503d..92e9ae7 100644 --- a/docs/storage.html.in +++ b/docs/storage.html.in @@ -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 @@ <name>virtimages</name> <source> <host name="iscsi.example.com"/> - <device path="demo-target"/> + <device path="iqn.2013-06.com.example:iscsi-pool"/> </source> <target> <path>/dev/disk/by-path</path> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 61365b9..65b2704 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -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; -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list