_ExtStorageAction(constants.ES_ACTION_SETINFO, self.unique_id,
self.ext_params, metadata=text)
+ def Snapshot(self, snapshot_name):
+ """Take a snapshot of the block device.
+
+ """
+ # Call the External Storage's setinfo script,
+ # to set metadata for an existing Volume inside the External Storage
+ _ExtStorageAction(constants.ES_ACTION_SNAPSHOT, self.unique_id,
+ self.ext_params, snapshot_name=snapshot_name)
+
def _ExtStorageAction(action, unique_id, ext_params,
- size=None, grow=None, metadata=None):
+ size=None, grow=None, metadata=None,
+ snapshot_name=None):
"""Take an External Storage action.
Take an External Storage action concerning or affecting
# Create the basic environment for the driver's scripts
create_env = _ExtStorageEnvironment(unique_id, ext_params, size,
- grow, metadata)
+ grow, metadata, snapshot_name)
# Do not use log file for action `attach' as we need
# to get the output from RunResult
detach_script=es_files[constants.ES_SCRIPT_DETACH],
setinfo_script=es_files[constants.ES_SCRIPT_SETINFO],
verify_script=es_files[constants.ES_SCRIPT_VERIFY],
+ snapshot_script=es_files[constants.ES_SCRIPT_SNAPSHOT],
supported_parameters=parameters)
return True, es_obj
def _ExtStorageEnvironment(unique_id, ext_params,
- size=None, grow=None, metadata=None):
+ size=None, grow=None, metadata=None,
+ snapshot_name=None):
"""Calculate the environment for an External Storage script.
@type unique_id: tuple (driver, vol_name)
if metadata is not None:
result["VOL_METADATA"] = metadata
+ if snapshot_name is not None:
+ result["VOL_SNAPSHOT_NAME"] = snapshot_name
+
return result