Bug 1111148

Summary: [SNAPSHOT]: Clear message is required when attempting to delete non-existing snap
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Rahul Hinduja <rhinduja>
Component: snapshotAssignee: rjoseph
Status: CLOSED ERRATA QA Contact: Rahul Hinduja <rhinduja>
Severity: medium Docs Contact:
Priority: medium    
Version: rhgs-3.0CC: asrivast, nsathyan, rhs-bugs, senaik, ssamanta, storage-qa-internal, vagarwal
Target Milestone: ---   
Target Release: RHGS 3.0.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: SNAPSHOT
Fixed In Version: glusterfs-3.6.0.23-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1111603 (view as bug list) Environment:
Last Closed: 2014-09-22 19:42:18 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1111603    

Description Rahul Hinduja 2014-06-19 11:18:56 UTC
Description of problem:
=======================

When we try to delete a non-existing snap, it should gracefully fail with error "does not exist". Currently it is failing as:

[root@inception ~]# gluster snapshot delete snap1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: snap snap1 might not be in an usable state.
Snapshot command failed
[root@inception ~]# 


This is a regression bug, it used to gracefully fail. The message "might not be in an usable state" only makes sense when a delete is started for an existing snap and for some reason delete fails to delete a snap and we print this message that "it might not be in an usable state", because we really dont know how much the back end clean-up has happened 

But, if we attempt to delete a snap which doesnt exist it should fail as:

[root@inception ~]# gluster snapshot delete snap1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: snap snap1 does not exist.
Snapshot command failed
[root@inception ~]# 


Version-Release number of selected component (if applicable):
=============================================================
glusterfs-3.6.0.19-1.el6rhs.x86_64


How reproducible:
=================
1/1


Steps to Reproduce:
===================
1. gluster snapshot delete <non-existing-snap>

Actual results:
===============


[root@inception ~]# gluster snapshot delete snap1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: snap snap1 might not be in an usable state.
Snapshot command failed
[root@inception ~]# 

Expected results:
==================

[root@inception ~]# gluster snapshot delete snap1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: snap snap1 does not exist.
Snapshot command failed
[root@inception ~]#

Comment 1 senaik 2014-06-20 11:18:38 UTC
Version : glusterfs 3.6.0.20 built on Jun 19 2014
=======

While snapshots creation in progress on a volume , if snapshot delete is executed, instead of failing with "Another Transaction is in progress" it fails with "<snap_name> might not be in an usable state

for i in {1..100}; do gluster snap create snap_1_$i vol0 ; done 
snapshot create: success: Snap snap_1_1 created successfully
snapshot create: success: Snap snap_1_2 created successfully
snapshot create: success: Snap snap_1_3 created successfully
snapshot create: success: Snap snap_1_4 created successfully
snapshot create: success: Snap snap_1_5 created successfully


gluster snapshot delete snap_1_2
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: snap snap_1_2 might not be in an usable state.
Snapshot command failed

------------Part of the Log-----------------------

 E [glusterd-locks.c:228:glusterd_acquire_multiple_locks_per_entity] 0-management: Failed to acquire lock for vol vol0 on behalf of 1edef405-58c2-4a81-b7a3-50925c6f8035. Reversing this transaction
[2014-06-20 10:57:04.097204] E [glusterd-locks.c:387:glusterd_mgmt_v3_lock_entity] 0-management: Failed to acquire all vol locks
[2014-06-20 10:57:04.097226] E [glusterd-locks.c:464:glusterd_multiple_mgmt_v3_lock] 0-management: Unable to lock all vol
[2014-06-20 10:57:04.097241] E [glusterd-mgmt.c:401:glusterd_mgmt_v3_initiate_lockdown] 0-management: Failed to acquire mgmt_v3 locks on localhost
[2014-06-20 10:57:04.097258] E [glusterd-mgmt.c:1821:glusterd_mgmt_v3_initiate_snap_phases] 0-management: mgmt_v3 lockdown failed.
[2014-06-20 10:57:04.097464] E [glusterd-mgmt.c:1311:glusterd_mgmt_v3_post_validate] (-->/usr/lib64/glusterfs/3.6.0.20/xlator/mgmt/glusterd.so(glusterd_handle_snapshot_fn+0x5fb) [0x7f8a0dde440b] (-->/usr/lib64/glusterfs/3.6.0.20/xlator/mgmt/glusterd.so(glusterd_handle_snapshot_remove+0x258) [0x7f8a0ddd7e88] (-->/usr/lib64/glusterfs/3.6.0.20/xlator/mgmt/glusterd.so(glusterd_mgmt_v3_initiate_snap_phases+0x152) [0x7f8a0ddebc32]))) 0-management: invalid argument: req_dict
[2014-06-20 10:57:04.097487] E [glusterd-mgmt.c:1944:glusterd_mgmt_v3_initiate_snap_phases] 0-management: Post Validation Failed

Comment 2 rjoseph 2014-06-23 10:47:46 UTC
Patch posted downstream: https://code.engineering.redhat.com/gerrit/#/c/27536/

Comment 5 Rahul Hinduja 2014-07-07 11:19:03 UTC
verified with build: glusterfs-3.6.0.24-1.el6rhs.x86_64

Case 1: Deletion of non existing snap

[root@inception 07July-2014]# gluster snapshot delete s1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: Snap (s1) does not exist
Snapshot command failed
[root@inception 07July-2014]# 

Case 2: Deletion of a snapshot when creation is in progress.

[root@rhs-arch-srv2 07July-2014]# gluster snapshot delete snap51
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: Another transaction is in progress Please try again after sometime.
Snapshot command failed
[root@rhs-arch-srv2 07July-2014]# gluster snapshot delete snap1
Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y
snapshot delete: failed: Another transaction is in progress Please try again after sometime.
Snapshot command failed
[root@rhs-arch-srv2 07July-2014]# 


Moving the bug to verified state.

Comment 7 errata-xmlrpc 2014-09-22 19:42:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1278.html