diff options
author | Avra Sengupta <asengupt@redhat.com> | 2016-04-12 12:26:54 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2016-08-23 00:11:54 -0700 |
commit | efbae0fef5399a8826782b02140f44edaea0dac3 (patch) | |
tree | 78c5fdc656ee64a024d79ccbd02941a47d2ee600 /cli/src/cli-rpc-ops.c | |
parent | 1df4a89de17e44c8c1f9b4794a7b8c2741f2bc2e (diff) |
snapshot/cli: Fix snapshot status xml output
snap status --xml errors out if a brick is down and
doesn't have pid. It is handled in the cli of the snap
status where "N/A" is displayed in such a scenario.
Handled the same in xml
snap status <snapname> --xml fails as the writer is
not initialised for the same. Using GF_SNAP_STATUS_TYPE_ITER
instead of GF_SNAP_STATUS_TYPE_SNAP for all snap's
status to differentiate between the two scenarios.
Added testcase volume-snapshot-xml.t to check
all snapshot commands xml outputs
Change-Id: I99563e8f3e84f1aaeabd865326bb825c44f5c745
BUG: 1325831
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/14018
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 0bf03bceaa2..441f4247c45 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -9908,7 +9908,7 @@ cli_populate_req_dict_for_status (dict_t *snap_dict, dict_t *dict, int index) { GF_ASSERT (dict); ret = dict_set_uint32 (snap_dict, "sub-cmd", - GF_SNAP_STATUS_TYPE_SNAP); + GF_SNAP_STATUS_TYPE_ITER); if (ret) { gf_log ("cli", GF_LOG_ERROR, "Could not save command " "type in snap dict"); @@ -10000,7 +10000,8 @@ cli_snapshot_status (dict_t *dict, gf_cli_rsp *rsp, goto out; } - if (status_cmd != GF_SNAP_STATUS_TYPE_SNAP) { + if ((status_cmd != GF_SNAP_STATUS_TYPE_SNAP) && + (status_cmd != GF_SNAP_STATUS_TYPE_ITER)) { dict_copy (dict, local->dict); goto out; } @@ -10484,7 +10485,8 @@ gf_cli_snapshot_for_status (call_frame_t *frame, xlator_t *this, * is already handled. Therefore we can return from here. * If want to get status of all snaps in the system or volume then * we should get them one by one.*/ - if (cmd == GF_SNAP_STATUS_TYPE_SNAP) { + if ((cmd == GF_SNAP_STATUS_TYPE_SNAP) || + (cmd == GF_SNAP_STATUS_TYPE_ITER)) { ret = 0; goto out; } |