summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-01-25 08:10:17 -0500
committerShyamsundar Ranganathan <srangana@redhat.com>2017-01-26 09:11:16 -0500
commit107b22c96a354c43f6557bd1e307fa1dff5b5fb5 (patch)
treeb8198dae9c0406bb51e353da63a1046ff3407963 /cli
parent10076acaddfa611214e42e0402c3578bc69cada9 (diff)
cli: keep 'gluster volume status detail' consistent
The output of the command 'gluster volume status <volname> detail' is not consistent between operating systems. On linux hosts it shows the file system type, the device name, mount options and inode size of each brick. However the same command executed on a FreeBSD host doesn't show all this information, even for bricks stored on a linux. Additionally, for hosts other than linux, this information is shown as 'N/A' many times. This has been fixed to show as much information as it can be retrieved from the operating system. The file contrib/mount/mntent.c has been mostly rewriten because it contained many errors that caused mount information to not be retrieved on some operating systems. Master BZ 1411334 Master review https://review.gluster.org/#/c/16371/ Change-Id: Icb6e19e8af6ec82255e7792ad71914ef679fc316 BUG: 1416416 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: https://review.gluster.org/16469 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-volume.c6
-rw-r--r--cli/src/cli-xml-output.c8
-rw-r--r--cli/src/cli.h2
3 files changed, 2 insertions, 14 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 5068d34c48c..dbf1e3e2326 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2584,13 +2584,11 @@ cli_get_detail_status (dict_t *dict, int i, cli_volume_status_t *status)
if (!status->total)
goto out;
-#ifdef GF_LINUX_HOST_OS
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.device", i);
ret = dict_get_str (dict, key, &(status->device));
if (ret)
status->device = NULL;
-#endif
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.block_size", i);
@@ -2600,7 +2598,6 @@ cli_get_detail_status (dict_t *dict, int i, cli_volume_status_t *status)
status->block_size = 0;
}
-#ifdef GF_LINUX_HOST_OS
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.mnt_options", i);
ret = dict_get_str (dict, key, &(status->mount_options));
@@ -2620,7 +2617,6 @@ cli_get_detail_status (dict_t *dict, int i, cli_volume_status_t *status)
ret = dict_get_str (dict, key, &(status->inode_size));
if (ret)
status->inode_size = NULL;
-#endif /* GF_LINUX_HOST_OS */
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.total_inodes", i);
@@ -2658,7 +2654,6 @@ cli_print_detailed_status (cli_volume_status_t *status)
cli_out ("%-20s : %-20c", "Online", (status->online) ? 'Y' : 'N');
cli_out ("%-20s : %-20s", "Pid", status->pid_str);
-#ifdef GF_LINUX_HOST_OS
if (status->fs_name)
cli_out ("%-20s : %-20s", "File System", status->fs_name);
else
@@ -2682,7 +2677,6 @@ cli_print_detailed_status (cli_volume_status_t *status)
} else {
cli_out ("%-20s : %-20s", "Inode Size", "N/A");
}
-#endif
if (status->free)
cli_out ("%-20s : %-20s", "Disk Space Free", status->free);
else
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 3de7d064bec..d31f0e43607 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -438,12 +438,6 @@ cli_xml_output_vol_status_detail (xmlTextWriterPtr writer, dict_t *dict,
(xmlChar *)"fsName",
"%s", fs_name);
- /* inode details are only available for ext 2/3/4 & xfs */
- if (!fs_name || !IS_EXT_FS(fs_name) || strcmp (fs_name, "xfs")) {
- ret = 0;
- goto out;
- }
-
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.inode_size", brick_index);
ret = dict_get_str (dict, key, &inode_size);
@@ -467,6 +461,8 @@ cli_xml_output_vol_status_detail (xmlTextWriterPtr writer, dict_t *dict,
ret = xmlTextWriterWriteFormatElement (writer,
(xmlChar *)"inodesFree",
"%"PRIu64, inodes_free);
+ else
+ ret = 0;
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
diff --git a/cli/src/cli.h b/cli/src/cli.h
index ba0d845381a..dad3ce4e3a8 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -169,12 +169,10 @@ struct cli_volume_status {
char *pid_str;
char *free;
char *total;
-#ifdef GF_LINUX_HOST_OS
char *fs_name;
char *mount_options;
char *device;
char *inode_size;
-#endif
};
struct snap_config_opt_vals_ {