NetApp: Define 'preferred' to False instead of none
Define preferred to false instead of none in the NetApp driver as setting it to none will trigger a traceback later on because the database doesn't allow null values to be inserted. "preferred" export location metadata must be set to true or false. warning logging is also added to the SQLAlchemy API if a none value is used to update the export location metadata. Change-Id: Ie7420c9286cc42eaa1361eeffe607b9b5b6b3fbd Closes-Bug: 1703660
This commit is contained in:
parent
8fddbe2d19
commit
4573826d36
@ -2902,6 +2902,11 @@ def export_location_metadata_update(context, export_location_uuid, metadata,
|
|||||||
# that will not take effect using one session and we will rewrite,
|
# that will not take effect using one session and we will rewrite,
|
||||||
# in that case, single record - first one added with this call.
|
# in that case, single record - first one added with this call.
|
||||||
session = get_session()
|
session = get_session()
|
||||||
|
|
||||||
|
if meta_value is None:
|
||||||
|
LOG.warning("%s should be properly defined in the driver.",
|
||||||
|
meta_key)
|
||||||
|
|
||||||
item = {"value": meta_value, "updated_at": timeutils.utcnow()}
|
item = {"value": meta_value, "updated_at": timeutils.utcnow()}
|
||||||
|
|
||||||
meta_ref = _export_location_metadata_get_query(
|
meta_ref = _export_location_metadata_get_query(
|
||||||
|
@ -742,7 +742,7 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||||||
if home_node:
|
if home_node:
|
||||||
preferred = interface.get('home-node') == home_node
|
preferred = interface.get('home-node') == home_node
|
||||||
else:
|
else:
|
||||||
preferred = None
|
preferred = False
|
||||||
|
|
||||||
addresses[address] = {
|
addresses[address] = {
|
||||||
'is_admin_only': is_admin_only,
|
'is_admin_only': is_admin_only,
|
||||||
|
@ -1120,7 +1120,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
|
|
||||||
expected = copy.deepcopy(fake.INTERFACE_ADDRESSES_WITH_METADATA)
|
expected = copy.deepcopy(fake.INTERFACE_ADDRESSES_WITH_METADATA)
|
||||||
for key, value in expected.items():
|
for key, value in expected.items():
|
||||||
value['preferred'] = None
|
value['preferred'] = False
|
||||||
|
|
||||||
self.assertEqual(expected, result)
|
self.assertEqual(expected, result)
|
||||||
mock_get_aggregate_node.assert_called_once_with(fake.POOL_NAME)
|
mock_get_aggregate_node.assert_called_once_with(fake.POOL_NAME)
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed the NetApp driver to report the correct value of the "preferred"
|
||||||
|
export location metadata where it cannot determine if there are any
|
||||||
|
"preferred" export locations.
|
Loading…
Reference in New Issue
Block a user