Add ability to modify volume type

This patch adds the volume retype operation, which allows a user to
change a given volume's type.

When retyping, the scheduler checks if the volume's current host can
accept the new type (i.e., it checks if the host passes the filters when
using the new type). If the current host is suitable, its manager is
called which calls upon the driver to change the volume's type.

There are two cases where a retype operation may require migrating the
volume:
1. The volume's current host cannot accept the new type
2. The volume's driver cannot perform the retype operation

In case of a migration, a volume with the new type is created, and the
data is migrated to it.

Volume migrations resulting from retype can be controlled by passing a
policy, which can be either:
1. 'never': Never migrate (the retype fails if migration is required)
   (default)
2. 'on-demand': Migrate when necessary

This version will cause retype operations to fail if the current and
new volume types have different:
1. QoS settings that are enforced by the front-end for in-use volumes.
2. encryption settings.

Subsequent patches can address these cases.

DocImpact

Change-Id: I2dc99b4fa64d611d2bb936fc3890ca334e08bb55
Implements: blueprint volume-retype
This commit is contained in:
Avishay Traeger
2013-09-03 16:06:27 +03:00
parent 24d7e24413
commit 3fd7857a36
26 changed files with 1073 additions and 62 deletions

View File

@@ -46,6 +46,7 @@ class VolumeAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
1.10 - Add migrate_volume_completion, remove rename_volume.
1.11 - Adds mode parameter to attach_volume()
to support volume read-only attaching.
1.12 - Adds retype.
'''
BASE_RPC_API_VERSION = '1.0'
@@ -180,3 +181,17 @@ class VolumeAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
topic=rpc.queue_get_for(ctxt, self.topic,
volume['host']),
version='1.10')
def retype(self, ctxt, volume, new_type_id, dest_host,
migration_policy='never', reservations=None):
host_p = {'host': dest_host.host,
'capabilities': dest_host.capabilities}
self.cast(ctxt,
self.make_msg('retype',
volume_id=volume['id'],
new_type_id=new_type_id,
host=host_p,
migration_policy=migration_policy,
reservations=reservations),
topic=rpc.queue_get_for(ctxt, self.topic, volume['host']),
version='1.12')