Commit 133e897d authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Hrvoje Ribicic

Export the 'exclusive' parameter to ExtStorage

Introduce a new environment variable named VOL_OPEN_EXCLUSIVE
and export it to the ExtStorage's open script to denote
whether this device will be opened in shared mode (before
migrations) or not (instance start, disk activation).

VOL_OPEN_EXCLUSIVE will be either True or False.

Update design doc and man pages accordingly.
Signed-off-by: default avatarDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 1a44305f
......@@ -231,6 +231,9 @@ all commands, and some commands might have extra variables.
``VOL_SNAPSHOT_SIZE``
The size of the volume's snapshot.
Available only to the `snapshot` script.
``VOL_OPEN_EXCLUSIVE``
Whether the volume will be accessed exclusively or not.
Available only to the `open` script.
All scripts except `attach` should return 0 on success and non-zero on
error, accompanied by an appropriate error message on stderr. The
......
......@@ -187,7 +187,8 @@ class ExtStorageDevice(base.BlockDev):
"""
_ExtStorageAction(constants.ES_ACTION_OPEN, self.unique_id,
self.ext_params,
name=self.name, uuid=self.uuid)
name=self.name, uuid=self.uuid,
exclusive=exclusive)
def Close(self):
"""Notifies that the device will no longer be used for I/O.
......@@ -280,7 +281,8 @@ class ExtStorageDevice(base.BlockDev):
def _ExtStorageAction(action, unique_id, ext_params,
size=None, grow=None, metadata=None,
name=None, uuid=None,
snap_name=None, snap_size=None):
snap_name=None, snap_size=None,
exclusive=None):
"""Take an External Storage action.
Take an External Storage action concerning or affecting
......@@ -307,6 +309,8 @@ def _ExtStorageAction(action, unique_id, ext_params,
@param snap_size: the size of the snapshot
@type snap_name: string
@param snap_name: the name of the snapshot
@type exclusive: boolean
@param exclusive: Whether the Volume will be opened exclusively or not
@param uuid: uuid of the Volume (objects.Disk.uuid)
@rtype: None or a block device path (during attach)
......@@ -321,7 +325,8 @@ def _ExtStorageAction(action, unique_id, ext_params,
# Create the basic environment for the driver's scripts
create_env = _ExtStorageEnvironment(unique_id, ext_params, size,
grow, metadata, name, uuid,
snap_name, snap_size)
snap_name, snap_size,
exclusive)
# Do not use log file for action `attach' as we need
# to get the output from RunResult
......@@ -493,7 +498,8 @@ def ExtStorageFromDisk(name, base_dir=None):
def _ExtStorageEnvironment(unique_id, ext_params,
size=None, grow=None, metadata=None,
name=None, uuid=None,
snap_name=None, snap_size=None):
snap_name=None, snap_size=None,
exclusive=None):
"""Calculate the environment for an External Storage script.
@type unique_id: tuple (driver, vol_name)
......@@ -514,6 +520,8 @@ def _ExtStorageEnvironment(unique_id, ext_params,
@param snap_size: the size of the snapshot
@type snap_name: string
@param snap_name: the name of the snapshot
@type exclusive: boolean
@param exclusive: Whether the Volume will be opened exclusively or not
@rtype: dict
@return: dict of environment variables
......@@ -548,6 +556,9 @@ def _ExtStorageEnvironment(unique_id, ext_params,
if snap_size is not None:
result["VOL_SNAPSHOT_SIZE"] = str(snap_size)
if exclusive is not None:
result["VOL_OPEN_EXCLUSIVE"] = str(exclusive)
return result
......
......@@ -79,6 +79,10 @@ VOL_SNAPSHOT_NAME
VOL_SNAPSHOT_SIZE
The size of the volume's snapshot.
VOL_OPEN_EXCLUSIVE
Whether the volume will be opened for exclusive access or not.
This will be False (denoting shared access) during migration.
EXECUTABLE SCRIPTS
------------------
......@@ -235,6 +239,10 @@ The *open* script is used to open the given volume.
This makes the volume ready for I/O.
The ``VOL_OPEN_EXCLUSIVE`` variable denotes whether the volume will be
opened for exclusive access or not. It is True by default and
False (denoting shared access) during migration.
The script returns ``0`` on success.
Please note that this script is optional and not all providers should
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment