From 0ce369a0aa511e98fd71c0337181a5577b2d8a1f Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 13 Mar 2014 01:04:40 +0000 Subject: glusterd/snapshot: Making snap operations crash consistent In the events of a volume's brick being down, or a node being down, making snap ops like create, delete, restore, and status crash consistent. Marking snap status of snap bricks which were not snapshotted because the volume brick was down as -1, and not starting those snap bricks till the snapshot is taken. During delete bypassing lvm snapshot remove for snap bricks whose snap status is -1 During restore bypass replacing xattrs on the snapshot bricks whose snap status is -1. Also bumping restored volume's version so as to handle nodes being down. On handshake of a restored volume, passing brick's snap_status as well. During snapshot status of the non-snapshotted brick details display "N/A". If a node is down, the entry itself will not be displayed. Change-Id: Id042efd7507829995270da0b2b2a6282a08a053d Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7241 Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Rajesh Joseph Tested-by: Rajesh Joseph --- cli/src/cli-rpc-ops.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6e0f24d5f..e3eae022a 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -8106,9 +8106,9 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) ret = dict_get_str (dict, key, &buffer); if (ret) { - gf_log ("cli", GF_LOG_ERROR, + gf_log ("cli", GF_LOG_INFO, "Unable to get Brick Path"); - goto out; + continue; } cli_out ("\n\t%-17s %s %s", "Brick Path", ":", buffer); @@ -8120,11 +8120,11 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) ret = dict_get_str (dict, key, &buffer); if (ret) { - gf_log ("cli", GF_LOG_ERROR, + gf_log ("cli", GF_LOG_INFO, "Unable to get Volume Group"); - goto out; - } - cli_out ("\t%-17s %s %s", "Volume Group", ":", buffer); + cli_out ("\t%-17s %s %s", "Volume Group", ":", "N/A"); + } else + cli_out ("\t%-17s %s %s", "Volume Group", ":", buffer); ret = snprintf (key, sizeof (key), "%s.brick%d.status", key_prefix, i); @@ -8134,11 +8134,11 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) ret = dict_get_str (dict, key, &buffer); if (ret) { - gf_log ("cli", GF_LOG_ERROR, + gf_log ("cli", GF_LOG_INFO, "Unable to get Brick Running"); - goto out; - } - cli_out ("\t%-17s %s %s", "Brick Running", ":", buffer); + cli_out ("\t%-17s %s %s", "Brick Running", ":", "N/A"); + } else + cli_out ("\t%-17s %s %s", "Brick Running", ":", buffer); ret = snprintf (key, sizeof (key), "%s.brick%d.pid", key_prefix, i); @@ -8147,13 +8147,12 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) } ret = dict_get_int32 (dict, key, &pid); - if (!ret) { + if (ret) { + gf_log ("cli", GF_LOG_INFO, + "Unable to get pid"); + cli_out ("\t%-17s %s %s", "Brick PID", ":", "N/A"); + } else cli_out ("\t%-17s %s %d", "Brick PID", ":", pid); - } - else { - cli_out ("\t%-17s %s %s", "Brick PID", ":", - "Brick Process is down"); - } ret = snprintf (key, sizeof (key), "%s.brick%d.data", key_prefix, i); @@ -8163,11 +8162,11 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) ret = dict_get_str (dict, key, &buffer); if (ret) { - gf_log ("cli", GF_LOG_ERROR, + gf_log ("cli", GF_LOG_INFO, "Unable to get Data Percent"); - goto out; - } - cli_out ("\t%-17s %s %s", "Data Percentage", ":", buffer); + cli_out ("\t%-17s %s %s", "Data Percentage", ":", "N/A"); + } else + cli_out ("\t%-17s %s %s", "Data Percentage", ":", buffer); ret = snprintf (key, sizeof (key), "%s.brick%d.lvsize", key_prefix, i); @@ -8176,10 +8175,10 @@ cli_get_snap_volume_status (dict_t *dict, char *key_prefix) } ret = dict_get_str (dict, key, &buffer); if (ret) { - gf_log ("cli", GF_LOG_ERROR, "Unable to get LV Size"); - goto out; - } - cli_out ("\t%-17s %s %s", "LV Size", ":", buffer); + gf_log ("cli", GF_LOG_INFO, "Unable to get LV Size"); + cli_out ("\t%-17s %s %s", "LV Size", ":", "N/A"); + } else + cli_out ("\t%-17s %s %s", "LV Size", ":", buffer); } out : -- cgit