xl: add a global configuration file
PATCH 1/1 xl: add a global configuration file
xl: add a global configuration file
Add a global configuration file: /etc/xen/xl.conf; the only option currently parsed is autoballoon that is 1 by default.
tools/examples/Makefile +1 -0
@@ -21,6 +21,7 @@ XEN_CONFIGS += xmexample.nbd XEN_CONFIGS += xmexample.vti XEN_CONFIGS += xend-pci-quirks.sxp XEN_CONFIGS += xend-pci-permissive.sxp +XEN_CONFIGS += xl.conf .PHONY: all all:
tools/examples/xl.conf new file +5 -0
@@ -0,0 +1,5 @@ +## Global XL config file ## + +# automatically balloon down dom0 when xen doesn't have enough free +# memory to create a domain +autoballon=1
tools/libxl/xl.c +39 -0
@@ -29,18 +29,49 @@#include "libxl.h" #include "libxl_utils.h" +#include "libxlutil.h" #include "xl.h" xentoollog_logger_stdiostream *logger; +int autoballoon =1 ;static xentoollog_level minmsglevel =XTL_PROGRESS ; +static void parse_global_config (const char *configfile, +const char *configfile_data, +int configfile_len) +{ +long l; +XLU_Config *config; +int e; + + config =xlu_cfg_init (stderr, configfile); +if (!config) { +fprintf (stderr,"Failed to allocate for configuration\n" ); +exit (1 ); + } + + e =xlu_cfg_readdata (config, configfile_data, configfile_len); +if (e) { +fprintf (stderr,"Failed to parse config file: %s\n" ,strerror (e)); +exit (1 ); + } + +if (!xlu_cfg_get_long (config,"autoballoon" , &l)) + autoballoon = l; + +xlu_cfg_destroy (config); +} +int main (int argc,char **argv) {int opt =0 ;char *cmd =0 ;struct cmd_spec *cspec;int ret; +const char *config_file ="/etc/xen/xl.conf" ; +void *config_data =0 ; +int config_len =0 ;while ((opt =getopt (argc, argv,"+v" )) >=0 ) {switch (opt) {
@@ -69,6 +100,14 @@ int main(int argc, char **argv)exit (1 ); } +/* Read global config file options */ + ret =libxl_read_file_contents (&ctx, config_file, + &config_data, &config_len); +if (ret) +fprintf (stderr,"Failed to read config file: %s: %s\n" , + config_file,strerror (errno)); +parse_global_config (config_file, config_data, config_len); +/* Reset options for per-command use of getopt. */ argv += optind; argc -= optind;
tools/libxl/xl.h +3 -0
@@ -90,4 +90,7 @@ struct cmd_spec *cmdtable_lookup(const cextern libxl_ctx ctx;extern xentoollog_logger_stdiostream *logger; +/* global options */ +extern int autoballoon; +#endif /* XL_H */
Quoted 4 lines · On Friday 27 August 2010 13:19:13 Stefano Stabellini wrote:
xl: add a global configuration file
Add a global configuration file:
/etc/xen/xl.conf; the only option currently parsed is autoballoon that is 1 by default.
What's the purpose of xl.conf ? Should it replace the global xend configuration file?
Why do you hardcode pathes? Is something wrong with our infrastructure?
Quoted 61 lines
Signed-off-by Stefano Stabellini <[email protected]>diff -r
88da46b5c142tools/examples/Makefiletools/examples/Makefile +1
-0@@ -21,6 +21,7 @@ XEN_CONFIGS += xmexample.nbd XEN_CONFIGS += xmexample.vti XEN_CONFIGS += xend-pci-quirks.sxp XEN_CONFIGS += xend-pci-permissive.sxp +XEN_CONFIGS += xl.conf .PHONY: all all:diff -r
88da46b5c142tools/examples/xl.conftools/examples/xl.conf new file +5
-0@@ -0,0 +1,5 @@ +## Global XL config file ## + +# automatically balloon down dom0 when xen doesn't have enough free +# memory to create a domain +autoballon=1diff -r
88da46b5c142tools/libxl/xl.ctools/libxl/xl.c +25
-0@@ -29,18 +29,49 @@#include "libxl.h" #include "libxl_utils.h" +#include "libxlutil.h" #include "xl.h" xentoollog_logger_stdiostream *logger; +int autoballoon =1 ;static xentoollog_level minmsglevel =XTL_PROGRESS ; +static void parse_global_config (const char *configfile, +const char *configfile_data, +int configfile_len) +{ +long l; +XLU_Config *config; +int e; + + config =xlu_cfg_init (stderr, configfile); +if (!config) { +fprintf (stderr,"Failed to allocate for configuration\n" ); +exit (1 ); + } + + e =xlu_cfg_readdata (config, configfile_data, configfile_len); +if (e) { +fprintf (stderr,"Failed to parse config file: %s\n" ,strerror (e)); +exit (1 ); + } + +if (!xlu_cfg_get_long (config,"autoballoon" , &l)) + autoballoon = l; +
tools/libxl/xl.c line 72
Quoted 10 lines
tools/libxl/xl.c +4
-0+xlu_cfg_destroy (config); +} +int main (int argc,char **argv) {int opt =0 ;char *cmd =0 ;struct cmd_spec *cspec;int ret; +const char *config_file ="/etc/xen/xl.conf" ;
Don't hardcode the path. Use libxl_xen_config_dir_path().
Quoted 36 lines
tools/libxl/xl.c +10
-0+void *config_data =0 ; +int config_len =0 ;while ((opt =getopt (argc, argv,"+v" )) >=0 ) {switch (opt) {@@ -69,6 +100,14 @@ int main(int argc, char **argv)exit (1 ); } +/* Read global config file options */ + ret =libxl_read_file_contents (&ctx, config_file, + &config_data, &config_len); +if (ret) +fprintf (stderr,"Failed to read config file: %s: %s\n" , + config_file,strerror (errno)); +parse_global_config (config_file, config_data, config_len); +/* Reset options for per-command use of getopt. */ argv += optind; argc -= optind;diff -r
88da46b5c142tools/libxl/xl.htools/libxl/xl.h +3
-0@@ -90,4 +90,7 @@ struct cmd_spec *cmdtable_lookup(const cextern libxl_ctx ctx;extern xentoollog_logger_stdiostream *logger; +/* global options */ +extern int autoballoon; +#endif /* XL_H */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Quoted 10 lines · Christoph Egger
Quoted 4 lines · On Friday 27 August 2010 13:19:13 Stefano Stabellini wrote:
xl: add a global configuration file
Add a global configuration file:
/etc/xen/xl.conf; the only option currently parsed is autoballoon that is 1 by default.What's the purpose of xl.conf ? Should it replace the global xend configuration file?
Why do you hardcode pathes? Is something wrong with our infrastructure?
I think you are right, I forgot to use it, I'll send an update for this patch.
I think we should not add configure files to xl. Instead, we may add a global
option to xl command line.
I don't want to see xl going heavy.
Thanks,
Zhigang
Quoted 111 lines · Stefano Stabellini
xl: add a global configuration file
Add a global configuration file:
/etc/xen/xl.conf; the only option currently parsed is autoballoon that is 1 by default.Signed-off-by Stefano Stabellini <[email protected]>diff -r
88da46b5c142tools/examples/Makefiletools/examples/Makefile +1
-0@@ -21,6 +21,7 @@ XEN_CONFIGS += xmexample.nbd XEN_CONFIGS += xmexample.vti XEN_CONFIGS += xend-pci-quirks.sxp XEN_CONFIGS += xend-pci-permissive.sxp +XEN_CONFIGS += xl.conf .PHONY: all all:diff -r
88da46b5c142tools/examples/xl.conftools/examples/xl.conf new file +5
-0@@ -0,0 +1,5 @@ +## Global XL config file ## + +# automatically balloon down dom0 when xen doesn't have enough free +# memory to create a domain +autoballon=1diff -r
88da46b5c142tools/libxl/xl.ctools/libxl/xl.c +39
-0@@ -29,18 +29,49 @@#include "libxl.h" #include "libxl_utils.h" +#include "libxlutil.h" #include "xl.h" xentoollog_logger_stdiostream *logger; +int autoballoon =1 ;static xentoollog_level minmsglevel =XTL_PROGRESS ; +static void parse_global_config (const char *configfile, +const char *configfile_data, +int configfile_len) +{ +long l; +XLU_Config *config; +int e; + + config =xlu_cfg_init (stderr, configfile); +if (!config) { +fprintf (stderr,"Failed to allocate for configuration\n" ); +exit (1 ); + } + + e =xlu_cfg_readdata (config, configfile_data, configfile_len); +if (e) { +fprintf (stderr,"Failed to parse config file: %s\n" ,strerror (e)); +exit (1 ); + } + +if (!xlu_cfg_get_long (config,"autoballoon" , &l)) + autoballoon = l; + +xlu_cfg_destroy (config); +} +int main (int argc,char **argv) {int opt =0 ;char *cmd =0 ;struct cmd_spec *cspec;int ret; +const char *config_file ="/etc/xen/xl.conf" ; +void *config_data =0 ; +int config_len =0 ;while ((opt =getopt (argc, argv,"+v" )) >=0 ) {switch (opt) {@@ -69,6 +100,14 @@ int main(int argc, char **argv)exit (1 ); } +/* Read global config file options */ + ret =libxl_read_file_contents (&ctx, config_file, + &config_data, &config_len); +if (ret) +fprintf (stderr,"Failed to read config file: %s: %s\n" , + config_file,strerror (errno)); +parse_global_config (config_file, config_data, config_len); +/* Reset options for per-command use of getopt. */ argv += optind; argc -= optind;diff -r
88da46b5c142tools/libxl/xl.htools/libxl/xl.h +3
-0@@ -90,4 +90,7 @@ struct cmd_spec *cmdtable_lookup(const cextern libxl_ctx ctx;extern xentoollog_logger_stdiostream *logger; +/* global options */ +extern int autoballoon; +#endif /* XL_H */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Zhigang Wang
I think we should not add configure files to xl. Instead, we may add a global
option to xl command line.I don't want to see xl going heavy.
I agree with you on not wanting to see xl becoming heavy, however there are few global configuration options that would be too burdensome for the user to specify every single time, in particular I am referring to the autoballoning operation.
Unfortunately there is no simple way to detect if the user wants xl to autoballoon dom0 or not (we could parse the xen command line to see if dom0_mem has been added, but it is just too ugly), so we need a global config file, but apart from that I don't see many other options being added to that configuration file.
Even if we take a look at the current xend config file, most of the configuration options specified there are not relevant to xl because they involve XML-RPC communication mechanisms. Apart from those there are few logging related options that might be useful, not much else.
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 6 of 8] xl: add a global configuration file"):
Quoted 4 lines
I agree with you on not wanting to see xl becoming heavy, however there are few global configuration options that would be too burdensome for the user to specify every single time, in particular I am referring to the autoballoning operation.
That's one example. Another is the default network bridge: it makes sense to put that in a global config file as it makes domain config files more portable between different setups.
Ian.
Quoted 6 lines
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 6 of 8] xl: add a global configuration file"):
Quoted 4 lines
I agree with you on not wanting to see xl becoming heavy, however there are few global configuration options that would be too burdensome for the user to specify every single time, in particular I am referring to the autoballoning operation.
Quoted 6 lines
That's one example. Another is the default network bridge: it makes sense to put that in a global config file as it makes domain config files more portable between different setups.
Ian.
That's OK. Then we should guarantee: a configure can only specified in the global configure file
or on the command line. But not both.
Here is a very bad example (not exist) we should avoid:
global.conf: migrate_ssl = true/false
# xl migrate --ssl ....
Thanks,
Zhigang
Stefano Stabellini writes ("[Xen-devel] [PATCH 6 of 8] xl: add a global configuration file"):
Quoted 4 lines
xl: add a global configuration file
Add a global configuration file:
/etc/xen/xl.conf; the only option currently parsed is autoballoon that is 1 by default.
I like this, although I won't apply it just yet as it introduces an unused "autoballoon" setting.
Ian.