diff options
author | Kaushal M <kaushal@redhat.com> | 2012-03-05 19:04:49 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-13 04:00:07 -0700 |
commit | 8c7549f9094d99d679de447230edaa5040db3e92 (patch) | |
tree | 4e372bf9cd91d25dc19d5c1ddfd58c3101d1753b /cli | |
parent | 6a8fcff3fb6955162dc4eeaeaa627bb31311627e (diff) |
cli: More xml output changes
* Added xml output for "volume quota" which was missing.
* Fixed xml output for "volume info all" so that it contains only one xml
document
* Fixed no xml output for normal "volume status"
* Fixed normal output for "volume set"
Change-Id: I3d85b6800e428226f2970d669e38e4331c99a218
BUG: 799957
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.com/2868
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 124 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 283 | ||||
-rw-r--r-- | cli/src/cli.h | 43 |
3 files changed, 388 insertions, 62 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 977ab0b2a13..20688b09687 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -26,7 +26,6 @@ #ifndef GSYNC_CONF #define GSYNC_CONF GEOREP"/gsyncd.conf" #endif -#define DEFAULT_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" /* Widths of various columns in top read/write-perf output * Total width of top read/write-perf should be 80 chars @@ -477,6 +476,10 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, } if (!rsp.dict.dict_len) { +#if (HAVE_LIB_XML) + if (global_state->mode & GLUSTER_MODE_XML) + goto xml_output; +#endif cli_out ("No volumes present"); ret = 0; goto out; @@ -520,17 +523,46 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, "Volume %s does not exist", local->get_vol.volname); ret = -1; - goto out; +#if (HAVE_LIB_XML) + if (!(global_state->mode & GLUSTER_MODE_XML)) +#endif + { + goto out; + } } } #if (HAVE_LIB_XML) +xml_output: if (global_state->mode & GLUSTER_MODE_XML) { - ret = cli_xml_output_vol_info (dict, rsp.op_ret, - rsp.op_errno, rsp.op_errstr); - if (ret) { - gf_log ("cli", GF_LOG_ERROR, - "Error outputting to xml"); + /* For GET_NEXT_VOLUME output is already begun in + * and will also end in gf_cli3_1_get_next_volume() + */ + if (local->get_vol.flags == GF_CLI_GET_VOLUME) { + ret = cli_xml_output_vol_info_begin + (local, rsp.op_ret, rsp.op_errno, + rsp.op_errstr); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, + "Error outputting to xml"); + goto out; + } + } + + if (dict) { + ret = cli_xml_output_vol_info (local, dict); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, + "Error outputting to xml"); + goto out; + } + } + + if (local->get_vol.flags == GF_CLI_GET_VOLUME) { + ret = cli_xml_output_vol_info_end (local); + if (ret) + gf_log ("cli", GF_LOG_ERROR, + "Error outputting to xml"); } goto out; } @@ -1253,9 +1285,6 @@ gf_cli3_1_set_volume_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("cli", GF_LOG_INFO, "Received resp to set"); - if (rsp.op_ret && strcmp (rsp.op_errstr, "")) - snprintf (msg, sizeof (msg), "%s", rsp.op_errstr); - dict = dict_new (); if (!dict) { @@ -1283,6 +1312,9 @@ gf_cli3_1_set_volume_cbk (struct rpc_req *req, struct iovec *iov, } #endif + if (rsp.op_ret && strcmp (rsp.op_errstr, "")) + cli_out ("%s", rsp.op_errstr); + cli_out ("%s", ((help_str == NULL) ? msg : help_str)); ret = rsp.op_ret; @@ -1892,6 +1924,7 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov, char *volname = NULL; char *limit_list = NULL; int32_t type = 0; + char msg[1024] = {0,}; if (-1 == req->rpc_status) { goto out; @@ -1905,7 +1938,12 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov, if (rsp.op_ret && strcmp (rsp.op_errstr, "") == 0) { - cli_out ("command unsuccessful %s", rsp.op_errstr); + snprintf (msg, sizeof (msg), "command unsuccessful %s", + rsp.op_errstr); +#if (HAVE_LIB_XML) + if (global_state->mode & GLUSTER_MODE_XML) + goto xml_output; +#endif goto out; } @@ -1940,6 +1978,18 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov, "failed to get type"); if (type == GF_QUOTA_OPTION_TYPE_LIST) { +#if (HAVE_LIB_XML) + if (global_state->mode & GLUSTER_MODE_XML) { + ret = cli_xml_output_vol_quota_limit_list + (volname, limit_list, rsp.op_ret, + rsp.op_errno, rsp.op_errstr); + if (ret) + gf_log ("cli", GF_LOG_ERROR, + "Error outputting to xml"); + goto out; + + } +#endif if (limit_list) { gf_cli3_1_print_limit_list (volname, limit_list, @@ -1948,19 +1998,34 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("cli", GF_LOG_INFO, "Received resp to quota " "command "); if (rsp.op_errstr) - cli_out ("%s", rsp.op_errstr); + snprintf (msg, sizeof (msg), "%s", + rsp.op_errstr); } } else { gf_log ("cli", GF_LOG_INFO, "Received resp to quota command "); if (rsp.op_errstr) - cli_out ("%s", rsp.op_errstr); + snprintf (msg, sizeof (msg), "%s", rsp.op_errstr); else - cli_out ("%s", "successful"); + snprintf (msg, sizeof (msg), "successful"); } -out: - ret = rsp.op_ret; +#if (HAVE_LIB_XML) +xml_output: + if (global_state->mode & GLUSTER_MODE_XML) { + ret = cli_xml_output_str ("volQuota", msg, rsp.op_ret, + rsp.op_errno, rsp.op_errstr); + if (ret) + gf_log ("cli", GF_LOG_ERROR, + "Error outputting to xml"); + goto out; + } +#endif + + if (strlen (msg) > 0) + cli_out ("%s", msg); + ret = rsp.op_ret; +out: cli_cmd_broadcast_response (ret); if (rsp.dict.dict_val) @@ -2155,16 +2220,31 @@ gf_cli3_1_get_next_volume (call_frame_t *frame, xlator_t *this, } ctx = data; + local = frame->local; + +#if (HAVE_LIB_XML) + if (global_state->mode & GLUSTER_MODE_XML) { + ret = cli_xml_output_vol_info_begin (local, 0, 0, ""); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); + goto out; + } + } +#endif ret = gf_cli3_1_get_volume (frame, this, data); - local = frame->local; if (!local || !local->get_vol.volname) { +#if (HAVE_LIB_XML) + if ((global_state->mode & GLUSTER_MODE_XML)) + goto end_xml; +#endif cli_out ("No volumes present"); goto out; } + ctx->volname = local->get_vol.volname; while (ctx->volname) { @@ -2174,7 +2254,17 @@ gf_cli3_1_get_next_volume (call_frame_t *frame, xlator_t *this, ctx->volname = local->get_vol.volname; } +#if (HAVE_LIB_XML) +end_xml: + if (global_state->mode & GLUSTER_MODE_XML) { + ret = cli_xml_output_vol_info_end (local); + if (ret) + gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); + } +#endif + out: + gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; } diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 6a22b249b7c..7f8f9cfc45e 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -17,8 +17,13 @@ <http://www.gnu.org/licenses/>. */ -#include <cli.h> -#include <cli1-xdr.h> +#include <stdlib.h> +#include "cli.h" +#include "cli1-xdr.h" +#include "run.h" +#include "compat.h" +#include "syscall.h" + #if (HAVE_LIB_XML) @@ -30,7 +35,9 @@ ret = -1; \ goto label; \ } \ - }while (0); \ + else \ + ret = 0; \ + }while (0) \ int cli_begin_xml_output (xmlTextWriterPtr *writer, xmlBufferPtr *buf) @@ -78,6 +85,7 @@ cli_end_xml_output (xmlTextWriterPtr writer, xmlBufferPtr buf) xmlFreeTextWriter (writer); xmlBufferFree (buf); + out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1373,7 +1381,7 @@ cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, break; default: - goto out; + break; } /* </brick> */ @@ -2082,6 +2090,9 @@ cli_xml_output_vol_info_options (xmlTextWriterPtr writer, dict_t *dict, "%d", opt_count); XML_RET_CHECK_AND_GOTO (ret, out); + /* <options> */ + ret = xmlTextWriterStartElement (writer, (xmlChar *)"options"); + XML_RET_CHECK_AND_GOTO (ret, out); while (i < opt_count) { snprintf (key, sizeof (key), "%s.option.", prefix); while (pairs) { @@ -2101,18 +2112,18 @@ cli_xml_output_vol_info_options (xmlTextWriterPtr writer, dict_t *dict, } i++; } + /* </options> */ + ret = xmlTextWriterEndElement (writer); + XML_RET_CHECK_AND_GOTO (ret, out); out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; } int -cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, - char *op_errstr) +cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) { - int ret = -1; - xmlTextWriterPtr writer = NULL; - xmlBufferPtr buf = NULL; + int ret = 0; int count = 0; char *volname = NULL; char *volume_id = NULL; @@ -2128,28 +2139,15 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, int i = 0; int j = 1; - ret = cli_begin_xml_output (&writer, &buf); - if (ret) - goto out; - - ret = cli_xml_output_common (writer, op_ret, op_errno, op_errstr); - if (ret) - goto out; - - /* <volInfo> */ - ret = xmlTextWriterStartElement (writer, (xmlChar *)"volInfo"); - XML_RET_CHECK_AND_GOTO (ret, out); ret = dict_get_int32 (dict, "count", &count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"count", - "%d", count); - XML_RET_CHECK_AND_GOTO (ret, out); for (i = 0; i < count; i++) { /* <volume> */ - ret = xmlTextWriterStartElement (writer, (xmlChar *)"volume"); + ret = xmlTextWriterStartElement (local->writer, + (xmlChar *)"volume"); XML_RET_CHECK_AND_GOTO (ret, out); memset (key, 0, sizeof (key)); @@ -2157,7 +2155,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_str (dict, key, &volname); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"name", "%s", volname); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2167,7 +2165,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_str (dict, key, &volume_id); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"id", "%s", volume_id); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2177,7 +2175,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &type); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"type", "%d", type); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2187,7 +2185,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &status); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"status", "%d", status); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2197,7 +2195,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &brick_count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"brickCount", "%d", brick_count); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2207,7 +2205,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &dist_count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"distCount", "%d", dist_count); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2217,7 +2215,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &stripe_count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"stripeCount", "%d", stripe_count); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2227,7 +2225,7 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &replica_count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"replicaCount", "%d", replica_count); XML_RET_CHECK_AND_GOTO (ret, out); @@ -2237,11 +2235,15 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, key, &transport); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, + ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"transport", "%d", transport); XML_RET_CHECK_AND_GOTO (ret, out); + /* <bricks> */ + ret = xmlTextWriterStartElement (local->writer, + (xmlChar *)"bricks"); + XML_RET_CHECK_AND_GOTO (ret, out); while (j <= brick_count) { memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "volume%d.brick%d", i, j); @@ -2249,31 +2251,236 @@ cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, if (ret) goto out; ret = xmlTextWriterWriteFormatElement - (writer, (xmlChar *)"brick", "%s", brick); + (local->writer, (xmlChar *)"brick", "%s", + brick); XML_RET_CHECK_AND_GOTO (ret, out); j++; } + /* </bricks> */ + ret = xmlTextWriterEndElement (local->writer); + XML_RET_CHECK_AND_GOTO (ret, out); memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "volume%d", i); - ret = cli_xml_output_vol_info_options (writer, dict, key); + ret = cli_xml_output_vol_info_options (local->writer, dict, + key); if (ret) goto out; /* </volume> */ - ret = xmlTextWriterEndElement (writer); + ret = xmlTextWriterEndElement (local->writer); XML_RET_CHECK_AND_GOTO (ret, out); } + GF_FREE (local->get_vol.volname); + local->get_vol.volname = gf_strdup (volname); + local->vol_count += count; + +out: + gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); + return ret; +} + +int +cli_xml_output_vol_info_begin (cli_local_t *local, int op_ret, int op_errno, + char *op_errstr) +{ + int ret = -1; + + GF_ASSERT (local); + + ret = cli_begin_xml_output (&(local->writer), &(local->buf)); + if (ret) + goto out; + + ret = cli_xml_output_common (local->writer, op_ret, op_errno, + op_errstr); + if (ret) + goto out; + + /* <volInfo> */ + ret = xmlTextWriterStartElement (local->writer, (xmlChar *)"volInfo"); + XML_RET_CHECK_AND_GOTO (ret, out); + + /* <volumes> */ + ret = xmlTextWriterStartElement (local->writer, (xmlChar *)"volumes"); + XML_RET_CHECK_AND_GOTO (ret, out); + + /* Init vol count */ + local->vol_count = 0; + +out: + gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); + return ret; +} + +int +cli_xml_output_vol_info_end (cli_local_t *local) +{ + int ret = -1; + + GF_ASSERT (local); + + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"count", + "%d", local->vol_count); + + /* </volumes> */ + ret = xmlTextWriterEndElement (local->writer); + XML_RET_CHECK_AND_GOTO (ret, out); /* </volInfo> */ - ret = xmlTextWriterEndElement (writer); + ret = xmlTextWriterEndElement (local->writer); XML_RET_CHECK_AND_GOTO (ret, out); - ret = cli_end_xml_output (writer, buf); + ret = cli_end_xml_output (local->writer, local->buf); + +out: + gf_log ("cli", GF_LOG_ERROR, "Returning %d", ret); + return ret; +} + +int +cli_xml_output_vol_quota_limit_list (char *volname, char *limit_list, + int op_ret, int op_errno, + char *op_errstr) +{ + int ret = -1; + xmlTextWriterPtr writer = NULL; + xmlBufferPtr buf = NULL; + int64_t size = 0; + int64_t limit_value = 0; + int i = 0; + int j = 0; + int k = 0; + int len = 0; + char *size_str = NULL; + char path[PATH_MAX] = {0,}; + char ret_str[1024] = {0,}; + char value[1024] = {0,}; + char mountdir[] = "/tmp/mountXXXXXX"; + char abspath[PATH_MAX] = {0,}; + runner_t runner = {0,}; + + GF_ASSERT (volname); + GF_ASSERT (limit_list); + + ret = cli_begin_xml_output (&writer, &buf); + if (ret) + goto out; + + ret = cli_xml_output_common (writer, op_ret, op_errno, op_errstr); if (ret) goto out; + + /* <volQuota> */ + ret = xmlTextWriterStartElement (writer, (xmlChar *)"volQuota"); + XML_RET_CHECK_AND_GOTO (ret, out); + + if (!limit_list) + goto cont; + + len = strlen (limit_list); + if (len == 0) + goto cont; + + if (mkdtemp (mountdir) == NULL) { + gf_log ("cli", GF_LOG_ERROR, "failed to create a temporary" + " mount directory"); + ret = -1; + goto out; + } + + ret = runcmd (SBIN_DIR"/glusterfs", "-s", "localhost", + "--volfile-id", volname, "-l", + DEFAULT_LOG_FILE_DIRECTORY"/quota-list-xml.log", + mountdir, NULL); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, + "failed to mount glusterfs client"); + ret = -1; + goto rm_dir; + } + + while (i < len) { + j = 0; + k = 0; + size = 0; + + while (limit_list[i] != ':') + path[k++] = limit_list[i++]; + path[k] = '\0'; + + i++; + + while (limit_list[i] != ',' && limit_list[i] != '\0') + value[j++] = limit_list[i++]; + i++; + + snprintf (abspath, sizeof (abspath), "%s/%s", mountdir, path); + ret = sys_lgetxattr (abspath, "trusted.limit.list", + (void *)ret_str, 4096); + if (ret >= 0) { + sscanf (ret_str, "%"SCNd64",%"SCNd64, &size, + &limit_value); + size_str = gf_uint64_2human_readable ((uint64_t)size); + } + + /* <quota> */ + ret = xmlTextWriterStartElement (writer, (xmlChar *)"quota"); + XML_RET_CHECK_AND_GOTO (ret, unmount); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"path", "%s", path); + XML_RET_CHECK_AND_GOTO (ret, unmount); + + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"limit", "%s", value); + XML_RET_CHECK_AND_GOTO (ret, unmount); + + if (size_str) { + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"size", "%s", size_str); + XML_RET_CHECK_AND_GOTO (ret, unmount); + GF_FREE (size_str); + } else { + ret = xmlTextWriterWriteFormatElement + (writer, (xmlChar *)"size", "%"PRId64, size); + XML_RET_CHECK_AND_GOTO (ret, unmount); + } + + /* </quota> */ + ret = xmlTextWriterEndElement (writer); + XML_RET_CHECK_AND_GOTO (ret, unmount); + + } + +unmount: + runinit (&runner); + runner_add_args (&runner, "umount", +#if GF_LINUX_HOST_OS + "-l", +#endif + mountdir, NULL); + ret = runner_run_reuse (&runner); + if (ret) + runner_log (&runner, "cli", GF_LOG_WARNING, "error executing"); + runner_end (&runner); + +rm_dir: + rmdir (mountdir); + +cont: + /* </volQuota> */ + ret = xmlTextWriterEndElement (writer); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = cli_end_xml_output (writer, buf); + out: + if (size_str) + GF_FREE (size_str); gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); return ret; } + #endif diff --git a/cli/src/cli.h b/cli/src/cli.h index 8080e42d699..2a24378ffa1 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -29,12 +29,18 @@ #include "glusterfs.h" #include "protocol-common.h" +#if (HAVE_LIB_XML) +#include <libxml/encoding.h> +#include <libxml/xmlwriter.h> +#endif + #define DEFAULT_EVENT_POOL_SIZE 16384 #define CLI_GLUSTERD_PORT 24007 #define CLI_DEFAULT_CONN_TIMEOUT 120 #define CLI_DEFAULT_CMD_TIMEOUT 120 #define CLI_TOP_CMD_TIMEOUT 600 //Longer timeout for volume top #define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" +#define DEFAULT_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" #define CLI_VOL_STATUS_BRICK_LEN 55 #define CLI_TAB_LENGTH 8 #define CLI_BRICK_STATUS_LINE_LEN 78 @@ -122,6 +128,11 @@ struct cli_local { } get_vol; dict_t *dict; +#if (HAVE_LIB_XML) + xmlTextWriterPtr writer; + xmlBufferPtr buf; + int vol_count; +#endif }; struct cli_volume_status { @@ -276,25 +287,43 @@ cli_print_line (int len); #if (HAVE_LIB_XML) int -cli_xml_output_str (char *op, char *str, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_str (char *op, char *str, int op_ret, int op_errno, + char *op_errstr); + +int +cli_xml_output_dict (char *op, dict_t *dict, int op_ret, int op_errno, + char *op_errstr); + +int +cli_xml_output_vol_top (dict_t *dict, int op_ret, int op_errno, + char *op_errstr); + +int +cli_xml_output_vol_profile (dict_t *dict, int op_ret, int op_errno, + char *op_errstr); int -cli_xml_output_dict (char *op, dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, + char *op_errstr); int -cli_xml_output_vol_top (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_list (dict_t *dict, int op_ret, int op_errno, + char *op_errstr); int -cli_xml_output_vol_profile (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_info_begin (cli_local_t *local, int op_ret, int op_errno, + char *op_errstr); int -cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_info_end (cli_local_t *local); int -cli_xml_output_vol_list (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_info (cli_local_t *local, dict_t *dict); int -cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +cli_xml_output_vol_quota_limit_list (char *volname, char *limit_list, + int op_ret, int op_errno, + char *op_errstr); #endif #endif /* __CLI_H__ */ |