Patchwork [BUG:1708] mgmt/glusterd: perform post operations of volume set

login
register
Submitter Pranith K
Date 2010-09-27 05:25:41
Message ID <20100927052540.GA20766@dev.gluster.com>
Download mbox | patch
Permalink /patch/4990/
State Accepted
Headers show

Comments

Pranith K - 2010-09-27 05:25:41
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
Vijay Bellur - 2010-09-27 17:23:40
Reviewed OK.

On Monday 27 September 2010 10:55 AM, Pranith Kumar K wrote:
>
> Signed-off-by: Pranith Kumar K<pranithk@gluster.com>
> ---
>   xlators/mgmt/glusterd/src/glusterd-op-sm.c |   17 ++++++++++++-----
>   1 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
> index e8aa93b..91f833c 100644
> --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
> +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
> @@ -2637,8 +2637,8 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
>   		sprintf (str, "key%d", count);
>   		ret = dict_get_str (dict, str,&key);
>
> -		
> -		if (ret)
> +
> +		if (ret)
>   			break;
>
>   		sprintf (str, "value%d", count);
> @@ -2652,7 +2652,7 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
>           	}
>
>   		ret = set_xlator_option (volinfo->dict, key, value);
> -		
> +
>   		if (ret) {
>                   	gf_log ("", GF_LOG_ERROR, "Unable to set the options"
>   						  "in 'volume set'");
> @@ -2676,14 +2676,21 @@ glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
>   		goto out;
>           }
>
> +        ret = glusterd_store_update_volume (volinfo);
> +        if (ret)
> +                goto out;
>
> +        ret = glusterd_volume_compute_cksum (volinfo);
> +        if (ret)
> +                goto out;
>
> -
> -        gf_log ("", GF_LOG_DEBUG, "Received set volume command");
> +        if (GLUSTERD_STATUS_STARTED == volinfo->status)
> +                ret = glusterd_check_generate_start_nfs (volinfo);
>
>           ret = 0;
>
>   out:
> +        gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
>           return ret;
>   }
>
>

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e8aa93b..91f833c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2637,8 +2637,8 @@  glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
 		sprintf (str, "key%d", count);
 		ret = dict_get_str (dict, str, &key);
 
-		
-		if (ret) 
+
+		if (ret)
 			break;
 
 		sprintf (str, "value%d", count);
@@ -2652,7 +2652,7 @@  glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
         	}
 
 		ret = set_xlator_option (volinfo->dict, key, value);
-		
+
 		if (ret) {
                 	gf_log ("", GF_LOG_ERROR, "Unable to set the options"
 						  "in 'volume set'");
@@ -2676,14 +2676,21 @@  glusterd_op_set_volume (gd1_mgmt_stage_op_req *req)
 		goto out;
         }
 
+        ret = glusterd_store_update_volume (volinfo);
+        if (ret)
+                goto out;
 
+        ret = glusterd_volume_compute_cksum (volinfo);
+        if (ret)
+                goto out;
 
-
-        gf_log ("", GF_LOG_DEBUG, "Received set volume command");
+        if (GLUSTERD_STATUS_STARTED == volinfo->status)
+                ret = glusterd_check_generate_start_nfs (volinfo);
 
         ret = 0;
 
 out:
+        gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
         return ret;
 }