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 (cherry picked from commit4573826d36
) (cherry picked from commit0a5d760ed5
)
This commit is contained in:
parent
c5545e861c
commit
6dd4039a30
|
@ -2546,6 +2546,11 @@ def export_location_metadata_update(context, export_location_uuid, metadata,
|
|||
# that will not take effect using one session and we will rewrite,
|
||||
# in that case, single record - first one added with this call.
|
||||
session = get_session()
|
||||
|
||||
if meta_value is None:
|
||||
LOG.warning(_LW("%s should be properly defined in the driver."),
|
||||
meta_key)
|
||||
|
||||
item = {"value": meta_value, "updated_at": timeutils.utcnow()}
|
||||
|
||||
meta_ref = _export_location_metadata_get_query(
|
||||
|
|
|
@ -683,7 +683,7 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||
if home_node:
|
||||
preferred = interface.get('home-node') == home_node
|
||||
else:
|
||||
preferred = None
|
||||
preferred = False
|
||||
|
||||
addresses[address] = {
|
||||
'is_admin_only': is_admin_only,
|
||||
|
|
|
@ -1069,7 +1069,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||
|
||||
expected = copy.deepcopy(fake.INTERFACE_ADDRESSES_WITH_METADATA)
|
||||
for key, value in expected.items():
|
||||
value['preferred'] = None
|
||||
value['preferred'] = False
|
||||
|
||||
self.assertEqual(expected, result)
|
||||
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