Fix calling delete_zones method with a wrong argument

Add a new zone with cisco zonemanager driver. If the added zone
name is the same as the existed name, the function delete_zones
will be called. But it fails because of passing a argument with
incorrect type. This patch fixes this error.

Co-Authored-By: Al Lau <alau2@cisco.com>
Closes-Bug: #1496283
Change-Id: Ib340b6828cfeb2bb318db23971268c7974ecc9f6
This commit is contained in:
chenying
2015-09-02 17:48:59 +08:00
parent 99dc6d3475
commit 2ce285ecfb
2 changed files with 11 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ active_zoneset_multiple_zones = {
'zones': {
'openstack50060b0000c26604201900051ee8e329':
['50:06:0b:00:00:c2:66:04', '20:19:00:05:1e:e8:e3:29'],
'openstack50060b0000c26602201900051ee8e327':
'openstack10000012345678902001009876543210':
['50:06:0b:00:00:c2:66:02', '20:19:00:05:1e:e8:e3:27']},
'active_zone_config': 'OpenStack_Cfg'}
@@ -234,6 +234,15 @@ class TestCiscoFCZoneClientCLI(cli.CiscoFCZoneClientCLI, test.TestCase):
self.assertEqual(nsshow_list, switch_data)
run_ssh_mock.assert_called_once_with(cmd_list, True)
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_ssh_execute')
@mock.patch.object(cli.CiscoFCZoneClientCLI, '_cfg_save')
def test__add_zones_with_update(self, ssh_execute_mock, cfg_save_mock):
self.add_zones(new_zone, False, self.fabric_vsan,
active_zoneset_multiple_zones,
zoning_status_basic)
self.assertEqual(2, ssh_execute_mock.call_count)
self.assertEqual(2, cfg_save_mock.call_count)
def test__parse_ns_output(self):
return_wwn_list = []
expected_wwn_list = ['20:1a:00:05:1e:e8:e3:29']

View File

@@ -169,7 +169,7 @@ class CiscoFCZoneClientCLI(object):
if current_zone != new_zone:
try:
self.delete_zones([zone], activate, fabric_vsan,
self.delete_zones(zone, activate, fabric_vsan,
active_zone_set, zone_status)
except exception.CiscoZoningCliException:
with excutils.save_and_reraise_exception():