Switch volume delete to use the ID 10/61910/3 v0.27.0
authorMohammed Naser <mnaser@vexxhost.com>
Thu, 3 Oct 2019 14:45:35 +0000 (10:45 -0400)
committerMohammed Naser <mnaser@vexxhost.com>
Thu, 3 Oct 2019 15:58:01 +0000 (11:58 -0400)
commit04e46d1afacbfcd1333caeba38a47b101e3938ea
tree31b133c8a689ff564c2082ba797a4d1ec061f788
parent9428cd07e8f32af4d256d7fec9c8e22718323012
Switch volume delete to use the ID

At the moment, the current code that's used when deleting volumes
uses a function that attempts to pull by ID, and then falls back
to name.

This is potentially dangerous because it might match more than one
volume and therefore potentially delete the wrong volume.  This
patch revises the code to enforce retrieving the volume based on
the ID instead which is globally unique.

The tools that leverage this inside releng-global-jjb already
provide an ID at the moment[1].

[1]: https://github.com/lfit/releng-global-jjb/blob/d22d069117b64cee73be1165861013de9e79ab19/shell/openstack-cleanup-orphaned-volumes.sh#L18

Change-Id: I078c8c4447ac308c66678e86ae31e8947f40340e
Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
lftools/openstack/cmd.py
lftools/openstack/volume.py