Commit Graph

368 Commits

Author SHA1 Message Date
Stephen Finucane c128ae1969 trivial: Don't ignore missing resources
An openstacksdk 'find_foo' proxy method will return None by default if a
resource is not found. You can change this behavior by setting
'ignore_missing=False'. We were doing this in most, but not all cases:
correct the issue.

In the event of calling 'image delete' with multiple images, it will no
longer fail on the first missing image and will instead attempt to
delete remaining images before failing.

Change-Id: I1e01d3c096dcaab731c28e496a182dd911229227
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-02-13 16:33:56 +00:00
Rajesh Tailor 71839eb5fa [codespell] fix typos in doc,tests and help messages
Change-Id: I4823782daa1af3872bc22603147e3073152cc777
2023-11-21 11:31:07 +05:30
Zuul 0b78dfe30b Merge "Add pagination helpers" 2023-11-07 08:47:24 +00:00
Stephen Finucane c7e3529dea Add pagination helpers
Add some pagination helpers to configure pagination parameters for
various commands. Two pagination schemes are supported, based on what we
currently support across OSC commands: marker-based pagination and
offset-based pagination.

Change-Id: I551bb4c3ff0568c6df5244a1d0f0669497bee58f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-11-03 23:16:18 +00:00
Zuul dfcb8b0ee7 Merge "trivial: Make better use of argparse" 2023-10-31 15:00:24 +00:00
Zuul 5883bcecd4 Merge "volume: Add alias for volume type AZs" 2023-10-31 15:00:20 +00:00
Zuul e13f948ae5 Merge "volume: Add aliases for common volume type props" 2023-10-31 15:00:18 +00:00
Zuul 456c66ff63 Merge "volume: Allow filtering volume types by properties" 2023-10-31 14:53:36 +00:00
Zuul d735b6cc07 Merge "volume: Support same_host, different_host hint as list" 2023-10-31 14:53:35 +00:00
Johannes Kulik 60a0e379a4 volume: Support same_host, different_host hint as list
When creating a volume, the scheduler hints can be supplied as strings.
The "same_host" and "different_host" hints can also be supplied as a
list if affinity/anti-affinity to multiple volumes is requested [0]

The previously-used `KeyValueAction` only supplies strings as values - the
last one if multiple --hint contain the same key. An alternative already
used in `CreateServer` would be `KeyValueAppendAction`, but only a subset of
the scheduler hints accept lists, so we cannot use that in general.

Therefore, we create `KeyValueHintAction`. It contains both a
`KeyValueAction` and a `KeyValueAppendAction` object and calls the
appropriate action based on the beginning of the given values as defined
in `APPEND_KEYS`.

[0] d96b705774/cinder/api/schemas/scheduler_hints.py (L31-L65)

Change-Id: Ida7f4662dc9fea24510758541fd4f2622b73bf31
2023-10-31 09:22:25 +01:00
Rajat Dhasmana ae10851a68 Migrate resource filter commands to SDK
This patch migrates ``block storage resource filter list`` and
``block storage resource filter show`` commands to SDK.

Change-Id: Ibc50963954418aab0be35e120f8dcfadbe4020b8
2023-10-30 12:06:14 +05:30
Stephen Finucane 2a2a6e1781 trivial: Make better use of argparse
Change-Id: Ib76c0d18bf5e44bfb4dcd9d729d9a1c5635cdba7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-10-27 17:58:36 +01:00
Stephen Finucane a3410cd4f7 volume: Add alias for volume type AZs
Another quality of life improvements. The key for this one is weird and
the whole thing is a little more involved, hence why it's kept separate.

Change-Id: I75aa85f27905104dc84fffe823c01b4c90a6a822
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-10-27 17:58:13 +01:00
Stephen Finucane e0c7cef434 volume: Add aliases for common volume type props
Add aliases for the enabling multiattach, caching and replication via
extra spec properties. These are useful since the syntax for setting
each of them is a bit weird and frankly not very discoverable.

Change-Id: I08b51224c66a34a9dcfcffc95847e61d9aac0e7e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-10-27 17:57:39 +01:00
Stephen Finucane 67bec7785c volume: Allow filtering volume types by properties
Starting in volume API microversion 3.52, it is possible to filter
volume types by extra specs (a.k.a. properties). Even non-admins can do
this for so-called "user visible" extra specs. Make it possible to do
this.

While we're here, the test file is renamed to match the name of the
module under test.

Change-Id: Ia9acc06c0c615bf24e12b63146ea97ac2505f596
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-10-27 16:37:15 +01:00
Rajat Dhasmana 39a084f91c Migrate volume backend commands to SDK
This patch migrates following volume backend commands to SDK:

volume backend capability show
volume backend pool list

Change-Id: Idded38a5f87d51574426c4ac10c806af52984b7c
2023-10-12 01:14:35 +05:30
Christian Rohmann 98b949646c Add is_incremental to ListVolumeBackup
It's of interest which backups are incremental or full. Returning this
information as a column to the list of backups.

