summaryrefslogtreecommitdiff
path: root/openstackclient/volume
diff options
context:
space:
mode:
authorJan Hartkopf <jhartkopf@inovex.de>2022-03-08 15:55:55 +0100
committerJan Hartkopf <jhartkopf@inovex.de>2022-03-08 16:28:43 +0100
commit8acead32ee0a22b6e3339ae62cdb0a501e4134fd (patch)
treef17ac96cf25e023a5503ce905fabfcde4a155060 /openstackclient/volume
parent63452f362dc42c1edc09e6f7ada08c834ab31923 (diff)
downloadpython-openstackclient-8acead32ee0a22b6e3339ae62cdb0a501e4134fd.tar.gz
volume: fix backup list of deleted volume
When trying to list backups of a deleted volume with --volume, openstackclient fails because the volume does not exist. However, for listing a volume's backups, the volume itself does not need to be present. Fix this issue by allowing the volume of the requested backups to not exist. Story: 2009901 Task: 44716 Change-Id: Iea1a567151f427fa0e1ccff3af5cbeab620defcd Signed-off-by: Jan Hartkopf <jhartkopf@inovex.de>
Diffstat (limited to 'openstackclient/volume')
-rw-r--r--openstackclient/volume/v2/volume_backup.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/openstackclient/volume/v2/volume_backup.py b/openstackclient/volume/v2/volume_backup.py
index 96b22a68..f2d89dc7 100644
--- a/openstackclient/volume/v2/volume_backup.py
+++ b/openstackclient/volume/v2/volume_backup.py
@@ -310,9 +310,17 @@ class ListVolumeBackup(command.Lister):
filter_volume_id = None
if parsed_args.volume:
- filter_volume_id = utils.find_resource(
- volume_client.volumes, parsed_args.volume,
- ).id
+ try:
+ filter_volume_id = utils.find_resource(
+ volume_client.volumes, parsed_args.volume,
+ ).id
+ except exceptions.CommandError:
+ # Volume with that ID does not exist, but search for backups
+ # for that volume nevertheless
+ LOG.debug("No volume with ID %s existing, continuing to "
+ "search for backups for that volume ID",
+ parsed_args.volume)
+ filter_volume_id = parsed_args.volume
marker_backup_id = None
if parsed_args.marker: