Non-WAN port filter issue in Kaminario iSCSI driver

To attach Kaminario iSCSI volume to a nova instance, we search
K2 API "system/net_ips" with filter wan_port="". But it is not able to
filter non-WAN ports.

Change-Id: If58cf5b9bdc13f72313aba68e54af6ec2f907703
Closes-Bug: #1646692
Co-Authored-By: Lakshman<Lakshmi.Narayana.ctr@kaminario.com>
Co-Authored-By: Ido Benda<Ido.Benda@kaminario.com>
This commit is contained in:
Nikesh Mahalka 2016-12-02 01:43:42 -05:00 committed by nikesh
parent 8e5912cb51
commit e8fb59908b
3 changed files with 10 additions and 2 deletions

View File

@ -60,6 +60,7 @@ class FakeSaveObject(FakeK2Obj):
self.current_role = 'target'
self.current_snapshot_progress = 100
self.current_snapshot_id = None
self.wan_port = None
def refresh(self):
return

View File

@ -93,10 +93,13 @@ class KaminarioISCSIDriver(common.KaminarioCinderDriver):
def get_target_info(self, volume):
LOG.debug("Searching first iscsi port ip without wan in K2.")
iscsi_ip_rs = self.client.search("system/net_ips", wan_port="")
iscsi_ip_rs = self.client.search("system/net_ips")
iscsi_ip = target_iqn = None
if hasattr(iscsi_ip_rs, 'hits') and iscsi_ip_rs.total != 0:
iscsi_ip = iscsi_ip_rs.hits[0].ip_address
for ip in iscsi_ip_rs.hits:
if not ip.wan_port:
iscsi_ip = ip.ip_address
break
if not iscsi_ip:
msg = _("Unable to get ISCSI IP address from K2.")
LOG.error(msg)

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed Non-WAN port filter issue in Kaminario iSCSI driver