From 1b5ed7e2ee3a3ac7d85e649b4ed3adc170f3a9a1 Mon Sep 17 00:00:00 2001 From: Samikshan Bairagya Date: Tue, 29 Mar 2016 16:24:07 +0530 Subject: Fix opRet value for volume info --xml call on non-existent volume The opRet field was being assigned to 0 in the XML output when a gluster volume info --xml call is made on a non-existent volume. This change assigns a value of -1 to opRet for volume info calls for non-existent volumes. Other fields like opErrno and opErrstr are also assigned relevant values > Reviewed-on: http://review.gluster.org/13843 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > Reviewed-by: darshan n > Reviewed-by: Atin Mukherjee > NetBSD-regression: NetBSD Build System (cherry picked from commit a6e551122c603ab0cba798e7e2b30d3a15191b68) Change-Id: I3920c602328f74252c87bb521f5a43d4bdc7d44d BUG: 1352880 Signed-off-by: Samikshan Bairagya Reviewed-on: http://review.gluster.org/14863 NetBSD-regression: NetBSD Build System Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- ...-1321836-fix-opret-for-volume-info-xml-output.t | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/bugs/glusterd/bug-1321836-fix-opret-for-volume-info-xml-output.t (limited to 'tests/bugs') diff --git a/tests/bugs/glusterd/bug-1321836-fix-opret-for-volume-info-xml-output.t b/tests/bugs/glusterd/bug-1321836-fix-opret-for-volume-info-xml-output.t new file mode 100644 index 00000000000..48fccc621d8 --- /dev/null +++ b/tests/bugs/glusterd/bug-1321836-fix-opret-for-volume-info-xml-output.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../cluster.rc + +## Check that opRet field has correct value assigned for non existent volumes +## -------------------------------------------------------------------------- + +function get_opret_value () { + local VOL=$1 + $CLI volume info $VOL --xml | sed -ne 's/.*\([-0-9]*\)<\/opRet>/\1/p' +} + +cleanup; + +TEST glusterd; +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/$V0; + +EXPECT 0 get_opret_value $V0 +EXPECT -1 get_opret_value "novol" + +cleanup; -- cgit