Give more fine grained access to DriverInitiatorData
Previously we were setting a whole model update, whereas now we only do one value at a time. This will allow for easier handling of doing the insert if not exist and reporting back what happened. The older method to do this was better suited to the model_update from initialize_connection, but we don’t need a ‘all-in-one’ kind of method anymore. Change-Id: I57778f1807d1814c536d62757d6ad10c920b6101 Closes-Bug: #1588088
This commit is contained in:
@@ -48,16 +48,25 @@ class VolumeDriverUtils(object):
|
||||
'namespace': self._data_namespace})
|
||||
raise
|
||||
|
||||
def save_driver_initiator_data(self, initiator, model_update, ctxt=None):
|
||||
def insert_driver_initiator_data(self, initiator, key, value, ctxt=None):
|
||||
"""Update the initiator data at key with value.
|
||||
|
||||
If the key has already been set to something return False, otherwise
|
||||
if saved successfully return True.
|
||||
"""
|
||||
try:
|
||||
self._db.driver_initiator_data_update(self._get_context(ctxt),
|
||||
initiator,
|
||||
self._data_namespace,
|
||||
model_update)
|
||||
return self._db.driver_initiator_data_insert_by_key(
|
||||
self._get_context(ctxt),
|
||||
initiator,
|
||||
self._data_namespace,
|
||||
key,
|
||||
value
|
||||
)
|
||||
except exception.CinderException:
|
||||
LOG.exception(_LE("Failed to update initiator data for"
|
||||
LOG.exception(_LE("Failed to insert initiator data for"
|
||||
" initiator %(initiator)s and backend"
|
||||
" %(backend)s"),
|
||||
" %(backend)s for key %(key)s."),
|
||||
{'initiator': initiator,
|
||||
'backend': self._data_namespace})
|
||||
'backend': self._data_namespace,
|
||||
'key': key})
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user