Commit graph

426 commits

Author SHA1 Message Date
Stephen Finucane
125133d056 volume: Temporarily ignore new volume columns
Change-Id: I4296766a1576c64eb3927cb0557aef5346b2d6f6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:22 +01:00
Stephen Finucane
03aa172fd0 volume: Split v2, v3 create, delete commands
Change-Id: I42616b9586fede3b775bc0fdbba73df90b555d46
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:21 +01:00
Stephen Finucane
267a29d594 volume: Migrate 'snapshot show', 'snapshot list' to SDK
Change-Id: I40de24012363f496e46c3dddc31a3e2563ccf443
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:20 +01:00
Stephen Finucane
3c6fa42642 volume: Migrate 'snapshot set', 'snapshot unset' to SDK
Change-Id: Id34d460c8c5656bf43f48717b13a002508562e4e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:19 +01:00
Stephen Finucane
e0020aec6a volume: Migrate 'snapshot create' to SDK
Change-Id: I0c2811b8518c41658803a7b2053f0f5d5114ed67
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:18 +01:00
Stephen Finucane
fc42f12eb2 volume: Migrate 'snapshot delete' to SDK
Change-Id: Iba89d521ec17a642c5905b0cff908b5a4a9dafd0
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:16 +01:00
Stephen Finucane
e1ff450e34 volume: Add v3-specific volume snapshot module
Change-Id: I23026abbb909c082fbc0fe0c9b2efcc89f4d464a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:15 +01:00
Stephen Finucane
8eb1a183fe volume: Migrate 'backup set', 'backup unset' to SDK
Change-Id: Iced346df828faab1ff08a2645ff64f4cfea25cb1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:12 +01:00
Stephen Finucane
b933330d55 volume: Migrate 'service *' to SDK
Change-Id: I81254c6cde8783be371ccdcface5027eb247b1ce
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:10 +01:00
Stephen Finucane
1ee3ef33d7 volume: Add v3-specific volume service module
Ease migration.

Change-Id: Ibcdb157ba1bf370c63320d3a1afcf3c400370624
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:09 +01:00
Stephen Finucane
00f4cf9c17 volume: Migrate 'block storage log level *' to SDK
Change-Id: Ic03f65fee197a85518df448c18a0fd2c11d51993
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-19 13:20:07 +01:00
Stephen Finucane
80eaa33ffe volume: Make better use of argparse
The latest in a series.

Change-Id: I8273c817e38120ba0b25aebdbfa1c2872222765e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-04 18:11:27 +01:00
Zuul
dd8e4740ec Merge "compute: Migrate to 'compute' client alias" 2025-04-03 18:08:17 +00:00
Zuul
1e8d243986 Merge "Fix: extend in-use volumes check" 2025-04-03 16:40:17 +00:00
Stephen Finucane
dae2539490 compute: Migrate to 'compute' client alias
This is no longer assigned to novaclient, meaning we can use it for SDK.

Change-Id: I43d9ede39d36cc29301f94fa462b9b9d9441807c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-03 16:39:03 +01:00
Zuul
ade7da8797 Merge "Prepare for osc-lib changes" 2025-04-01 17:57:57 +00:00
Stephen Finucane
dc8596fe74 Prepare for osc-lib changes
Change-Id: I665cd61272f881dce2d387da6035a2f35c866add
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-01 13:39:50 +01:00
Stephen Finucane
e6be9a3edf volume: Remove Cinder v1 support
The Cinder v1 API was removed in Queens [1]. Its replacement, the v2
API, has existed since Grizzly [2]. More importantly, the v1 commands
are implemented using python-cinderclient but support for the v1 API was
removed from python-cinderclient in Train [3], meaning none of these
have worked since then. Clearly if no one has noticed or cared in the 6
years or so since that happened, it's safe to say we can delete these
commands.

[1] 3e91de956e
[2] 75ca60f619
[3] 2189e5702b

Change-Id: Ibe1cd6461d2cb78826467078aa17272f171746aa
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-04-01 10:46:03 +01:00
Stephen Finucane
7380fbe300 typing: Add types for empty dicts, tuples
In some cases, simply remove them.

