diff options
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-cmd-volume.c | 139 | ||||
-rw-r--r-- | cli/src/cli-cmd.h | 3 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 6 | ||||
-rw-r--r-- | cli/src/cli.h | 5 |
4 files changed, 0 insertions, 153 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 89c12f99ea7..f5926588a9e 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1109,98 +1109,6 @@ out: return ret; } -static int -gf_cli_create_auxiliary_mount (char *volname) -{ - int ret = -1; - char mountdir[PATH_MAX] = {0,}; - char pidfile_path[PATH_MAX] = {0,}; - char logfile[PATH_MAX] = {0,}; - char qpid [16] = {0,}; - char *sockpath = NULL; - - GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile_path, volname); - - if (gf_is_service_running (pidfile_path, NULL)) { - gf_log ("cli", GF_LOG_DEBUG, "Aux mount of volume %s is running" - " already", volname); - ret = 0; - goto out; - } - - GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/"); - ret = mkdir (mountdir, 0777); - if (ret && errno != EEXIST) { - gf_log ("cli", GF_LOG_ERROR, "Failed to create auxiliary mount " - "directory %s. Reason : %s", mountdir, - strerror (errno)); - goto out; - } - - snprintf (logfile, PATH_MAX-1, "%s/quota-mount-%s.log", - DEFAULT_LOG_FILE_DIRECTORY, volname); - snprintf(qpid, 15, "%d", GF_CLIENT_PID_QUOTA_MOUNT); - - if (global_state->glusterd_sock) { - sockpath = global_state->glusterd_sock; - } else { - sockpath = DEFAULT_GLUSTERD_SOCKFILE; - } - - ret = runcmd (SBIN_DIR"/glusterfs", - "--volfile-server", sockpath, - "--volfile-server-transport", "unix", - "--volfile-id", volname, - "-l", logfile, - "-p", pidfile_path, - "--client-pid", qpid, - mountdir, - NULL); - - if (ret) { - gf_log ("cli", GF_LOG_WARNING, "failed to mount glusterfs " - "client. Please check the log file %s for more details", - logfile); - ret = -1; - goto out; - } - - ret = 0; - -out: - return ret; -} - -static int -cli_stage_quota_op (char *volname, int op_code) -{ - int ret = -1; - - switch (op_code) { - case GF_QUOTA_OPTION_TYPE_ENABLE: - case GF_QUOTA_OPTION_TYPE_LIMIT_USAGE: - case GF_QUOTA_OPTION_TYPE_LIMIT_OBJECTS: - case GF_QUOTA_OPTION_TYPE_REMOVE: - case GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS: - case GF_QUOTA_OPTION_TYPE_LIST: - ret = gf_cli_create_auxiliary_mount (volname); - if (ret) { - cli_err ("quota: Could not start quota " - "auxiliary mount"); - goto out; - } - ret = 0; - break; - - default: - ret = 0; - break; - } - -out: - return ret; -} - int cli_get_soft_limit (dict_t *options, const char **words, dict_t *xdata) { @@ -1301,42 +1209,6 @@ out: return limits_set; } -/* Checks if the mount is connected to the bricks - * - * Returns true if connected and false if not - */ -gf_boolean_t -_quota_aux_mount_online (char *volname) -{ - int ret = 0; - char mount_path[PATH_MAX + 1] = {0,}; - struct stat buf = {0,}; - - GF_ASSERT (volname); - - /* Try to create the aux mount before checking if bricks are online */ - ret = gf_cli_create_auxiliary_mount (volname); - if (ret) { - cli_err ("quota: Could not start quota auxiliary mount"); - return _gf_false; - } - - GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mount_path, volname, "/"); - - ret = sys_stat (mount_path, &buf); - if (ret) { - if (ENOTCONN == errno) { - cli_err ("quota: Cannot connect to bricks. Check if " - "bricks are online."); - } else { - cli_err ("quota: Error on quota auxiliary mount (%s).", - strerror (errno)); - } - return _gf_false; - } - return _gf_true; -} - int cli_cmd_quota_handle_list_all (const char **words, dict_t *options) { @@ -1407,12 +1279,6 @@ cli_cmd_quota_handle_list_all (const char **words, dict_t *options) goto out; } - /* Check if the mount is online before doing any listing */ - if (!_quota_aux_mount_online (volname)) { - ret = -1; - goto out; - } - frame = create_frame (THIS, THIS->ctx->pool); if (!frame) { ret = -1; @@ -1645,11 +1511,6 @@ cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word, goto out; } - //create auxiliary mount need for quota commands that operate on path - ret = cli_stage_quota_op (volname, type); - if (ret) - goto out; - frame = create_frame (THIS, THIS->ctx->pool); if (!frame) { ret = -1; diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h index 2a4c711c7d4..d53ebf7dbae 100644 --- a/cli/src/cli-cmd.h +++ b/cli/src/cli-cmd.h @@ -121,7 +121,4 @@ int cli_cmd_sent_status_get (int *status); gf_boolean_t _limits_set_on_volume (char *volname, int type); -gf_boolean_t -_quota_aux_mount_online (char *volname); - #endif /* __CLI_CMD_H__ */ diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index aeddd636ed3..efb4a3367a9 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3296,12 +3296,6 @@ gf_cli_print_limit_list_from_dict (cli_local_t *local, char *volname, goto out; } - /* Check if the mount is online before doing any listing */ - if (!_quota_aux_mount_online (volname)) { - ret = -1; - goto out; - } - if (global_state->mode & GLUSTER_MODE_XML) { ret = cli_xml_output_vol_quota_limit_list_begin (local, op_ret, op_errno, op_errstr); diff --git a/cli/src/cli.h b/cli/src/cli.h index 17fe1223af0..c508f1c430e 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -71,11 +71,6 @@ typedef enum { snprintf (abspath, sizeof (abspath)-1, \ DEFAULT_VAR_RUN_DIRECTORY"/%s%s", volname, path); -#define GLUSTERFS_GET_AUX_MOUNT_PIDFILE(pidfile,volname) { \ - snprintf (pidfile, PATH_MAX-1, \ - DEFAULT_VAR_RUN_DIRECTORY"/%s.pid", volname); \ - } - struct cli_state; struct cli_cmd_word; struct cli_cmd_tree; |