[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/2] libxl: Add vif.default.backend to xl.conf



This will allow a user to default to a network driver domain
system-wide.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Roger Pau Monne <roger.pau@xxxxxxxxxx>
---
 docs/man/xl.conf.pod.5   |    6 ++++++
 tools/examples/xl.conf   |    4 ++++
 tools/libxl/xl.c         |    5 +++++
 tools/libxl/xl.h         |    1 +
 tools/libxl/xl_cmdimpl.c |    6 ++++++
 5 files changed, 22 insertions(+)

diff --git a/docs/man/xl.conf.pod.5 b/docs/man/xl.conf.pod.5
index 1229c8a..d8d1bb1 100644
--- a/docs/man/xl.conf.pod.5
+++ b/docs/man/xl.conf.pod.5
@@ -93,6 +93,12 @@ The old B<defaultbridge> option is deprecated and should not 
be used.
 
 Default: C<xenbr0>
 
+=item B<vif.default.backend="NAME">
+
+Configures the default backend to set for virtual network devices.
+
+Default: C<0>
+
 =item B<vif.default.gatewaydev="NAME">
 
 Configures the default gateway device to set for virtual network devices.
diff --git a/tools/examples/xl.conf b/tools/examples/xl.conf
index 9c037a6..7b081d2 100644
--- a/tools/examples/xl.conf
+++ b/tools/examples/xl.conf
@@ -19,6 +19,10 @@
 # launched by udev.
 #run_hotplug_scripts=1
 
+# default backend domain to connect guest vifs to.  This can be any
+# valid domain identifier.
+#vif.default.backend="0"
+
 # default gateway device to use with vif-route hotplug script
 #vif.default.gatewaydev="eth0"
 
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 1ce820c..c694e8f 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -45,6 +45,7 @@ char *lockfile;
 char *default_vifscript = NULL;
 char *default_bridge = NULL;
 char *default_gatewaydev = NULL;
+char *default_vifbackend = NULL;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 int claim_mode = 0;
 
@@ -158,6 +159,10 @@ static void parse_global_config(const char *configfile,
     if (!xlu_cfg_get_string (config, "vif.default.gatewaydev", &buf, 0))
         default_gatewaydev = strdup(buf);
 
+
+    if (!xlu_cfg_get_string (config, "vif.default.backend", &buf, 0))
+        default_vifbackend = strdup(buf);
+
     if (!xlu_cfg_get_string (config, "output_format", &buf, 0)) {
         if (!strcmp(buf, "json"))
             default_output_format = OUTPUT_FORMAT_JSON;
diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h
index 5ad3e17..e72a7d2 100644
--- a/tools/libxl/xl.h
+++ b/tools/libxl/xl.h
@@ -151,6 +151,7 @@ extern char *lockfile;
 extern char *default_vifscript;
 extern char *default_bridge;
 extern char *default_gatewaydev;
+extern char *default_vifbackend;
 extern char *blkdev_start;
 
 enum output_format {
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8a478ba..f670c6c 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1125,6 +1125,11 @@ static void parse_config_data(const char *config_source,
                 nic->gatewaydev = strdup(default_gatewaydev);
             }
 
+            if (default_vifbackend) {
+                free(nic->backend_domname);
+                nic->backend_domname = strdup(default_vifbackend);
+            }
+
             p = strtok(buf2, ",");
             if (!p)
                 goto skip_nic;
@@ -1174,6 +1179,7 @@ static void parse_config_data(const char *config_source,
                     free(nic->ifname);
                     nic->ifname = strdup(p2 + 1);
                 } else if (!strcmp(p, "backend")) {
+                    free(nic->backend_domname);
                     nic->backend_domname = strdup(p2 + 1);
                 } else if (!strcmp(p, "rate")) {
                     parse_vif_rate(&config, (p2 + 1), nic);
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.