Add an attachments API
This includes a new attachment controller and shell
commands. To use you'll need to set your api version
`export OS_VOLUME_API_VERSION=3.27`
Now you can do things like attach a volume (cinders part at least):
`cinder attachment-create --connect True ......`
List/show/delete existing attachments:
`cinder attachment-list`
`cinder attachment-show <attachment-id>`
`cinder attachment-delete <attachemnt-id>`
Change-Id: I2c463f0910b6c9e37502869b7ec33073f12939f1
Because of 'start_version' parameter in decorator here [0]
we won't have metadata attr in args using api versions from 3.0 to 3.21.
This patch changes getting metadata from args logic for compatibility with
the api versions 3.0 - 3.21.
[0] - b73b393240/cinderclient/v3/shell.py (L1237)
Change-Id: I4aa099556c57c49e9ad74fe80e5591d738cf3aa0
Closes-Bug: #1659561
After v3.10, cinder support filter volumes by group_id, this patch
support this feature for client side.
Change-Id: Ie7df4d8b81789fd36ca6f91d96a477c88e8d5a52
Partial-Implements: blueprint improvement-to-query-consistency-group-detail
@utils.service_type was introduced with 'Initial split from
python-novaclient' commit and used for CLI. Now both Python and
Command-line APIs for each version work well without this decorator.
Unused 'get_service_type' function is removed too.
'utils.retype_method' removed as well because everything works well
without it.
Change-Id: Ic2470d8ca9d581b7c47da8d7e6a414c3c78ad27a
Partial-Bug: #1643584
Related-Bug: #1621126
volume list filtered on image_metadata does not work as expected.
The filtering based on image_metadata depended on non existent
utility for extracting image_metadata.
Fixed the issue by calling appropriate utility module
for extracting image_metadata. Looks like a typo.
Change-Id: I13e78277fc1afd22d044bb49b6a5ccc00904228c
Closes-bug: #1657650
The snpapshot-list API for cinder gives a list of snapshots based
on certain criteria to the user. From microversion 3.22 onwards
the snapshot-list API has been enhanced to support snapshot list
filtering based on metadata of snapshots. The metadata is stored
as key-value pair for every snapshot.
With this commit cinder will be queried based on metadata key and
value specified in the API snaphot-list. All the snapshots which
match the key, value provided by the user along with any other
filter criteria will be returned.
Added the test cases for the CLI and web requests.
DocImpact: "Filters results by a metadata key and value pair.
Default=None." on cinder snapshot-list
APIImpact
Closes-bug: #1569554
Change-Id: Idec0d0d02e7956843f202508e32c023c3cafbb0f
Now v2 API uses code from v3. It's confusing and logically incorrect.
This patch makes v3 API as an extended version of v2.
The next patches related to this bug duplicated code between v1 and v2,
v2 and v3 will be removed.
Change-Id: I90a2b713556e91db69270a03ef6b798e08f93f90
Partial-Bug: #1643584
The unicode_key_value_to_string() function is designed to remove
extra 'u' in cinderclient cli output.
However this patch[1] bring the extra 'u' back.
Let's remove the extra 'u' again.
Closes-bug: #1615921
Closes-bug: #1606904
[1] https://review.openstack.org/#/c/342734/
Change-Id: I26f0ad7149f57e935953c2398ba90b7b3585e201
Update 'is_public' flag only if flag is passed as an argument
while updating volume type. With this change If 'is_public' flag
is not passed by the user, its value will not be updated and
only arguments passed to the update api will be updated.
Added code to check if none of the argument is passed to update
volume-type then it raises the CommandError exception with
appropriate error message.
Change-Id: Ice52e204ebea5d35f04455e74e16745a8bcce3d4
Closes-Bug: #1548708
when it has an exception, it will call raise without arguments.
we can use "raise" replace "raise e", the result is the same.
Change-Id: I329932dcb2f49dcd3f0dfd88a5896860322e60ec
Cinderclient will parse filter item "name" to "display_name"
when get snapshot list via v2/v3 api.
This works for admin user. However for non-admin user,
cinder-api[1] removes "display_name" as an invalid filter item
and return the full snapshot list.
This change use "name" as filter of snapshots rather than
"display_name".
[1]: https://github.com/openstack/cinder/blob/master/cinder/api/v2/snapshots.py#L87-#L93
Co-Authored-By: cheneydc <dongc@neunn.com>
Change-Id: I63b6049a417293534079012dc6ee2a5b25e176be
Closes-Bug: #1554538
Now, cinder show <volume_id>, shows readonly as a separate field. This
helps the user to not have to scan all through the volume's metadata
field
Change-Id: Ib427f7e76e8e28fee97b75413c3032fbee75af86
Closes-bug: #1307098
Deleting multiple volume metadata keys with a single request
to improve performance. To delete multiple metadata items without
affecting the remaining ones, just update the metadata items with
the updated complete list of ones (without items to delete)
in the body of the request. This patch uses etags to avoid the
lost update problem with volume metadata. The command isn't changed:
$ cinder metadata volume_id unset k1 k2 k3
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Depends-On: I575635258c10f299181b8e4cdb51a7ad1f1be764
Implements: blueprint delete-multiple-metadata-keys
Change-Id: I8e18133ffee87c240a7af4b8177683ab99330d9e
Beckup-restore does not currently accept the name of the backup,
however other backup actions do and according to its description
backup-restore should as well.
Change-Id: I26d8d2f1fe6cf7362d23d9b9668936dbb0509251
Closes-Bug: #1604892
Following the commit fb2c434c2461a25193067104de766fc1142a6024 in
the cinder repo the --force option to upload-to-image is ignored
by default. To enable it the config option enable_force_upload
must be set to true.
The help text for upload-to-image in the python cinderclient
should remind user that --force may not work in some cloud now.
Closes-Bug: #1611667
Change-Id: Ib56fb2016d933a9bbbcb0185c50e33d2166b34e6
Manager's api_version property is used by api_version.wraps. It
should not be an "empty" class and the real api_version can be
read from Client class.
The 3.0 version's upload-to-image doesn't work as excepted because
of this useless api_version of VolumeManager class. This patch also
fix it and update some unit tests for it, because the changes are
co-dependent on one another.
Co-Authored-By: Nate Potter <nathaniel.potter@intel.com>
Change-Id: I398cbd02b61f30918a427291d1d3ae00435e0f4c
Closes-Bug: #1573414
Closes-Bug: #1589040
Now, "cinder help subcommand" can not show whether an argument
is supported for a specific microversion.
With this change, developers only need to add a start_version or
end_version in the utils.arg wrap, cinderclient will support
the microversion for that arguement.
@utils.arg(
'--foo',
start_version='3.1')
@utils.arg(
'--bar',
start_version='3.2',
end_version='3.5')
def do_some_action():
......
In previous example, an exception will be raised for such command:
$ cinder --os-volume-api-version 3.6 --bar some-ation
And only "--foo" will show up for such help command:
$ cinder --os-volume-api-version 3.1 help some-ation
Change-Id: I74137486992846bbf9fdff53c009851db2356eef
Partial-Bug: #1600567
Co-Authored-By: Nate Potter <nathaniel.potter@intel.com>
The help for the 'api-version' command should state that
it is displaying the api-version info for the server, not the
client:
Display the server API version information.
Change-Id: Ia4380871ddca1b7ff41a5e6c8cf86488626e69fc
cinderclient was assuming an identity v2 styled service catalog
would always be returned (when using `cinder endpoints`).
keystoneclient would return either a v2 or v3 styled catalog,
whereas keystoneauth abstracts out the differences and handles
them internally. the result is that there is no need to look
for specific ['serviceCatalog'] or ['catalog'] keys in the
dictionary returned from keystoneauth.
it should be noted that perhaps cinderclient should deprecate
the ability to list endpoints since that is mostly an identity
and admin level operation, and likely an artifact from early
openstack days, it should now be handled by openstackclient.
further, it's not clear whether the command is meant to list all
endpoints or just the endpoints in the user's token (which it does
now).
Change-Id: Ibfcccedee5baf43f5b5c517d37e3f046c8743078
Closes-Bug: 1608166
Cinder API allows specifying tenant_id to get tenant
specific resource usage. This was missing in the client.
This fix should allow fetching tenant specific resource usage
directly from the client. Added tenant argument to the limits CLI.
Closes-Bug: #1580562
Change-Id: I3fbd6341f6d018a79e7c343107ac974b6fbb9239
Edited do_backup_restore function to accept the name of the backup
as well as its id. Changed the test to comply with this.
DocImpact
Closes-Bug: #1604892
Change-Id: Iaec69dd053a119366fa5a8437701a6f7c3da2235
Cinder currently has the ability to take over the management of
existing volumes and snapshots ("manage existing") and to relinquish
management of volumes and snapshots ("unmanage"). The API to manage an
existing volume takes a reference, which is a driver-specific string
that is used to identify the volume on the storage backend. This
patch adds the client code for APIs for listing volumes and snapshots
available for management to make this flow more user-friendly.
Change-Id: Icd81a77294d9190ac6dbaa7e7d35e4dedf45e49f
Implements: blueprint list-manage-existing
This patch adds support for group types and group specs
in the client.
Server patch is merged: https://review.openstack.org/#/c/320165/
Current microversion is 3.11. The following CLI's are supported.
cinder --os-volume-api-version 3.11 group-type-create my_test_group
cinder --os-volume-api-version 3.11 group-type-list
cinder --os-volume-api-version 3.11 group-type-show my_test_group
cinder --os-volume-api-version 3.11 group-type-key my_test_group
set test_key=test_val
cinder --os-volume-api-version 3.11 group-specs-list
cinder --os-volume-api-version 3.11 group-type-key my_test_group
unset test_key
cinder --os-volume-api-version 3.11 group-type-update <group type uuid>
--name "new_group" --description "my group type"
cinder --os-volume-api-version 3.11 group-type-delete new_group
Change-Id: I161a96aa53208e78146cb115d500fd6b2c42d046
Partial-Implements: blueprint generic-volume-group
Mitaka Cinder added an API to return Versions from the base
endpoint URL:
http://<url>:8776/
This patch exposes that API for /v3 endpoint microversions 3.0 and
above with the command:
cinder api-version
Implements: blueprint add-get-server-versions
Change-Id: Ieb1a56b28188ec17946fe5564b28c165833ffc24
Before this patch, the output of "extra_specs"
in type-show command is this:
| extra_specs | {u'Alpha': u'a'} |
Becuase the type of "extra_specs" is not a string
and need to use unicode_key_value_to_string()
method to change it to string.
This patch add formatters and call
unicode_key_value_to_string() mothod for
"extra_specs" and change the output to this:
| extra_specs | {'Alpha': 'a'} |
Change-Id: Ia2e2633068ce5b5e6622474b145a1d4f074fd551
Closes-Bug: #1589461
Because of lack of strict boolean checking, the unexpected
'False' value will always be send to server if invalid bool
value is specifed.
For instance:
the parameter 'is-public' of cinder type-update,
the parameter 'force' of cinder qos-delete
as so forth.
This patch tries to add a strict checking for them
to prevent invalid bool value.
Change-Id: I896ddbb6ec4760bfd4d721db960138e2df0b86e1
Closes-Bug: #1596418
This patch updates client to support cluster related changes on the API
done on microversion 3.7.
Service listing will include "cluster_name" field and we have 4 new
commands, "cluster-list", "cluster-show", "cluster-enable" and
"cluster-disable".
Specs: https://review.openstack.org/327283
Implements: blueprint cinder-volume-active-active-support
Depends-On: If1ef3a80900ca6d117bf854ad3de142d93694adf
Change-Id: I824f46b876e21e552d9f0c5cd3e836f35ea31837
We have implemented cascade deleting volume in CLI now,
but there's still something that should be improved:
1. A parsing problem of cascade is existing that always
evaluate parameter to True.
So now change the cascade parameter to a flag that don't
accept value anymore.
If user want to delete volume with snapshot, just need to
use 'cinder delete --cascade [volume_id]'.
Change-Id: I92e9400d5d7fbb741607bdbde7ac0c0667fca85d
Closes-Bug: #1585441
Implements: blueprint support-deleting-vols-with-snps-in-cli
Volume restore API supports name option to specify volume name
for new volume creation, but CLI doesn't support this option.
This change simply add name option for backup-restore command.
Change-Id: I22ccc303c86b958cb21862f718ef89f57234a027
Partial-Bug: #1539667
Add supporting to allow list volumes
filtering by glance_metadata.
Cinder code has merged, support it in client.
Change-Id: Ifc2124b88c4199700d91a89c9fe68598630877db
Implements: blueprint support-volume-glance-metadata-query