All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 6 of 8] xl: add a global configuration file
Date: Fri, 27 Aug 2010 13:34:16 +0200	[thread overview]
Message-ID: <201008271334.18012.Christoph.Egger@amd.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1008271216490.2545@kaball-desktop>

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?

>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff -r 88da46b5c142 tools/examples/Makefile
> --- a/tools/examples/Makefile	Wed Aug 25 19:56:47 2010 +0100
> +++ b/tools/examples/Makefile	Wed Aug 25 20:05:34 2010 +0100
> @@ -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 88da46b5c142 tools/examples/xl.conf
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tools/examples/xl.conf	Wed Aug 25 20:05:34 2010 +0100
> @@ -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
> diff -r 88da46b5c142 tools/libxl/xl.c
> --- a/tools/libxl/xl.c	Wed Aug 25 19:56:47 2010 +0100
> +++ b/tools/libxl/xl.c	Wed Aug 25 20:05:34 2010 +0100
> @@ -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";

Don't hardcode the path. Use libxl_xen_config_dir_path().

> +    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 88da46b5c142 tools/libxl/xl.h
> --- a/tools/libxl/xl.h	Wed Aug 25 19:56:47 2010 +0100
> +++ b/tools/libxl/xl.h	Wed Aug 25 20:05:34 2010 +0100
> @@ -90,4 +90,7 @@ struct cmd_spec *cmdtable_lookup(const c
>  extern libxl_ctx ctx;
>  extern xentoollog_logger_stdiostream *logger;
>
> +/* global options */
> +extern int autoballoon;
> +
>  #endif /* XL_H */
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel



-- 
---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

  reply	other threads:[~2010-08-27 11:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27 11:19 [PATCH 6 of 8] xl: add a global configuration file Stefano Stabellini
2010-08-27 11:34 ` Christoph Egger [this message]
2010-08-27 11:42   ` Stefano Stabellini
2010-08-27 21:30 ` Zhigang Wang
2010-08-30  9:48   ` Stefano Stabellini
2010-08-31 17:32     ` Ian Jackson
2010-08-31 18:52       ` Zhigang Wang
2010-08-31 17:31 ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008271334.18012.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.