From e12fdf5be2d0ca383ba4d9b62ca13425aed6bca7 Mon Sep 17 00:00:00 2001
From: TaoBai <baitaosh@cn.ibm.com>
Date: Fri, 17 Apr 2015 02:29:53 -0700
Subject: [PATCH] Storwize driver should only report active wwpn port

Current code will report both active and inactive wwpn port which
will cause connection failure.We should only report active port.

Closes-bug: #1445409

Change-Id: Ide74df778294bfec50fbedd2ac3cd9207201b187
---
 cinder/tests/test_storwize_svc.py                 | 6 ++----
 cinder/volume/drivers/ibm/storwize_svc/helpers.py | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py
index 11bfaa595..9392d6589 100644
--- a/cinder/tests/test_storwize_svc.py
+++ b/cinder/tests/test_storwize_svc.py
@@ -3458,12 +3458,10 @@ class StorwizeSVCDriverTestCase(test.TestCase):
                      'data': {'initiator_target_map':
                               {'ff00000000000000': ['500507680220C744',
                                                     '500507680210C744',
-                                                    '500507680220C745',
-                                                    '500507680230C745'],
+                                                    '500507680220C745'],
                                'ff00000000000001': ['500507680220C744',
                                                     '500507680210C744',
-                                                    '500507680220C745',
-                                                    '500507680230C745']},
+                                                    '500507680220C745']},
                               'target_discovered': False,
                               'target_lun': 0,
                               'target_wwn': '500507680220C744',
diff --git a/cinder/volume/drivers/ibm/storwize_svc/helpers.py b/cinder/volume/drivers/ibm/storwize_svc/helpers.py
index 9f451f8c1..4d65376ab 100644
--- a/cinder/volume/drivers/ibm/storwize_svc/helpers.py
+++ b/cinder/volume/drivers/ibm/storwize_svc/helpers.py
@@ -153,7 +153,7 @@ class StorwizeHelpers(object):
             resp = self.ssh.lsnode(node_id=node['id'])
             wwpns = set(node['WWPN'])
             for i, s in resp.select('port_id', 'port_status'):
-                if 'unconfigured' != s:
+                if 'active' == s:
                     wwpns.add(i)
             node['WWPN'] = list(wwpns)
             LOG.info(_LI('WWPN on node %(node)s: %(wwpn)s')
-- 
2.45.2