From d57c33d7a870924c3de6e4830d6facf71d47b098 Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Mon, 9 May 2022 13:50:40 -0300 Subject: [PATCH] [NetApp] Fix lack of aggregate pool home state The NetApp driver is not reporting the home state of the aggregate pools. This information is useful during maintenance tasks, since not home aggregate cannot create shares. This patch adds to the report netapp capabilities the boolean `netapp_is_home`. Closes-Bug: #1927823 Change-Id: I8e98541d8e457e9e4609410853b50d6156465f61 --- .../drivers/netapp/dataontap/client/client_cmode.py | 8 ++++++++ .../drivers/netapp/dataontap/cluster_mode/lib_base.py | 1 + .../netapp/dataontap/client/test_client_cmode.py | 5 +++++ .../netapp/dataontap/cluster_mode/test_lib_base.py | 2 ++ manila/tests/share/drivers/netapp/dataontap/fakes.py | 2 ++ ...7823-fix-create-not-home-aggr-e9bd1ebf0d8e4e1e.yaml | 10 ++++++++++ 6 files changed, 28 insertions(+) create mode 100644 releasenotes/notes/bug-1927823-fix-create-not-home-aggr-e9bd1ebf0d8e4e1e.yaml diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 8ee89e23de..5d87591eaa 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -3812,6 +3812,10 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): 'raid-type': None, 'is-hybrid': None, }, + 'aggr-ownership-attributes': { + 'home-id': None, + 'owner-id': None, + }, }, } @@ -3829,12 +3833,16 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): aggr_attributes = aggrs[0] aggr_raid_attrs = aggr_attributes.get_child_by_name( 'aggr-raid-attributes') or netapp_api.NaElement('none') + aggr_owner_attrs = aggr_attributes.get_child_by_name( + 'aggr-ownership-attributes') or netapp_api.NaElement('none') aggregate = { 'name': aggr_attributes.get_child_content('aggregate-name'), 'raid-type': aggr_raid_attrs.get_child_content('raid-type'), 'is-hybrid': strutils.bool_from_string( aggr_raid_attrs.get_child_content('is-hybrid')), + 'is-home': (aggr_owner_attrs.get_child_content('owner-id') == + aggr_owner_attrs.get_child_content('home-id')) } return aggregate diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py index b94a41093c..08adb3dd6a 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -2436,6 +2436,7 @@ class NetAppCmodeFileStorageLibrary(object): 'netapp_raid_type': aggregate.get('raid-type'), 'netapp_hybrid_aggregate': hybrid, 'netapp_disk_type': disk_types, + 'netapp_is_home': aggregate.get('is-home'), } return aggr_info diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index 71339b2819..9cfd47f1f5 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -5862,6 +5862,10 @@ class NetAppClientCmodeTestCase(test.TestCase): 'raid-type': None, 'is-hybrid': None, }, + 'aggr-ownership-attributes': { + 'home-id': None, + 'owner-id': None, + }, }, } self.client._get_aggregates.assert_has_calls([ @@ -5873,6 +5877,7 @@ class NetAppClientCmodeTestCase(test.TestCase): 'name': fake.SHARE_AGGREGATE_NAME, 'raid-type': 'raid_dp', 'is-hybrid': False, + 'is-home': True, } self.assertEqual(expected, result) diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py index c83bdeef85..10eea1eeb8 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py @@ -3785,11 +3785,13 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): 'netapp_raid_type': 'raid4', 'netapp_disk_type': 'FCAL', 'netapp_hybrid_aggregate': 'false', + 'netapp_is_home': False, }, fake.AGGREGATES[1]: { 'netapp_raid_type': 'raid_dp', 'netapp_disk_type': ['SATA', 'SSD'], 'netapp_hybrid_aggregate': 'true', + 'netapp_is_home': True, }, } diff --git a/manila/tests/share/drivers/netapp/dataontap/fakes.py b/manila/tests/share/drivers/netapp/dataontap/fakes.py index 0c0fd2acdd..f6acbf112c 100644 --- a/manila/tests/share/drivers/netapp/dataontap/fakes.py +++ b/manila/tests/share/drivers/netapp/dataontap/fakes.py @@ -1072,11 +1072,13 @@ SSC_AGGREGATES = [ 'name': AGGREGATES[0], 'raid-type': 'raid4', 'is-hybrid': False, + 'is-home': False, }, { 'name': AGGREGATES[1], 'raid-type': 'raid_dp', 'is-hybrid': True, + 'is-home': True, }, ] diff --git a/releasenotes/notes/bug-1927823-fix-create-not-home-aggr-e9bd1ebf0d8e4e1e.yaml b/releasenotes/notes/bug-1927823-fix-create-not-home-aggr-e9bd1ebf0d8e4e1e.yaml new file mode 100644 index 0000000000..201e81b4d2 --- /dev/null +++ b/releasenotes/notes/bug-1927823-fix-create-not-home-aggr-e9bd1ebf0d8e4e1e.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + NetApp driver: it is not reporting the home state of the aggregate + pool. Operators may want to know this information to avoid those kind of + pools during maintenance task. The patch adds the boolean capability + `netapp_is_home` enabling the requester to avoid not home pools using + the scheduler CapabilitiesFilter and share_type extra_specs. + For more details, please refer to + `launchpad bug #1927823 `_