aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/xl.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-02-07 17:01:57 +0000
committerIan Campbell <ian.campbell@citrix.com>2012-02-07 17:01:57 +0000
commit9faa8b12d80ffb9615bc07adc2249af60c0e32f8 (patch)
tree288e80d3464bd8e0a742f371162308d4707759f4 /tools/libxl/xl.c
parent914e61c1ec5a7996a3e71692ce41e77359e70e0c (diff)
downloadxen-9faa8b12d80ffb9615bc07adc2249af60c0e32f8.tar.gz
xen-9faa8b12d80ffb9615bc07adc2249af60c0e32f8.tar.bz2
xen-9faa8b12d80ffb9615bc07adc2249af60c0e32f8.zip
xl: use json output by default
Move the sxp producing code off into a separate file. It is supported for legacy reasons and needn't be updated other than the improve compatibility with xm. libxl_domain_config is not currently generated by the IDL (adding the necessary support for Array types is on my to do list) so hand code the json generation function for now. Since this rather directly exposes a libxl data structure it's not clear what sort of forward compatibility guarantees we can make. However it seems like it should be as stable as libxl's own API (which we are looking to stabilise) (Gratuitous string.h include needed for memset in libxl_util.h) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/xl.c')
-rw-r--r--tools/libxl/xl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 02a680326f..9dac99842e 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -38,6 +38,7 @@ int dryrun_only;
int autoballoon = 1;
char *lockfile;
char *default_vifscript = NULL;
+enum output_format default_output_format = OUTPUT_FORMAT_JSON;
static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -78,6 +79,15 @@ static void parse_global_config(const char *configfile,
if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
default_vifscript = strdup(buf);
+ if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
+ if (!strcmp(buf, "json"))
+ default_output_format = OUTPUT_FORMAT_JSON;
+ else if (!strcmp(buf, "sxp"))
+ default_output_format = OUTPUT_FORMAT_SXP;
+ else {
+ fprintf(stderr, "invalid default output format \"%s\"\n", buf);
+ }
+ }
xlu_cfg_destroy(config);
}