Change-Id: I766330228634d5db678df11c23877077a3635372
2023-09-19 22:10:04 +02:00
Stephen Finucane 8735b862c5 volume: Deprecate '--detailed' options
We use flags, not options with boolean-like values, for boolean
parameters. The affected commands were only introduced recently so this
should have minimal fallout.

Change-Id: I700733e750bff539806af167c9d47cec769c3343
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-09-11 11:02:55 +01:00
Zuul 6ae38b2888 Merge "tests: Use consistent shortcut to fake image client" 2023-09-06 12:26:00 +00:00
Zuul 94caaa487d Merge "Migrate backup commands to SDK" 2023-09-01 02:45:27 +00:00
Stephen Finucane 28b1267921 tests: Use consistent shortcut to fake image client
This removes the need for a number of base test case subclasses. We use
'image_client' rather than 'client' to avoid conflicts with clients for
other services.

Note that this highlights a minor bug with the 'volume create' command
when using the v1 block storage API and creating a volume from an image.
This is corrected, though it can be assumed that no one is actually
using this code path to say it hasn't been reported in the few years
since the bug was introduced in Ussuri.

Change-Id: I571be27f68bb7669dcb883f3b4799731b4a35479
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-08-28 13:52:23 +01:00
Stephen Finucane 564e4f76fb volume: Migrate 'volume group snapshot' commands to SDK
Change-Id: Ie49e1f4b63de8b3bc699f7a9ef6eaa72801b9d05
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/892974
2023-08-25 15:09:00 +01:00
Zuul d10185380b Merge "volume: Make better use of argparse" 2023-08-25 12:08:16 +00:00
Zuul 356bc2566e Merge "volume: Add 'volume type set --private/--public'" 2023-08-25 12:08:10 +00:00
whoami-rajat bfd6170b03 Migrate backup commands to SDK
This patch migrates the following backup commands to SDK:

* Create Backup
* Show Backup
* List Backup
* Restore Backup
* Delete Backup

Change-Id: Icfadd65b92f4cd343bc327d33e29767bc9b969f9
2023-08-17 11:04:46 +05:30
whoami-rajat 4dfbc5011e Migrate 'volume summary' command to SDK
This patch modifies the existing volume summary call from
cinderclient to SDK.

Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/884397
Change-Id: I364211a597b6ec155b154fa9d3c67239e750b5ad
2023-07-05 10:04:01 +00:00
Zuul 4a62c73992 Merge "volume: Add 'volume qos set --no-property' option" 2023-05-17 23:20:28 +00:00
Stephen Finucane 629eb33c4d volume: Add 'volume qos set --no-property' option
Supporting "--no-property" option will apply user a convenient way to
clean all properties of volume qos in a short command. The patch adds
"--no-property" option in "volume qos set" command and update related
test cases and docs.

Change-Id: I1fb5b4f0a923bbf557a3af3f63809bde9e84ffd4
2023-05-17 16:50:16 +01:00
Stephen Finucane 6dcef7c3ec volume: Make better use of argparse
Change-Id: Ifeab60aaf18a9163465d4968c53e3ed66dad769b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-05-17 16:38:56 +01:00
Takashi Kajinami 83f5c8033f volume: Add 'volume type set --private/--public'
We also rename the test file and fixup some of the tests.

Change-Id: I3731255648dc91c023a1390c3b37e68b6608f850
Co-authored-by: Stephen Finucane <stephenfin@redhat.com>
Story: 2008478
Task: 41518
2023-05-17 16:38:38 +01:00
whoami-rajat aaeda25e28 Migrate 'volume revert' command to SDK
This patch modifies the existing revert volume to snapshot call
from cinderclient to SDK.

Change-Id: Iaa9708ebae5d6ab3dfc73e4e2376af32ed098688
2023-05-16 17:38:10 +05:30
Stephen Finucane 35ba1d8f13 Blacken openstackclient.volume
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: Ic318617c67ab7ce6527f9016b759a1d4b0b80802
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
Zuul cfd728108c Merge "Wait for volume being available to set bootable or readonly" 2023-02-22 12:32:20 +00:00
Zuul 14dff075ff Merge "Fix really long help strings" 2023-02-22 12:32:16 +00:00
Zuul 3478873cff Merge "volume: Remove duplication from 'consistency group create' opts" 2023-02-22 12:32:11 +00:00
matbu 5c9c1c77a0 Wait for volume being available to set bootable or readonly
This patch add a check to be sure that the volume created is in a
available state before trying to set bootable or readonly flag.

Story: 2002158
Change-Id: I8db71fd8cf5bd14eb67880f76d2e9135edeb3ed2
2023-02-22 09:52:43 +00:00
Stephen Finucane 0d57f3f367 Deprecate positional args for 'volume group create'
There are now many ways to create a new volume group, thus the
positional arguments don't make sense. Deprecate them.

