From 4d5f2c3925068fe49748e05a47c5c9c7e7999b3c Mon Sep 17 00:00:00 2001 From: Justin A Wilson Date: Fri, 30 Sep 2016 13:44:26 -0700 Subject: [PATCH] Add Cinder v3 client support for volumes Initial Cinder v3 support Change-Id: Idd5074832e80697ed0671f06d3291dfd92dbfb08 --- .../tests/functional/volume/v3/__init__.py | 0 .../tests/functional/volume/v3/common.py | 23 +++++++ .../tests/functional/volume/v3/test_qos.py | 23 +++++++ .../functional/volume/v3/test_snapshot.py | 23 +++++++ .../volume/v3/test_transfer_request.py | 24 +++++++ .../tests/functional/volume/v3/test_volume.py | 23 +++++++ .../functional/volume/v3/test_volume_type.py | 23 +++++++ .../tests/unit/volume/v3/__init__.py | 0 openstackclient/volume/client.py | 3 +- openstackclient/volume/v3/__init__.py | 0 .../notes/change-098377fd53cce7a0.yaml | 10 +++ setup.cfg | 63 +++++++++++++++++++ 12 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 openstackclient/tests/functional/volume/v3/__init__.py create mode 100644 openstackclient/tests/functional/volume/v3/common.py create mode 100644 openstackclient/tests/functional/volume/v3/test_qos.py create mode 100644 openstackclient/tests/functional/volume/v3/test_snapshot.py create mode 100644 openstackclient/tests/functional/volume/v3/test_transfer_request.py create mode 100644 openstackclient/tests/functional/volume/v3/test_volume.py create mode 100644 openstackclient/tests/functional/volume/v3/test_volume_type.py create mode 100644 openstackclient/tests/unit/volume/v3/__init__.py create mode 100644 openstackclient/volume/v3/__init__.py create mode 100644 releasenotes/notes/change-098377fd53cce7a0.yaml diff --git a/openstackclient/tests/functional/volume/v3/__init__.py b/openstackclient/tests/functional/volume/v3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openstackclient/tests/functional/volume/v3/common.py b/openstackclient/tests/functional/volume/v3/common.py new file mode 100644 index 0000000000..57a62df643 --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/common.py @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +from openstackclient.tests.functional import base + + +class BaseVolumeTests(base.TestCase): + """Base class for Volume functional tests. """ + + @classmethod + def setUpClass(cls): + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/functional/volume/v3/test_qos.py b/openstackclient/tests/functional/volume/v3/test_qos.py new file mode 100644 index 0000000000..46965ced08 --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/test_qos.py @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstackclient.tests.functional.volume.v2 import test_qos as v2 +import os + + +class QosTests(v2.QosTests): + """Functional tests for volume qos. """ + + @classmethod + def setUpClass(cls): + super(QosTests, cls).setUpClass() + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/functional/volume/v3/test_snapshot.py b/openstackclient/tests/functional/volume/v3/test_snapshot.py new file mode 100644 index 0000000000..bf05b9de9d --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/test_snapshot.py @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstackclient.tests.functional.volume.v2 import test_snapshot as v2 +import os + + +class VolumeSnapshotTests(v2.VolumeSnapshotTests): + """Functional tests for volume snapshot. """ + + @classmethod + def setUpClass(cls): + super(VolumeSnapshotTests, cls).setUpClass() + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/functional/volume/v3/test_transfer_request.py b/openstackclient/tests/functional/volume/v3/test_transfer_request.py new file mode 100644 index 0000000000..7b54dd20f5 --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/test_transfer_request.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstackclient.tests.functional.volume.v2 import test_transfer_request \ + as v2 +import os + + +class TransferRequestTests(v2.TransferRequestTests): + """Functional tests for transfer request. """ + + @classmethod + def setUpClass(cls): + super(TransferRequestTests, cls).setUpClass() + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/functional/volume/v3/test_volume.py b/openstackclient/tests/functional/volume/v3/test_volume.py new file mode 100644 index 0000000000..333826d833 --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/test_volume.py @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstackclient.tests.functional.volume.v2 import test_volume as v2 +import os + + +class VolumeTests(v2.VolumeTests): + """Functional tests for volume. """ + + @classmethod + def setUpClass(cls): + super(VolumeTests, cls).setUpClass() + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/functional/volume/v3/test_volume_type.py b/openstackclient/tests/functional/volume/v3/test_volume_type.py new file mode 100644 index 0000000000..f10e64b426 --- /dev/null +++ b/openstackclient/tests/functional/volume/v3/test_volume_type.py @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstackclient.tests.functional.volume.v2 import test_volume_type as v2 +import os + + +class VolumeTypeTests(v2.VolumeTypeTests): + """Functional tests for volume type. """ + + @classmethod + def setUpClass(cls): + super(VolumeTypeTests, cls).setUpClass() + os.environ['OS_VOLUME_API_VERSION'] = '3' diff --git a/openstackclient/tests/unit/volume/v3/__init__.py b/openstackclient/tests/unit/volume/v3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index ade5a95f55..c4b0dfcabd 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -27,7 +27,8 @@ API_VERSION_OPTION = 'os_volume_api_version' API_NAME = "volume" API_VERSIONS = { "1": "cinderclient.v1.client.Client", - "2": "cinderclient.v2.client.Client" + "2": "cinderclient.v2.client.Client", + "3": "cinderclient.v3.client.Client", } diff --git a/openstackclient/volume/v3/__init__.py b/openstackclient/volume/v3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/releasenotes/notes/change-098377fd53cce7a0.yaml b/releasenotes/notes/change-098377fd53cce7a0.yaml new file mode 100644 index 0000000000..dc41a7bd79 --- /dev/null +++ b/releasenotes/notes/change-098377fd53cce7a0.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Added support for Volume API v3 for the following block storage command + resources: ``consistency group``, ``consistency group snapshot``, + ``volume``, ``volume backup``, ``volume host``, ``volume snapshot``, + ``volume type``, ``volume qos``, ``volume service``, + ``volume transfer request``. Note that microversion support for Volume API + v3 is not yet implemented, each command will assume the API version is + ``3.0``. diff --git a/setup.cfg b/setup.cfg index dbe921aa4a..ce4f017319 100644 --- a/setup.cfg +++ b/setup.cfg @@ -602,6 +602,69 @@ openstack.volume.v2 = volume_transfer_request_list = openstackclient.volume.v2.volume_transfer_request:ListTransferRequest volume_transfer_request_show = openstackclient.volume.v2.volume_transfer_request:ShowTransferRequest +openstack.volume.v3 = + consistency_group_add_volume = openstackclient.volume.v2.consistency_group:AddVolumeToConsistencyGroup + consistency_group_create = openstackclient.volume.v2.consistency_group:CreateConsistencyGroup + consistency_group_delete = openstackclient.volume.v2.consistency_group:DeleteConsistencyGroup + consistency_group_list = openstackclient.volume.v2.consistency_group:ListConsistencyGroup + consistency_group_remove_volume = openstackclient.volume.v2.consistency_group:RemoveVolumeFromConsistencyGroup + consistency_group_set = openstackclient.volume.v2.consistency_group:SetConsistencyGroup + consistency_group_show = openstackclient.volume.v2.consistency_group:ShowConsistencyGroup + + consistency_group_snapshot_create = openstackclient.volume.v2.consistency_group_snapshot:CreateConsistencyGroupSnapshot + consistency_group_snapshot_delete = openstackclient.volume.v2.consistency_group_snapshot:DeleteConsistencyGroupSnapshot + consistency_group_snapshot_list = openstackclient.volume.v2.consistency_group_snapshot:ListConsistencyGroupSnapshot + consistency_group_snapshot_show = openstackclient.volume.v2.consistency_group_snapshot:ShowConsistencyGroupSnapshot + + volume_create = openstackclient.volume.v2.volume:CreateVolume + volume_delete = openstackclient.volume.v2.volume:DeleteVolume + volume_list = openstackclient.volume.v2.volume:ListVolume + volume_migrate = openstackclient.volume.v2.volume:MigrateVolume + volume_set = openstackclient.volume.v2.volume:SetVolume + volume_show = openstackclient.volume.v2.volume:ShowVolume + volume_unset = openstackclient.volume.v2.volume:UnsetVolume + + volume_backup_create = openstackclient.volume.v2.backup:CreateVolumeBackup + volume_backup_delete = openstackclient.volume.v2.backup:DeleteVolumeBackup + volume_backup_list = openstackclient.volume.v2.backup:ListVolumeBackup + volume_backup_restore = openstackclient.volume.v2.backup:RestoreVolumeBackup + volume_backup_set = openstackclient.volume.v2.backup:SetVolumeBackup + volume_backup_show = openstackclient.volume.v2.backup:ShowVolumeBackup + + volume_host_set = openstackclient.volume.v2.volume_host:SetVolumeHost + + volume_snapshot_create = openstackclient.volume.v2.volume_snapshot:CreateVolumeSnapshot + volume_snapshot_delete = openstackclient.volume.v2.volume_snapshot:DeleteVolumeSnapshot + volume_snapshot_list = openstackclient.volume.v2.volume_snapshot:ListVolumeSnapshot + volume_snapshot_set = openstackclient.volume.v2.volume_snapshot:SetVolumeSnapshot + volume_snapshot_show = openstackclient.volume.v2.volume_snapshot:ShowVolumeSnapshot + volume_snapshot_unset = openstackclient.volume.v2.volume_snapshot:UnsetVolumeSnapshot + + volume_type_create = openstackclient.volume.v2.volume_type:CreateVolumeType + volume_type_delete = openstackclient.volume.v2.volume_type:DeleteVolumeType + volume_type_list = openstackclient.volume.v2.volume_type:ListVolumeType + volume_type_set = openstackclient.volume.v2.volume_type:SetVolumeType + volume_type_show = openstackclient.volume.v2.volume_type:ShowVolumeType + volume_type_unset = openstackclient.volume.v2.volume_type:UnsetVolumeType + + volume_qos_associate = openstackclient.volume.v2.qos_specs:AssociateQos + volume_qos_create = openstackclient.volume.v2.qos_specs:CreateQos + volume_qos_delete = openstackclient.volume.v2.qos_specs:DeleteQos + volume_qos_disassociate = openstackclient.volume.v2.qos_specs:DisassociateQos + volume_qos_list = openstackclient.volume.v2.qos_specs:ListQos + volume_qos_set = openstackclient.volume.v2.qos_specs:SetQos + volume_qos_show = openstackclient.volume.v2.qos_specs:ShowQos + volume_qos_unset = openstackclient.volume.v2.qos_specs:UnsetQos + + volume_service_list = openstackclient.volume.v2.service:ListService + volume_service_set = openstackclient.volume.v2.service:SetService + + volume_transfer_request_accept = openstackclient.volume.v2.volume_transfer_request:AcceptTransferRequest + volume_transfer_request_create = openstackclient.volume.v2.volume_transfer_request:CreateTransferRequest + volume_transfer_request_delete = openstackclient.volume.v2.volume_transfer_request:DeleteTransferRequest + volume_transfer_request_list = openstackclient.volume.v2.volume_transfer_request:ListTransferRequest + volume_transfer_request_show = openstackclient.volume.v2.volume_transfer_request:ShowTransferRequest + [build_sphinx] source-dir = doc/source build-dir = doc/build