Bug 1040978

Summary: [SNAPSHOT]:Need clearer messages while creating SNAP with invalid scenaios
Product: Red Hat Gluster Storage Reporter: senaik
Component: snapshotAssignee: Sachin Pandit <spandit>
Status: CLOSED ERRATA QA Contact: senaik
Severity: medium Docs Contact:
Priority: medium    
Version: rhgs-3.0CC: jturner, nsathyan, rhinduja, rhs-bugs, rjoseph, sdharane, spandit, ssamanta, storage-qa-internal
Target Milestone: ---Keywords: Reopened
Target Release: RHGS 3.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: SNAPSHOT
Fixed In Version: 3.4.1.6.snap.mar25.2014 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-22 19:30:17 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:

Description senaik 2013-12-12 13:02:16 UTC
Description of problem:
======================
1) Creating CG with no CG name provided fails with "Invalid snap name arguments"

2) Creating a CG with more than one CG name or CG description provided fails with the following message :

snapshot create: failed: Invalid snap name arguments

3)Creating a CG with description , but -d option not specified fails with error:

snapshot create: failed: Pre-validation failed on localhost. Please check log file for details

Version-Release number of selected component (if applicable):
=============================================================
glusterfs 3.4.0.snap.dec03.2013git

How reproducible:
================
always


Steps to Reproduce:
==================
1.Create 2 volumes and start it 

2. Create CG with no name provided :

gluster snapshot create volume2 volume3 -n
snapshot create: failed: Invalid snap name arguments
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]

It should fail with "Invalid CG name arguments"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3.Create a CG with more than one CG name or description provided 

gluster snapshot create volume2 volume3 -n CG8 CG9
snapshot create: failed: Invalid snap name arguments
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]

gluster snapshot create volume2 volume3 -n CG8 "new CG" "new CG"
snapshot create: failed: Invalid snap name arguments
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]

It would be better if we could provide a clearer message stating that more than one CG name or CG description was provided and hence the command failed as below:

gluster snapshot create volume2 volume3 -n CG8 CG9
snapshot create: failed: More than one CG name provided
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]

gluster snapshot create volume2 volume3 -n CG8 "new CG" "new CG"
snapshot create: failed: More than one description provided
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.Create a CG with description , but -d option not specified
gluster snapshot create volume2 volume3 "description"
snapshot create: failed: Pre-validation failed on localhost. Please check log file for details
Snapshot command failed

"Invalid CG name arguments" along with the usage should be displayed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Actual results:


Expected results:


Additional info:

Comment 2 senaik 2013-12-13 05:57:25 UTC
More Invalid Scenarios : 
======================

5) Create a CG with -N option

gluster snapshot create volume2 volume3 -N CG8 
snapshot create: failed: Pre-validation failed on localhost. Please check log file for details
Snapshot command failed

"Invalid CG name arguments" along with the usage should be displayed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6) Create CG with Invalid volume name 

 gluster snapshot create -volume2 -volume3 -n CG8 
snapshot create: failed: Pre-validation failed on localhost. Please check log file for details
Snapshot command failed


snapshot create: failed: Invalid volume name along with usage should be displayed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7) Creating a CG of volume when the volume is offline 

 gluster snapshot create volume2 volume3 -n CG9
snapshot create: failed: Pre-validation failed on localhost. Please check log file for details
Snapshot command failed


snapshot create: failed: Volume is offline along with usage should be displayed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8) Create a CG with -n as the CG name 

gluster snapshot create volume3 volume2 -n "-n"
snapshot create: failed: Options(-n/-d) are not valid snap names
Usage: snapshot create <volnames> [-n <snap-name|cg-name>] [-d <description>]


snapshot create: failed: Options(-n/-d) are not valid CG names should be displayed along with the usage 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment 3 Rahul Hinduja 2013-12-18 07:23:40 UTC
similar changes would require in case of snap creation

one such instance is: 

[root@snapshot-09 ~]# gluster snapshot create vol-snap0 -N snap1
snapshot create: failed: Pre-validation failed on localhost. Please check log file for details
Snapshot command failed
[root@snapshot-09 ~]#

Comment 4 rjoseph 2014-02-07 09:04:35 UTC
CG functionality is dropped from the requirement list.

Comment 8 senaik 2014-03-14 08:48:11 UTC
Version : glusterfs 3.4.1.2.snap.mar11.2014git

Invalid Scenarios :
=================
1) No snap name provided while creating snapshot gives Usage as shown below. It would be better if we could also give a message "Please provide snap name" along with the Usage

gluster snapshot create vol0
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]

2) gluster snapshot create "snap2 snap3" vol0
snapshot create: failed: Commit failed on localhost. Please check log
file for details.
Snapshot command failed

We could mention Invalid Arguments along with usage in this scenario instead of mentioning "Commit failed" 

3)Creating snapshot with more than 1 description 

gluster snapshot create snap3 vol0 description "%^*&" "abcd"
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]

Give a valid message along with the Usage 

4)Creating snapshot without description 

gluster snapshot create snap4 vol1 description
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]

gluster snapshot create snap5 vol1 "description"
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]

Provide a message such as "Please provide description" along with the usage

Comment 9 Sachin Pandit 2014-03-25 10:05:12 UTC
Fix for this can be found in http://review.gluster.org/#/c/7324/

Comment 10 Nagaprasad Sathyanarayana 2014-04-01 08:56:22 UTC
Giving devel ack to snapshot bugz

Comment 11 senaik 2014-04-07 12:40:50 UTC
Version : glusterfs 3.4.1.7.snap.mar27.2014
=======

[root@snapshot-01 ~]# gluster snapshot create vol0
Invalid Syntax.
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]


[root@snapshot-01 ~]# gluster snapshot create "snap2 snap3" vol0
Please provide a valid snapname
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]


[root@snapshot-01 ~]# gluster snapshot create snap3 vol0 description
"%^*&" "abcd"
Invalid Syntax.
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]


[root@snapshot-01 ~]# gluster snapshot create snap4 vol1 description
Please provide a description
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]


[root@snapshot-01 ~]# gluster snapshot create snap5 vol1 "description"
Please provide a description
Usage: snapshot create <snapname> <volname(s)> [description
<description>] [force]


Marking the bug as 'Verified'

Comment 12 Nagaprasad Sathyanarayana 2014-04-21 06:18:15 UTC
Marking snapshot BZs to RHS 3.0.

Comment 13 Nagaprasad Sathyanarayana 2014-05-19 10:56:38 UTC
Setting flags required to add BZs to RHS 3.0 Errata

Comment 16 errata-xmlrpc 2014-09-22 19:30:17 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