]> xenbits.xensource.com Git - xen.git/commitdiff
xl: allow specifying a default gatewaydev in xl.conf
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 13 Mar 2013 17:42:17 +0000 (17:42 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 15 Mar 2013 12:40:25 +0000 (12:40 +0000)
This adds a new global option in the xl configuration file called
"vif.default.gatewaydev", that is used to specify the default
gatewaydev to use when none is passed in the vif specification.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/man/xl.conf.pod.5
tools/examples/xl.conf
tools/libxl/xl.c
tools/libxl/xl.h
tools/libxl/xl_cmdimpl.c

index 82c6b20251918aef0ecc1b514f19d5239bf5c750..f8f7e7fc79c17411617824b1c23d7496b199a3a2 100644 (file)
@@ -82,6 +82,12 @@ Configures the default bridge to set for virtual network devices.
 
 Default: C<xenbr0>
 
+=item B<vif.default.gatewaydev="NAME">
+
+Configures the default gateway device to set for virtual network devices.
+
+Default: C<None>
+
 =item B<output_format="json|sxp">
 
 Configures the default output format used by xl when printing "machine
index 28ab796ea3dcf559ae5d67a985db47b1ebaa4722..9a03ffffe3903897ae56cd59750610aa091ea0db 100644 (file)
@@ -20,3 +20,6 @@
 # if disabled the old behaviour will be used, and hotplug scripts will be
 # launched by udev.
 #run_hotplug_scripts=1
+
+# default gateway device to use with vif-route hotplug script
+#vif.default.gatewaydev="eth0"
index ecbcd3bf1d80154c10e63976ffd974f1be4da63e..71561a49efb8892c43d656e66b6cae86ef36dfc9 100644 (file)
@@ -43,6 +43,7 @@ int run_hotplug_scripts = 1;
 char *lockfile;
 char *default_vifscript = NULL;
 char *default_bridge = NULL;
+char *default_gatewaydev = NULL;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 
 static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -85,12 +86,25 @@ static void parse_global_config(const char *configfile,
         exit(1);
     }
 
+    /*
+     * For global options that are related to a specific type of device
+     * we use the following nomenclature:
+     *
+     * <device type>.default.<option name>
+     *
+     * This allows us to keep the default options classified for the
+     * different device kinds.
+     */
+
     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, "vif.default.gatewaydev", &buf, 0))
+        default_gatewaydev = strdup(buf);
+
     if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
         if (!strcmp(buf, "json"))
             default_output_format = OUTPUT_FORMAT_JSON;
index be6f38b2fa503b04a12c71254023d7fd263f4c7a..b881f92269e7ef83336a277bed1ed436beff5fcd 100644 (file)
@@ -148,6 +148,7 @@ extern int dryrun_only;
 extern char *lockfile;
 extern char *default_vifscript;
 extern char *default_bridge;
+extern char *default_gatewaydev;
 extern char *blkdev_start;
 
 enum output_format {
index d7ffc507b81c2c29813b44c081723600289dc653..2d40f8f79c5114df2bd49d8ed7996cf94ae6d796 100644 (file)
@@ -1146,6 +1146,11 @@ static void parse_config_data(const char *config_source,
                 nic->bridge = strdup(default_bridge);
             }
 
+            if (default_gatewaydev) {
+                free(nic->gatewaydev);
+                nic->gatewaydev = strdup(default_gatewaydev);
+            }
+
             p = strtok(buf2, ",");
             if (!p)
                 goto skip_nic;