[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
This commit is contained in:
Felipe Rodrigues 2022-05-09 13:50:40 -03:00
parent 9ba393af27
commit d57c33d7a8
6 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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,
},
}

View File

@ -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,
},
]

View File

@ -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 <https://bugs.launchpad.net/manila/+bug/1927823>`_