From 2ce285ecfb261c09e1b93de85b8e5415c2cb56fe Mon Sep 17 00:00:00 2001 From: chenying Date: Wed, 2 Sep 2015 17:48:59 +0800 Subject: [PATCH] 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 Closes-Bug: #1496283 Change-Id: Ib340b6828cfeb2bb318db23971268c7974ecc9f6 --- .../unit/zonemanager/test_cisco_fc_zone_client_cli.py | 11 ++++++++++- .../drivers/cisco/cisco_fc_zone_client_cli.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py b/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py index 57ca8e40b..60b2421cb 100644 --- a/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py +++ b/cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py @@ -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'] diff --git a/cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py b/cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py index 4cdbda1ed..924dbe355 100644 --- a/cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py +++ b/cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py @@ -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(): -- 2.45.2