From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 2/2] xl: allow specifying a default netdev in xl.conf
Date: Fri, 25 Jan 2013 16:26:23 +0100 [thread overview]
Message-ID: <1359127583-32490-3-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1359127583-32490-1-git-send-email-roger.pau@citrix.com>
This adds a new global option in the xl configuration file called
"defaultnetdev", that is used to specify the default netdev to use
when none is passed in the vif specification.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
---
docs/man/xl.conf.pod.5 | 6 ++++++
tools/examples/xl.conf | 3 +++
tools/libxl/xl.c | 4 ++++
tools/libxl/xl.h | 1 +
tools/libxl/xl_cmdimpl.c | 5 +++++
5 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/docs/man/xl.conf.pod.5 b/docs/man/xl.conf.pod.5
index 82c6b20..d1aa4c9 100644
--- a/docs/man/xl.conf.pod.5
+++ b/docs/man/xl.conf.pod.5
@@ -82,6 +82,12 @@ Configures the default bridge to set for virtual network devices.
Default: C<xenbr0>
+=item B<defaultnetdev="NAME">
+
+Configures the default netdev 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
diff --git a/tools/examples/xl.conf b/tools/examples/xl.conf
index 28ab796..120a41b 100644
--- a/tools/examples/xl.conf
+++ b/tools/examples/xl.conf
@@ -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 netdev to use with vif-route hotplug script
+#defaultnetdev="eth0"
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index ecbcd3b..06a09c2 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -43,6 +43,7 @@ int run_hotplug_scripts = 1;
char *lockfile;
char *default_vifscript = NULL;
char *default_bridge = NULL;
+char *default_netdev = NULL;
enum output_format default_output_format = OUTPUT_FORMAT_JSON;
static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -91,6 +92,9 @@ static void parse_global_config(const char *configfile,
if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0))
default_bridge = strdup(buf);
+ if (!xlu_cfg_get_string (config, "defaultnetdev", &buf, 0))
+ default_netdev = 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 be6f38b..5d43572 100644
--- a/tools/libxl/xl.h
+++ b/tools/libxl/xl.h
@@ -148,6 +148,7 @@ extern int dryrun_only;
extern char *lockfile;
extern char *default_vifscript;
extern char *default_bridge;
+extern char *default_netdev;
extern char *blkdev_start;
enum output_format {
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 92a64e4..2bbbbc1 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1141,6 +1141,11 @@ static void parse_config_data(const char *config_source,
nic->bridge = strdup(default_bridge);
}
+ if (default_netdev) {
+ free(nic->netdev);
+ nic->netdev = strdup(default_netdev);
+ }
+
p = strtok(buf2, ",");
if (!p)
goto skip_nic;
--
1.7.7.5 (Apple Git-26)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-01-25 15:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 15:26 [PATCH 0/2] add vif-route support to libxl/xl Roger Pau Monne
2013-01-25 15:26 ` [PATCH 1/2] xl/libxl: add netdev to vif specification Roger Pau Monne
2013-02-05 10:40 ` Ian Campbell
2013-02-05 10:56 ` Roger Pau Monné
2013-02-05 11:10 ` Ian Campbell
2013-02-05 11:39 ` Roger Pau Monné
2013-02-05 11:41 ` Ian Campbell
2013-01-25 15:26 ` Roger Pau Monne [this message]
2013-01-28 11:00 ` [PATCH 2/2] xl: allow specifying a default netdev in xl.conf George Dunlap
2013-01-28 17:11 ` George Dunlap
2013-01-29 11:01 ` Roger Pau Monné
2013-02-05 10:41 ` Ian Campbell
2013-02-05 11:00 ` Roger Pau Monné
2013-02-05 11:09 ` Ian Campbell
2013-01-25 16:16 ` [PATCH 0/2] add vif-route support to libxl/xl Roger Pau Monné
2013-02-05 11:48 ` Ian Campbell
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=1359127583-32490-3-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ulf.kreutzberg@hosteurope.de \
--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).