From c8f7bc16da63cd93643784dbbfeadd32dc126249 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Wed, 28 Jun 2017 07:45:17 +0000 Subject: [PATCH] Add driver interface documentation for list manageable Document the methods drivers need to implement for supporting list manageable volumes and snapshots. Also renaming volume_management_driver to volume_manageable_driver for better clarity on its purpose. Change-Id: I05b6bc5ee302fd4f2f71846ff3f00b42d2166239 --- ..._driver.py => volume_manageable_driver.py} | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) rename cinder/interface/{volume_management_driver.py => volume_manageable_driver.py} (51%) diff --git a/cinder/interface/volume_management_driver.py b/cinder/interface/volume_manageable_driver.py similarity index 51% rename from cinder/interface/volume_management_driver.py rename to cinder/interface/volume_manageable_driver.py index ec2abb68808..db80f576eaa 100644 --- a/cinder/interface/volume_management_driver.py +++ b/cinder/interface/volume_manageable_driver.py @@ -90,3 +90,72 @@ class VolumeManagementDriver(base.CinderInterface): :param volume: Cinder volume to unmanage """ + + +class VolumeListManageableDriver(VolumeManagementDriver): + """Interface to support listing manageable snapshots and volumes.""" + + def get_manageable_volumes(self, cinder_volumes, marker, limit, offset, + sort_keys, sort_dirs): + """List volumes on the backend available for management by Cinder. + + Returns a list of dictionaries, each specifying a volume in the host, + with the following keys: + + - reference (dictionary): The reference for a volume, which can be + passed to "manage_existing". + - size (int): The size of the volume according to the storage + backend, rounded up to the nearest GB. + - safe_to_manage (boolean): Whether or not this volume is safe to + manage according to the storage backend. For example, is the volume + in use or invalid for any reason. + - reason_not_safe (string): If safe_to_manage is False, the reason why. + - cinder_id (string): If already managed, provide the Cinder ID. + - extra_info (string): Any extra information to return to the user + + :param cinder_volumes: A list of volumes in this host that Cinder + currently manages, used to determine if + a volume is manageable or not. + :param marker: The last item of the previous page; we return the + next results after this value (after sorting) + :param limit: Maximum number of items to return + :param offset: Number of items to skip after marker + :param sort_keys: List of keys to sort results by (valid keys are + 'identifier' and 'size') + :param sort_dirs: List of directions to sort by, corresponding to + sort_keys (valid directions are 'asc' and 'desc') + """ + + def get_manageable_snapshots(self, cinder_snapshots, marker, limit, offset, + sort_keys, sort_dirs): + """List snapshots on the backend available for management by Cinder. + + Returns a list of dictionaries, each specifying a snapshot in the host, + with the following keys: + + - reference (dictionary): The reference for a snapshot, which can be + passed to "manage_existing_snapshot". + - size (int): The size of the snapshot according to the storage + backend, rounded up to the nearest GB. + - safe_to_manage (boolean): Whether or not this snapshot is safe to + manage according to the storage backend. For example, is the snapshot + in use or invalid for any reason. + - reason_not_safe (string): If safe_to_manage is False, the reason why. + - cinder_id (string): If already managed, provide the Cinder ID. + - extra_info (string): Any extra information to return to the user + - source_reference (string): Similar to "reference", but for the + snapshot's source volume. + + :param cinder_snapshots: A list of snapshots in this host that Cinder + currently manages, used to determine if + a snapshot is manageable or not. + :param marker: The last item of the previous page; we return the + next results after this value (after sorting) + :param limit: Maximum number of items to return + :param offset: Number of items to skip after marker + :param sort_keys: List of keys to sort results by (valid keys are + 'identifier' and 'size') + :param sort_dirs: List of directions to sort by, corresponding to + sort_keys (valid directions are 'asc' and 'desc') + + """