Change-Id: I24a311a24eb533325dda83005777bcb2e0afc320
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-31 17:48:36 +01:00
Stephen Finucane
bdd55d989d typing: Indicate tuples to be extended
Change-Id: Ie5907de8d60f2f39e98f6a88227cebb2e2ff565c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-31 17:48:36 +01:00
Zuul
ab2e68f407 Merge "Prepare for ruff bump" 2025-03-31 10:37:30 +00:00
Stephen Finucane
290bc580e6 Prepare for ruff bump
Change-Id: Ia9c402edebc8537d5019d18920b6679b05ea4378
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-03-19 12:04:39 +00:00
Rajesh Tailor
f65e4835d3 Fix missing space in help messages
This change fixes missing space in help messages to make those
consistent and pretty rendering when calling help.

Change-Id: I947374821a4dbb5e68651c0e72fc5fd2f938e6a1
2025-03-05 19:58:27 +05:30
Zuul
eb0dbd5c33 Merge "Fix: Volume backup restore output" 2025-01-07 18:35:53 +00:00
Zuul
a631014551 Merge "Fix volume backup show by name" 2024-12-17 19:09:39 +00:00
Rajat Dhasmana
03e2fdd162 Fix: Volume backup restore output
Currently the volume backup restore command returns with error
even though the restore is initiated.
This patch corrects the response received from SDK and processes
it in a human readable form.

Change-Id: I7f020631fbb39ceef8740775fd82686d90a6c703
Closes-Bug: #2063335
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/931755
2024-12-17 17:46:35 +00:00
Rajat Dhasmana
03933e9a73 Fix: extend in-use volumes check
Currently we have 2 issues with extending volumes checks:

1. We don't specify explicitly that MV 3.42 needs to be passed for
in-use volumes
2. Any state of volume (error, attaching, detaching etc) can pass
this check by specifying MV 3.42

The fundamentally correct approach to these checks should be:

1. Only allow 'available' and 'in-use' volumes to be extended
2. Check MV 3.42 or greater is specified in case of 'in-use' volumes
otherwise fail

This approach is implemented in the patch.

Change-Id: I45ab9af953f7d060379f48ca429eaea7cfe857cc
2024-12-09 19:01:22 +05:30
Tobias Urdin
695d025f00 Show Created At column for volume backups in v3
The change in [1] erroneously only added the
created_at column for volume v2 API and not
also for the volume v3 API.

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

Change-Id: Iae0b4f21cbc31ae7464a79c8f5e01446ca4ff098
2024-10-17 16:25:13 +02:00
Rajat Dhasmana
b6b18489b0 Fix volume backup show by name
When we show a volume backup by name, it calls the get_backup
method in SDK which is only used for getting a backup by ID.
This patch modifies the approach to call find_backup method
which first tries the find by ID and then find by name logic
eventually returning the backup details.

Story: 2011234
Task: 51127
Change-Id: I926d8de9810fcf2e5335bbe35aaab15e1e36a5cb
2024-10-07 13:25:14 +00:00
Stephen Finucane
fc6852cd94 pre-commit: Migrate bandit to ruff
The name of the errors change and we need to move things around a
little, but it's otherwise a straight swap.

Change-Id: I0a19765ebeaa14c0534faa1542165b76ed2bf4e2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-12 18:08:23 +01:00
Stephen Finucane
519fa7aabc pre-commit: Migrate from black to ruff format
Change-Id: I28ca7d31d30272002799f3e2832105dc67c60538
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-08-29 15:55:39 +01:00
Stephen Finucane
2ba90581d5 pre-commit: Migrate from flake8 to ruff
Well, mostly. We still keep our own flake8 hooks and the hacking hooks
enabled. Everything else can be handled by ruff.

Doing this enables a couple of hacking checks that were previously
unaddressed. It also highlights a few cases that flake8 missed. Both are
addressed.

Change-Id: If81c7055e9ef692425da2789bae18a96d04b104f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-08-29 15:55:13 +01:00
Zuul
d385bd1e03 Merge "Show Created At column for volume backups" 2024-08-09 12:20:45 +00:00
Zuul
965c61c90c Merge "Add volume snapshot unmanage support" 2024-07-23 12:58:03 +00:00
Zuul
e650c3eeaa Merge "Add DeleteVolumeSnapshot class to v3" 2024-07-23 12:58:02 +00:00
Zuul
c47ccb9721 Merge "Followup: Reduce LOC in volume v3 service" 2024-07-23 12:58:00 +00:00
Stephen Finucane
55cbb84e60 volume: Migrate 'volume list' to compute SDK
Change-Id: Iae662aa6b391ba6ae5f569184c7d19fb3654be35
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-08 09:59:21 +01:00
whoami-rajat
9f30ee9af2 volume: Migrate 'volume attachment *' to SDK
This patch migrates the volume attachment create, get, list,
delete, update and complete commands to SDK.

