yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #38978
[Bug 1429581] Re: [VMware] Failed to attach volume due to wrong host iqn
** Changed in: nova
Status: Fix Committed => Fix Released
** Changed in: nova
Milestone: None => liberty-rc1
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1429581
Title:
[VMware] Failed to attach volume due to wrong host iqn
Status in OpenStack Compute (nova):
Fix Released
Bug description:
Attaching iSCSI volumes for VMware, using the following steps:
1.Nova gets volume connector information(get_volume_connector), such as ESX iqn;
2.Calling the cinder-volume initialize_connection, and will register the iqn of the ESX to the iSCSI server.It returns the connection information in the final, such as the iSCSI target;
3.Nova attaches the volume to the VM with the connection_info.
I try to attach an iSCSI volume to an instance, but it's failed in the 3rd step(unable to attach the volume to the VM).
After analyzing the logs, I found the reason for it is the iqn 1th step returning was wrong.
My environment:
My vcenter cluster has two host: ESX-1 and ESX-2, and an instance(VM-2) on the host ESX-2.
I try to attach an iSCSI volume to VM-2, I have found that it returns the iqn of ESX-1 while calling method get_volume_connector, I think it should return the iqn of the host running the VM (that is, ESX-2 iqn), rather than first host iqn, But it always returns the first ESX iqn, as in the following code.
vmwareapi/volumeutils.py:
def get_volume_connector(self, instance):
"""Return volume connector information."""
try:
vm_ref = vm_util.get_vm_ref(self._session, instance)
except exception.InstanceNotFound:
vm_ref = None
iqn = self._iscsi_get_host_iqn()
connector = {'ip': CONF.vmware.host_ip,
'initiator': iqn,
'host': CONF.vmware.host_ip}
if vm_ref:
connector['instance'] = vm_ref.value
return connector
def _iscsi_get_host_iqn(self):
"""Return the host iSCSI IQN."""
host_mor = vm_util.get_host_ref(self._session, self._cluster)
hbas_ret = self._session._call_method(
vim_util, "get_dynamic_property",
host_mor, "HostSystem",
"config.storageDevice.hostBusAdapter")
# Meaning there are no host bus adapters on the host
if hbas_ret is None:
return
host_hbas = hbas_ret.HostHostBusAdapter
if not host_hbas:
return
for hba in host_hbas:
if hba.__class__.__name__ == 'HostInternetScsiHba':
return hba.iScsiName
vmwareapi/vm_util.py:
def get_host_ref(session, cluster=None):
"""Get reference to a host within the cluster specified."""
if cluster is None:
results = session._call_method(vim_util, "get_objects",
"HostSystem")
_cancel_retrieve_if_necessary(session, results)
host_mor = results.objects[0].obj
else:
host_ret = session._call_method(vim_util, "get_dynamic_property",
cluster, "ClusterComputeResource",
"host")
if not host_ret or not host_ret.ManagedObjectReference:
msg = _('No host available on cluster')
raise exception.NoValidHost(reason=msg)
host_mor = host_ret.ManagedObjectReference[0]
return host_mor
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1429581/+subscriptions
References