]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Volume manage/unmanage support
authorGeraint North <geraint.north@uk.ibm.com>
Thu, 13 Feb 2014 14:17:27 +0000 (09:17 -0500)
committerAvishay Traeger <avishay@gmail.com>
Tue, 4 Mar 2014 17:54:19 +0000 (19:54 +0200)
commite6a3206523b8e1a4edd8867a8e7e36a58631d90a
treefbe9dd6bb5978e6f75f1f7cb9de5828998b85050
parentee371dfc56e9a633ba56bd05f7a32a1e3744fef2
Volume manage/unmanage support

Implements: blueprint add-export-import-volumes

Volume manage/unmanage support.

This change adds two new API extensions:

volume_unmanage.py:
Adds an "os-unmanage" action on an existing volume, which causes a
delete operation to flow through the stack, with a flag that indicates
that a different method ("unmanage") should be called on the driver
instead of delete_volume. A default, empty, implementation of unmanage
is provided.

volume_manage.py
Adds a new "os-manage-volume" API. A POST to this URI is very similar to
volume creation, except that the images, snapshots and existing volumes
cannot be specified. Instead the following must be specified:

host: Cinder host on which the existing storage resides
ref: Driver-specific reference to the existing storage object

name, description, volume_type, metadata and availability_zone are
supported as per a normal volume creation.

In order to support some re-use between volume_manage and the regular
volume creation, add_visible_admin_metadata has been factored out into
the cinder utils.py module.

The rest of the changes are just the implications of the host/ref
specification moving through the api, rpcapi, manager and flow (API and
Manager) layers. Management of an existing volume causes the
manage_existing_get_size() and manage_existing() methods to be called on
the driver, and a reference LVM implementation is provided.
brick/local_dev/lvm.py now includes a method to rename an LV.

Change-Id: Ifc5255b2fd277c0f60d25fc82a777e405b861320
22 files changed:
cinder/api/contrib/volume_manage.py [new file with mode: 0755]
cinder/api/contrib/volume_unmanage.py [new file with mode: 0755]
cinder/api/v2/volumes.py
cinder/brick/local_dev/lvm.py
cinder/exception.py
cinder/scheduler/manager.py
cinder/scheduler/rpcapi.py
cinder/tests/api/contrib/test_volume_manage.py [new file with mode: 0755]
cinder/tests/api/contrib/test_volume_unmanage.py [new file with mode: 0755]
cinder/tests/api/v2/test_volumes.py
cinder/tests/brick/fake_lvm.py
cinder/tests/policy.json
cinder/tests/scheduler/test_rpcapi.py
cinder/tests/test_volume.py
cinder/tests/test_volume_rpcapi.py
cinder/utils.py
cinder/volume/api.py
cinder/volume/driver.py
cinder/volume/drivers/lvm.py
cinder/volume/flows/manager/manage_existing.py [new file with mode: 0644]
cinder/volume/manager.py
cinder/volume/rpcapi.py