]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix calling delete_zones method with a wrong argument
authorchenying <ying.chen@huawei.com>
Wed, 2 Sep 2015 09:48:59 +0000 (17:48 +0800)
committerchenying <ying.chen@huawei.com>
Fri, 30 Oct 2015 08:36:46 +0000 (16:36 +0800)
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

cinder/tests/unit/zonemanager/test_cisco_fc_zone_client_cli.py
cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py

index 57ca8e40b6b285003846ad583be7652058ed9fb1..60b2421cb07fc47c221186e9f7e790e12b7d6aff 100644 (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']
index 4cdbda1ed9c0d876c46ffe544c74efad68d89a4f..924dbe35592f5bf0b7c36816b9bd97b18d69c305 100644 (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():