xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 2/2] libxl: Add vif.default.backend to xl.conf
Date: Fri, 5 Jul 2013 12:13:55 +0100	[thread overview]
Message-ID: <1373022835-3807-2-git-send-email-george.dunlap@eu.citrix.com> (raw)
In-Reply-To: <1373022835-3807-1-git-send-email-george.dunlap@eu.citrix.com>

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

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Roger Pau Monne <roger.pau@citrix.com>
---
 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

  reply	other threads:[~2013-07-05 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-05 11:13 [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set George Dunlap
2013-07-05 11:13 ` George Dunlap [this message]
2013-07-05 11:47   ` [PATCH 2/2] libxl: Add vif.default.backend to xl.conf Roger Pau Monné
2013-07-22 21:38     ` Ian Campbell
2013-07-05 11:45 ` [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set Roger Pau Monné
2013-07-17 11:19   ` [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages] Ian Jackson
2013-07-17 11:23     ` George Dunlap
2013-07-18 11:20       ` Ian Jackson
2013-07-18 11:21         ` George Dunlap
2013-09-13 13:44           ` Ian Jackson
2013-07-15 14:00 ` [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set George Dunlap

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=1373022835-3807-2-git-send-email-george.dunlap@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).