Change-Id: Ib237d25cc1c3fc72946b9d088ff3447433162130
2024-07-08 09:59:21 +01:00
Stephen Finucane
3f624295ec volume: Add v3-specific volume transfer module
This makes testing easier.

Change-Id: I515aa54750439a6c4ad5b16cffe004ba1c7cf5b2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-08 09:59:21 +01:00
Stephen Finucane
f1f390f2ae volume: add v3-specific volume type module
This makes testing easier.

Change-Id: If1ed8d5003160e45d503971ae722fd9983d3dd6d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-08 09:59:21 +01:00
Stephen Finucane
65cce3943a volume: Add v3-specific volume module
This makes testing easier.

Change-Id: I6b31026ae3c9dc66d828744534b35bb0a0d2ffbe
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-08 09:59:21 +01:00
Stephen Finucane
ca91c826e3 volume: Add v3-specific volume backup module
This makes testing easier.

Change-Id: I71a13b34a85350af17612e12c03e6df8cb041f86
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-08 09:59:20 +01:00
Rajat Dhasmana
205bac3caf Fix: incremental volume backup
The incremental volume backup stopped working after we moved from
cinderclient to SDK[1]. This happened because SDK accepts the
``is_incremental`` parameter[2] rather than the ``incremental`` parameter
which is actually passed in the API request and was previously a valid
parameter for cinderclient.

This patch fixes the issue by passing the ``is_incremental`` field instead
of ``incremental`` from the OSC side which adds the ``incremental`` parameter
in the API request.

Request body after the fix:

'{"backup": {"name": null, "description": null, "volume_id": "<vol-id>",
"force": false, "container": null, "incremental": true}}'

[1] https://review.opendev.org/c/openstack/python-openstackclient/+/889748
[2] 10e5e20fc0/openstack/block_storage/v2/backup.py (L126-L134)

Closes-Bug: #2070080
Change-Id: I89bd3d2751267ec39f4dbd664b7873ab87a9ac6c
2024-07-01 21:11:46 +05:30
Rajat Dhasmana
f52e888dab Followup: Reduce LOC in volume v3 service
This is a followup of[1] in which we are reducing LOC by removing
redundant definition of columns.

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

Change-Id: I2992d3ab678e751726906926b680e4aa9ad1d502
2024-06-28 20:40:06 +05:30
Rajat Dhasmana
ca81b1acf0 Add cluster to volume service list
This patch adds the ``Cluster`` and ``Backend State`` columns to
the ``openstack volume service list`` command. Note that you need
to provide the appropriate microversion to show these columns.

Cluster: openstack --os-volume-api-version 3.7 volume service list
Backend State: openstack --os-volume-api-version 3.49 volume service list

Change-Id: Ie7727d0001307b5d5a40d7ea0348bdb9626f9e03
2024-06-27 19:37:15 +05:30
Rajat Dhasmana
4e94c415ed Add volume snapshot unmanage support
This patch adds support for unmanaging a snapshot with
``openstack volume snapshot delete --remote`` command.

Change-Id: I3caf3471a007fcb988835d495727bbc5c66f42f8
2024-06-25 01:51:50 +05:30
Rajat Dhasmana
49c42c73a2 Add DeleteVolumeSnapshot class to v3
This is done to support the snapshot unmanage command.

Change-Id: I174ad08c7c03fe7a9206d40645a6916f104212c6
2024-06-25 01:40:55 +05:30
Rajat Dhasmana
fdc2763ac2 Add support for volume unmanage
This patch adds support for unmanaging a volume with the
``openstack volume delete --remote`` command.

Change-Id: Id71681e817f6e56b4ef553079f0bcfac8252d3cf
2024-06-10 20:48:30 +05:30
Tobias Urdin
7eccd403c7 Show Created At column for volume backups
The ``volume backup list`` command does not show the
created_at column for backups which doesn't really
help the end-user since a critical part of a backup
is knowing when it was taken, and fast if there is
a rush doing recovery by restoring a volume from a
backup.

Change-Id: I8d8a7f36c468c9faa2c2c47bfa9ba9e1ca5b9858
2024-05-19 22:17:06 +02:00
Rajat Dhasmana
00af14b3f2 Add DeleteVolume class to v3
This is done to support the volume unmanage command.

Change-Id: Ib59b1f599be152a25c4b6a31988c28079f552ba9
2024-05-15 11:55:50 +05:30