diff options
| author | Dr. Jens Harbott <harbott@osism.tech> | 2021-12-07 18:33:54 +0100 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2021-12-08 17:59:27 +0000 |
| commit | 32e18253faa742aae5a4c9708a8a505c85ebb317 (patch) | |
| tree | a2a474440d96c19e5b0487bb90840415d285cdfe /openstackclient/compute | |
| parent | 9eb42403d3aa4e0005c4914a20ce3e3dc53cbc22 (diff) | |
| download | python-openstackclient-32e18253faa742aae5a4c9708a8a505c85ebb317.tar.gz | |
Fix RemoveServerVolume
The nova API we're using to delete a server volume attachment needs to
be handed a volume, not a volume attachment.
Also make sure that we create an error if the volume isn't actually
attached to the server.
Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Co-authored-by: Stephen Finucane <sfinucan@redhat.com>
Change-Id: I12abd3787ea47acb4da282d00fdc1989405a0564
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index fb13d305..a18ce810 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -3833,17 +3833,11 @@ class RemoveServerVolume(command.Command): ignore_missing=False, ) - volume_attachments = compute_client.volume_attachments(server) - for volume_attachment in volume_attachments: - if volume_attachment.volume_id == volume.id: - compute_client.delete_volume_attachment( - volume_attachment, - server, - ) - break - else: - msg = _('Target volume attachment not found.') - raise exceptions.CommandError(msg) + compute_client.delete_volume_attachment( + volume, + server, + ignore_missing=False, + ) class RescueServer(command.Command): |
