From 2df57ab7dc7b9d7deb0eebad96036149760d607b Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Tue, 5 May 2015 18:08:25 +0530 Subject: glusterd/snapshot: Return correct errno in events of failure - PATCH 2 ENUM RETCODE ERROR ------------------------------------------------------------- EG_INTRNL 30800 Internal Error EG_OPNOTSUP 30801 Gluster Op Not Supported EG_ANOTRANS 30802 Another Transaction in Progress EG_BRCKDWN 30803 One or more brick is down EG_NODEDWN 30804 One or more node is down EG_HRDLMT 30805 Hard Limit is reached EG_NOVOL 30806 Volume does not exist EG_NOSNAP 30807 Snap does not exist EG_RBALRUN 30808 Rebalance is running EG_VOLRUN 30809 Volume is running EG_VOLSTP 30810 Volume is not running EG_VOLEXST 30811 Volume exists EG_SNAPEXST 30812 Snapshot exists EG_ISSNAP 30813 Volume is a snap volume EG_GEOREPRUN 30814 Geo-Replication is running EG_NOTTHINP 30815 Bricks are not thinly provisioned Change-Id: I49a170cdfd77df11fe677e09f4e063d99b159275 BUG: 1212413 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/10588 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Krishnan Parthasarathi --- tests/basic/op_errnos.t | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 tests/basic/op_errnos.t (limited to 'tests') diff --git a/tests/basic/op_errnos.t b/tests/basic/op_errnos.t new file mode 100755 index 00000000000..8b16267cb50 --- /dev/null +++ b/tests/basic/op_errnos.t @@ -0,0 +1,38 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../snapshot.rc + +function get-op_errno-xml() +{ + $CLI $1 --xml | xmllint --format - | grep opErrno | sed 's/\(\|<\/opErrno>\)//g' +} + +cleanup; +TEST verify_lvm_version; +TEST glusterd; +TEST pidof glusterd; + +TEST setup_lvm 1 + +TEST $CLI volume create $V0 $H0:$L1 +TEST $CLI volume start $V0 +TEST $CLI volume create $V1 replica 2 stripe 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; +TEST $CLI volume start $V1 + +EXPECT 0 get-op_errno-xml "snapshot create snap1 $V0 no-timestamp" +EXPECT 30806 get-op_errno-xml "snapshot create snap1 imaginary_volume" +EXPECT 30807 get-op_errno-xml "snapshot delete imaginary_snap" +EXPECT 30809 get-op_errno-xml "snapshot restore snap1" +TEST $CLI volume stop $V0 +EXPECT 30810 get-op_errno-xml "snapshot create snap1 $V0" +TEST $CLI volume start $V0 +EXPECT 30811 get-op_errno-xml "snapshot clone $V0 snap1" +EXPECT 30812 get-op_errno-xml "snapshot create snap1 $V0 no-timestamp" +EXPECT 30815 get-op_errno-xml "snapshot create snap2 $V1 no-timestamp" + +EXPECT 0 get-op_errno-xml "snapshot delete snap1" +TEST $CLI volume stop $V0 +TEST $CLI volume stop $V1 + +cleanup; -- cgit