]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
xl: Add defaultbridge config option for xl.conf
authorStefan Bader <stefan.bader@canonical.com>
Mon, 13 Feb 2012 17:45:13 +0000 (17:45 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 13 Feb 2012 17:45:13 +0000 (17:45 +0000)
Currently guests created with the xl stack will have "xenbr0"
written as their default into xenstore. It can be changed in
the individual guest config files, but there is no way to
have that default globally changed.

Add a config option to xl.conf that allows to have a different
default bridge name.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/man/xl.conf.pod.5
tools/libxl/xl.c
tools/libxl/xl.h
tools/libxl/xl_cmdimpl.c

index 8837eb11ee4f4e8bd00d07fb2dde724e25d8178f..85752fbf5be79d533d2519f9c069b6ebf7855f9a 100644 (file)
@@ -68,6 +68,12 @@ Configures the default hotplug script used by virtual network devices.
 
 Default: C</etc/xen/scripts/vif-bridge>
 
+=item B<defaultbridge="NAME">
+
+Configures the default bridge to set for virtual network devices.
+
+Default: C<xenbr0>
+
 =item B<output_format="json|sxp">
 
 Configures the default output format used by xl when printing "machine
index 9dac99842ef661a6282f6b89887634b29236ca15..df9b1e752860a8e852d522717d744793cdca7f83 100644 (file)
@@ -38,6 +38,7 @@ int dryrun_only;
 int autoballoon = 1;
 char *lockfile;
 char *default_vifscript = NULL;
+char *default_bridge = NULL;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -79,6 +80,9 @@ 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, "defaultbridge", &buf, 0))
+       default_bridge = strdup(buf);
+
     if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
         if (!strcmp(buf, "json"))
             default_output_format = OUTPUT_FORMAT_JSON;
index a852a43d36d78fe081851d7b935ba114e27de445..702b208b1d2587206f256c7d88285aea3520b185 100644 (file)
@@ -110,6 +110,7 @@ extern int autoballoon;
 extern int dryrun_only;
 extern char *lockfile;
 extern char *default_vifscript;
+extern char *default_bridge;
 
 enum output_format {
     OUTPUT_FORMAT_JSON,
index efc03cebae3ed9e619849031b1bffa0841b4f8ff..c58e9f3f26ad8fa92ea42cff78022ba7da12a0a5 100644 (file)
@@ -840,6 +840,11 @@ static void parse_config_data(const char *configfile_filename_report,
                 nic->script = strdup(default_vifscript);
             }
 
+           if (default_bridge) {
+               free(nic->bridge);
+               nic->bridge = strdup(default_bridge);
+           }
+
             p = strtok(buf2, ",");
             if (!p)
                 goto skip;