Error when deleting a volume with snapshots not surfaced well

Bug #1020326 reported by Gabriel Hurley
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Tihomir Trifonov

Bug Description

It is illegal to delete a volume which has "dependent" snapshots; the snapshots must be deleted first. However, this message is not surfaced to the user leaving them with no explanation why the volume can't be deleted.

Sadly, there's no data returned by the API to indicate this fact *before* attempting the deletion, so I'm not sure what the best solution is.

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

It is interesting - the Volume object has a property 'snapshot_id' which is None, but the volume has snapshot. If Nova can somehow populate this with the snapshot id, we can hide the 'Delete' action for these volumes...

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

Actually the snapshot_id field means that the volume is created from a snapshot..
As I see when executing 'lvdisplay' :

  LV Name /dev/n-volumes/volume-528b8d8d-8067-436b-8677-3892369dce83
  VG Name n-volumes
  LV UUID gltzr2-2bWw-4vnV-CS4h-OICa-dlab-naKik2
  LV Write Access read/write
  LV snapshot status source of
                         /dev/n-volumes/_snapshot-6863b9ff-3604-4966-83cf-c7fbf73ee056 [active]

There is a flag that the volume has an active snapshot. But it seems nova is using a higher-level driver - tgtadm to load volume data, and this flag is not available there.

Maybe it would be nice if the volume metadata is being updated with a flag when a snapshot is created/removed, and this flag to be passed...

One solution is to check first if there is a snapshot with volume_id == vol_id of the volume to be deleted, and to show warning/error message before the actual delete attempt.
Or just to catch the exception and show a hint what the reason could be ..

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

Here are 2 possible solutions, but none of them is perfect..

1. Load all snapshost on page load and allow the 'Delete' action only of there is no Snapshot with the specified volume id.
  Pros - we will hide 'Delete' button for volumes that cannot be deleted.
  Cons - when trying to delete a volume using the Table 'Delete' Action and 'select-all' checkbox, an error will be displayed: "You do not have permissions to delete volume: xxxx', which is misleading a bit...

2. Catch the exception on 'delete()' and process it to see if it is caused by an existing snapshot.
  Pros - this works on delete, no need to pre-load anything.
  Cons - needs some refactoring for BatchAction class, as it ignores the exception error. It might be fixed to work with 2 errors, but.. again not the perfect solution.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

I'd go with option 2 as a temporary fix. We've special-cased a few other exceptions in this manner.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Moving to RC1 since it's not urgent.

Changed in horizon:
milestone: folsom-3 → folsom-rc1
Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

This can now be addressed in the larger context of a fix for https://bugs.launchpad.net/horizon/+bug/1037241

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/12417

Changed in horizon:
assignee: Nebula (nebula) → Tihomir Trifonov (ttrifonov)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/12417
Committed: http://github.com/openstack/horizon/commit/ceb22f13b901dced411afc1b9174b1514aee18b7
Submitter: Jenkins
Branch: master

commit ceb22f13b901dced411afc1b9174b1514aee18b7
Author: Tihomir Trifonov <email address hidden>
Date: Wed Sep 5 15:10:10 2012 +0300

    Adds a method for overriding specific API messages.

    Also provides a specific error message for dependent snapshots
    during volume deletion.

    Fixes bug 1037241. Fixes bug 1020326.

    Change-Id: I40e5f537bc1806ec97c21f3eeea1d74beca04250

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: folsom-rc1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.