Fixes hyper-v volume attach when host is AD member

The domain name gets added to the initiator name used by the host
if it's an Active Directory member.

Currently the method which gets the initiator name does not take
this into account when retrieving the default initiator name.

Trying to use a wrong initiator name will lead to an exception when
trying to log in to the according iSCSI target.

This patch simply appends the domain name (when the host is an AD
member) to the initiator name used to log in to iSCSI targets.

Closes-Bug: #1328870
(cherry-picked from commit 0a7527c712)

Change-Id: Ifbe762c685e46081059a01043431b2c4ac5473fc
This commit is contained in:
Lucian Petrut 2014-06-11 16:24:06 +03:00 committed by Zsolt Dudás
parent 8bc955375c
commit 0d9419f2b3
1 changed files with 2 additions and 1 deletions

View File

@ -70,8 +70,9 @@ class BaseVolumeUtils(object):
except Exception:
LOG.info(_("The ISCSI initiator name can't be found. "
"Choosing the default one"))
computer_system = self._conn_cimv2.Win32_ComputerSystem()[0]
initiator_name = "iqn.1991-05.com.microsoft:" + hostname.lower()
if computer_system.PartofDomain:
initiator_name += '.' + computer_system.Domain.lower()
return initiator_name
def volume_in_mapping(self, mount_device, block_device_info):