Change-Id: Id0b212426861719db1812b7d07b82613cf591de4
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-02-17 13:50:50 +00:00
whoami-rajat ec01268ea9 Add options to create volume group from source
This patch adds ``--source-group`` and ``--group-snapshot`` options
to the ``volume group create`` command to allow creating group from
a source group or a group snapshot.

Change-Id: I87482a5dd43c519dfdcf981635aa879914a70a5c
2023-02-17 12:17:22 +00:00
whoami-rajat 73b4ce88eb Add block storage manageable list commands
This patch adds the ``block storage volume manageable list`` and
``block storage snapshot manageable list`` commands that
allow operators to list the volumes and snapshots on a
particular host or cluster for management under OpenStack.

Change-Id: I328dada5a0dc4e9e44c0d51db5cf3f224e27f88f
2023-02-17 10:03:01 +00:00
whoami-rajat 2be3596779 Add block storage cleanup command
This patch adds the ``block storage cleanup`` command that
allow operators to cleanup resources (volumes and snapshots) with
failed operations by requesting services in other hosts in the
same cluster to cleanup resources of a failed service.

Change-Id: I1375223f525021db5201fa0a9f9a647d17dd01f7
2023-02-17 10:02:22 +00:00
whoami-rajat a9e3049e9c Add block storage log level {list, set} commands
This patch adds the ``block storage log level list`` and
``block storage log level set`` commands that allow
operators to list the current log levels of cinder services
and also enables them to set a particular log level.

Change-Id: I16cd8084fb505a9e68a35a936ef3b8b1f3cdc712
2023-02-16 04:33:40 +00:00
whoami-rajat e7ebf7544b Add volume revert command
This command allows users to revert a volume to a given snapshot.

Change-Id: If35ee394d654f5264558a281c835affff524ca50
2023-02-16 04:33:40 +00:00
Stephen Finucane 4106926fa6 volume: Remove duplication from 'consistency group create' opts
The '--consistency-group-source' and '--consistency-group-snapshot' opts
are unnecessarily verbose. Shorten them to '--source' and '--snapshot',
respectively, maintaining aliases to avoid breaking users.

Change-Id: I2b6656a8a09d953eb4406f1d4fd1e804743a8963
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-02-14 16:42:22 +00:00
whoami-rajat 77266bd9c3 Add volume summary command
This patch adds the ``volume summary`` command which shows the total
size, total count and metadata of all volumes.
This command is available from microversion 3.12 and the metadata
info is available from microversion 3.36.

Change-Id: I6472337e8b1dc91aad5fbe416673a5d5a5d5fa88
2023-01-13 21:18:15 +05:30
Stephen Finucane 5afe48040c Fix really long help strings
Each command should have a summary line followed by a longer
description, if needed. Some commands were not following this. Fix them.

Change-Id: If1ce7654037d192626460f34c069ea0979919b9b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-12-12 18:04:01 +00:00
whoami-rajat 4710cbeca6 Add test for creating volume from source
This patch adds a test to create a new volume from source.
We also include code changes to pass the right size i.e. either
size passed by the user via --size argument or the source volume
size. This case is already handled at the API layer[1] but it
helps being consistent with passing the right size value as in case
of creating a volume from snapshot or backup.

[1] 7c1a5ce7b1/cinder/api/v3/volumes.py (L381-L382)

Change-Id: Idc71636dad6bb678fe24f19b0836d2e9bd92d7d2
2022-11-23 14:20:06 +05:30
whoami-rajat 96162c24ea Change --size helptext to include backup
Followup from [1]. Modifying help text of --size
argument to include --backup option.

[1] https://review.opendev.org/c/openstack/python-openstackclient/+/864893

Change-Id: I12cf60079ebcfe1cd059602fbfc1a13c8fe86803
2022-11-22 21:20:19 +05:30
whoami-rajat bd0727c4f8 Add option to create volume from backup
Support for creating a volume from backup was added in
microversio 3.47. This patch adds a --backup option
to the volume create command to add that support.

Change-Id: Ib26d2d335475d9aacbf77c0fd7b7cda2ba743943
2022-11-21 20:30:09 +05:30
Jadon Naas 348eb79632 Docstring fix for CreateVolumeAttachment class
The command "volume attachment create" has a typo in the docstring.
The docstring says to use "server add volume", but the command is
actually "server volume add". This
change fixes the typo in the docstring.

Task: 46781
Story: 2010401
Change-Id: Ie19a24ead100dd9177669653a7a9997772ef4538
2022-11-10 11:51:18 -05:00
Stephen Finucane 3fc585332f volume: Volume names are optional
Who knew?

Change-Id: I1c1a811c0db59250e8a20a87f25c2662bc3ab3e8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-09-14 13:44:02 +01:00