From 9ce3dfba79ac3dc865a8613f92aea2633652f90c Mon Sep 17 00:00:00 2001 From: Pradeep Sathasivam Date: Mon, 29 Jun 2015 17:08:19 +0530 Subject: [PATCH] Handle attachment of second volume When the zoning policy is initiator and a second volume is attached to an instance, the current implementation deletes the existing zones and then adds new zone data. While doing so, the configuration is deleted and it is never added back. The issue is due to delete/add design. When zones are deleted, active zone set should also be updated, as based on active zone set config is either created/updated. Added code to get active zone set before adding the zones. Change-Id: Ib0cd51c3724142175eb1c602d6c1f87dd5e985fb Closes-Bug: #1465207 --- cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py | 2 +- cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py b/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py index 46e67eb0e..0a55e4eb8 100644 --- a/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py +++ b/cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py @@ -94,7 +94,7 @@ class TestBrcdFCZoneClientCLI(client_cli.BrcdFCZoneClientCLI, test.TestCase): get_active_zs_mock): get_active_zs_mock.return_value = active_zoneset self.add_zones(new_zones, False, None) - get_active_zs_mock.assert_called_once_with() + self.assertEqual(2, get_active_zs_mock.call_count) self.assertEqual(3, apply_zone_change_mock.call_count) cfg_save_mock.assert_called_once_with() diff --git a/cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py b/cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py index a1ad47934..480fd03ad 100644 --- a/cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py +++ b/cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py @@ -163,6 +163,9 @@ class BrcdFCZoneClientCLI(object): iterator_count += 1 zone_with_sep += zone try: + # Get active zone set from device, as some of the zones + # could be deleted. + active_zone_set = self.get_active_zone_set() cfg_name = active_zone_set[ZoneConstant.ACTIVE_ZONE_CONFIG] cmd = None if not cfg_name: -- 2.45.2