Bug 1024420

Summary: cannot force delete a volume snapshot (which prevents volume delete in case of snapshot delete fails)
Product: Red Hat OpenStack Reporter: Yogev Rabl <yrabl>
Component: openstack-cinderAssignee: Eric Harney <eharney>
Status: CLOSED UPSTREAM QA Contact: Dafna Ron <dron>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.0CC: eharney, geoff.willett, jraju, pbandark, scohen, sgotliv, yeylon
Target Milestone: ---Keywords: FutureFeature
Target Release: 9.0 (Mitaka)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: Improve force-delete capabilities Reason: Result (if any):
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-10 14:17:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
debug logs none

Description Yogev Rabl 2013-10-29 15:48:49 UTC
Created attachment 817125 [details]
debug logs

Description of problem:
The 'cinder force-delete' command should remove any volume in any state. The command fails when trying to delete a volume that has a snapshot.

Version-Release number of selected component (if applicable):

openstack-nova-compute-2013.1.4-1.el6ost.noarch
openstack-nova-scheduler-2013.1.4-1.el6ost.noarch
python-django-openstack-auth-1.0.6-2.el6ost.noarch
redhat-access-plugin-openstack-1.2.0-6.el6ost.noarch
openstack-utils-2013.1-8.1.el6ost.noarch
openstack-glance-2013.1.4-1.el6ost.noarch
openstack-selinux-0.1.2-10.el6ost.noarch
openstack-cinder-2013.1.4-2.el6ost.noarch
openstack-nova-api-2013.1.4-1.el6ost.noarch
openstack-nova-console-2013.1.4-1.el6ost.noarch
openstack-nova-conductor-2013.1.4-1.el6ost.noarch
openstack-nova-novncproxy-0.4-6.el6ost.noarch
openstack-nova-cert-2013.1.4-1.el6ost.noarch
openstack-quantum-2013.1.4-3.el6ost.noarch
openstack-dashboard-2013.1.4-1.el6ost.noarch
openstack-keystone-2013.1.4-1.el6ost.noarch
openstack-nova-common-2013.1.4-1.el6ost.noarch
openstack-quantum-openvswitch-2013.1.4-3.el6ost.noarch
openstack-packstack-2013.1.1-0.33.dev695.el6ost.noarch

OS version:
Red Hat Enterprise Linux Server release 6.5 Beta

How reproducible:
everytime

Steps to Reproduce:
1. Create a volume 
2. create a snapshot of the volume
3. try to force-delete the volume

Actual results:
The Cinder won't delete a volume with a snapshot

Expected results:
The volume should be deleted.

Additional info:

Comment 2 Eric Harney 2013-10-29 16:24:41 UTC
The only difference between delete and force-delete currently is that force-delete doesn't check what state the volume is in when attempting the delete.  The operation can still fail for any number of reasons.

# cinder help force-delete
...
Attempt forced removal of a volume, regardless of its state.
..

Comment 3 Dafna Ron 2014-02-04 10:58:43 UTC
changing this bug since the actual problem is that if a snapshot cannot be deleted we also cannot remove the volume. 
to solve the issue, after discussing with Ayal, we should add a way to force delete a snapshot.

Comment 4 Eric Harney 2014-02-04 15:30:35 UTC
There is already a different way to achieve this:

cinder snapshot-reset-state --state error <snap>
cinder delete <snap>

Comment 5 Dafna Ron 2014-02-10 09:06:59 UTC
this is not a way to force remove a snapshot since if a failure happens and we cannot delete the snapshot, resetting the state will not help the second time. 
we need a way to force remove a snapshot regardless of any errors during delete.

Comment 6 Eric Harney 2014-02-10 14:13:28 UTC
(In reply to Dafna Ron from comment #5)

I don't think Cinder can be expected to behave that way.  If Cinder "removes" the snapshot regardless of the state of the storage backend, it's leaving things in an inconsistent state.  At worst, this may break things, or at best, is pretty messy, because then Cinder allows you leak resources (i.e. snapshots / storage use on a SAN) which would cause all kinds of headaches with manual cleanup, actual storage use being more than what the quota allows, etc.

If there is some case where this is desirable, it would have to be put into cinder-manage and not a normal API/client operation.

Comment 7 Dafna Ron 2014-02-10 16:03:50 UTC
There are plenty of cases where we would need this now since both Yogev and I encountered these situation in our tests. 
not sure why this cannot be in API/Client? don't nanny the user... if they use --force it's their problem no?

Comment 8 Geoff Willett 2014-04-24 12:11:09 UTC
I hit this issue when XIV had insufficient room to create the snapshot in the pool - so agree a force-delete for snapshots is required (and up to the user to tidy-up any back-end storage 'orphans').

Comment 13 Sean Cohen 2016-03-10 14:38:14 UTC
See bug 1293185