diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-09-20 09:54:12 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-20 10:33:38 -0700 |
commit | ad234382336a6f2dafb4cb698dfabbf7957b498b (patch) | |
tree | 8cb8c47abb63ea4a5647a5524b688f298017aae9 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | e71b50e49612af4e76510b0c2a6f0519adfd852d (diff) |
cli, mgmt/glusterd: volume sync command
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1310 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1310
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 017ab6873..358d6ffe4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1000,6 +1000,7 @@ glusterd_is_cli_op_req (int32_t op) case GD_MGMT_CLI_LOG_FILENAME: case GD_MGMT_CLI_LOG_LOCATE: case GD_MGMT_CLI_LOG_ROTATE: + case GD_MGMT_CLI_SYNC_VOLUME: return _gf_true; break; } @@ -1452,7 +1453,6 @@ out: return ret; } - int32_t glusterd_import_friend_volumes (dict_t *vols) { @@ -1470,7 +1470,6 @@ glusterd_import_friend_volumes (dict_t *vols) ret = glusterd_import_friend_volume (vols, i); if (ret) goto out; - i++; } @@ -1645,27 +1644,6 @@ glusterd_nfs_server_stop () return glusterd_service_stop ("nfsd", pidfile, SIGTERM, _gf_false); } -gf_boolean_t -glusterd_are_all_volumes_stopped () -{ - glusterd_conf_t *priv = NULL; - xlator_t *this = NULL; - glusterd_volinfo_t *voliter = NULL; - - this = THIS; - GF_ASSERT (this); - priv = this->private; - GF_ASSERT (priv); - - list_for_each_entry (voliter, &priv->volumes, vol_list) { - if (voliter->status == GLUSTERD_STATUS_STARTED) - return _gf_false; - } - - return _gf_true; - -} - int glusterd_remote_hostname_get (rpcsvc_request_t *req, char *remote_host, int len) { @@ -1691,3 +1669,50 @@ glusterd_remote_hostname_get (rpcsvc_request_t *req, char *remote_host, int len) return 0; } +int +glusterd_check_generate_start_nfs (glusterd_volinfo_t *volinfo) +{ + int ret = -1; + + if (!volinfo) { + gf_log ("", GF_LOG_ERROR, "Invalid Arguments"); + goto out; + } + + ret = volgen_generate_nfs_volfile (volinfo); + if (ret) + goto out; + + if (glusterd_is_nfs_started ()) { + ret = glusterd_nfs_server_stop (); + if (ret) + goto out; + } + + ret = glusterd_nfs_server_start (); +out: + return ret; +} + +int +glusterd_volume_count_get (void) +{ + glusterd_volinfo_t *tmp_volinfo = NULL; + int32_t ret = 0; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; + + this = THIS; + GF_ASSERT (this); + + priv = this->private; + + list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) { + ret++; + } + + + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + return ret; + +} |