RemoteFS: fix volume cascade delete

Attempting to delete a volume along with its snapshots fails for
RemoteFS based drivers. The reason is that that the driver expects
the volume status to be 'available', 'in-use' or 'backing-up',
while in this situation the volume status would be 'deleting'.

Most of those drivers apply locks to the volume/snapshot deletion
methods, so it should be safe to just add 'deleting' to the list of
acceptable volume states for this operation.

Change-Id: I1242d03fb6bbbd40ac2dace1aa865a6f91c22d23
Closes-Bug: #1681406
This commit is contained in:
Lucian Petrut 2017-04-10 14:08:34 +03:00
parent 6fe71ea504
commit 78a532cdd6
1 changed files with 4 additions and 3 deletions

View File

@ -1012,9 +1012,10 @@ class RemoteFSSnapDriverBase(RemoteFSDriver):
else 'offline')})
volume_status = snapshot.volume.status
if volume_status not in ['available', 'in-use', 'backing-up']:
msg = _("Volume status must be 'available', 'in-use' or "
"'backing-up' but is: "
if volume_status not in ['available', 'in-use',
'backing-up', 'deleting']:
msg = _("Volume status must be 'available', 'in-use', "
"'backing-up' or 'deleting' but is: "
"%(status)s.") % {'status': volume_status}
raise exception.InvalidVolume(msg)