From cf16029b69f50af1bc2e8627af5bc65ffac24992 Mon Sep 17 00:00:00 2001
From: Avishay Traeger <avishay@il.ibm.com>
Date: Wed, 16 Oct 2013 11:14:22 +0300
Subject: [PATCH] Storwize: Fix iogrp availability check

Do not check if vdisk_count is greater than zero to determine iogrp
availability. This is wrong, and leads to the driver not being able to
use empty iogrps.

Change-Id: Ia73189a11cfcc0641c1527293675361c4e78443f
Closes-Bug: #1240395
---
 cinder/tests/test_storwize_svc.py     | 4 ++--
 cinder/volume/drivers/storwize_svc.py | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py
index 15ea19ab7..8cc691553 100644
--- a/cinder/tests/test_storwize_svc.py
+++ b/cinder/tests/test_storwize_svc.py
@@ -742,8 +742,8 @@ port_speed!N/A
     def _cmd_lsiogrp(self, **kwargs):
         rows = [None] * 6
         rows[0] = ['id', 'name', 'node_count', 'vdisk_count', 'host_count']
-        rows[1] = ['0', 'io_grp0', '2', '22', '4']
-        rows[2] = ['1', 'io_grp1', '2', '22', '4']
+        rows[1] = ['0', 'io_grp0', '2', '0', '4']
+        rows[2] = ['1', 'io_grp1', '2', '0', '4']
         rows[3] = ['2', 'io_grp2', '0', '0', '4']
         rows[4] = ['3', 'io_grp3', '0', '0', '4']
         rows[5] = ['4', 'recovery_io_grp', '0', '0', '0']
diff --git a/cinder/volume/drivers/storwize_svc.py b/cinder/volume/drivers/storwize_svc.py
index 51984bcc1..3026504d4 100644
--- a/cinder/volume/drivers/storwize_svc.py
+++ b/cinder/volume/drivers/storwize_svc.py
@@ -245,8 +245,7 @@ class StorwizeSVCDriver(san.SanDriver):
         for iogrp_line in iogrps:
             try:
                 iogrp_data = self._get_hdr_dic(header, iogrp_line, '!')
-                if (int(iogrp_data['node_count']) > 0 and
-                        int(iogrp_data['vdisk_count']) > 0):
+                if int(iogrp_data['node_count']) > 0:
                     self._available_iogrps.append(int(iogrp_data['id']))
             except exception.VolumeBackendAPIException:
                 with excutils.save_and_reraise_exception():
-- 
2.45.2