Skip to contentSkip to conversation

libxl: Allow network driver domains when run_hotplug_scritps is set

PATCH Applied George Dunlap 4 participants 11 messages Jul 5, 2013 – Sep 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libxl: Allow network driver domains when run_hotplug_scritps is set

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason to restrict this for network driver domains any more.

This is a candidate for backporting to 4.3.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>
CC Jan Beulich <[email protected]>
---
 docs/misc/xl-network-configuration.markdown |    6 ++----
 tools/libxl/libxl.c                         |    7 -------
 2 files changed, 2 insertions(+), 11 deletions(-)
docs/misc/xl-network-configuration.markdown +2 -4
index e0d3d2a..3c439d4 100644
@@ -131,10 +131,8 @@ specified IP address to be used by the guest (blocking all others).
 ### backend
 
 Specifies the backend domain which this device should attach to. This
-defaults to domain 0. This option does not work if `run_hotplug_scripts`
-is not disabled in xl.conf (see xl.conf(5) man page for more information
-on this option). Specifying another domain requires setting up a driver
-domain which is outside the scope of this document.
+defaults to domain 0.  Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
 
 ### rate
 
tools/libxl/libxl.c +0 -7
index bd63a30..81785df 100644
@@ -2820,13 +2820,6 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
     rc = libxl__resolve_domid(gc, nic->backend_domname, &nic->backend_domid);
     if (rc < 0) return rc;
 
-    if (nic->backend_domid != LIBXL_TOOLSTACK_DOMID && run_hotplug_scripts) {
-        LOG(ERROR, "cannot use a backend domain different than %d if"
-                   "hotplug scripts are executed from libxl",
-                   LIBXL_TOOLSTACK_DOMID);
-        return ERROR_FAIL;
-    }
-
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!nic->nictype)
Signature · 1 line
1.7.9.5
#1 lore raw

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.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>
---
 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(+)
docs/man/xl.conf.pod.5 +6 -0
index 1229c8a..d8d1bb1 100644
@@ -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.
tools/examples/xl.conf +4 -0
index 9c037a6..7b081d2 100644
@@ -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"
 
tools/libxl/xl.c +5 -0
index 1ce820c..c694e8f 100644
@@ -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;
tools/libxl/xl.h +1 -0
index 5ad3e17..e72a7d2 100644
@@ -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 {
tools/libxl/xl_cmdimpl.c +6 -0
index 8a478ba..f670c6c 100644
@@ -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);
Signature · 1 line
1.7.9.5
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] libxl: Add vif.default.backend to xl.conf

Quoted 7 lines · George Dunlap

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

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>

(Just one nit below)

Quoted 53 lines
---
 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(+)
docs/man/xl.conf.pod.5 +6 -0
index 1229c8a..d8d1bb1 100644
@@ -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.
tools/examples/xl.conf +4 -0
index 9c037a6..7b081d2 100644
@@ -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"
 
tools/libxl/xl.c +1 -0
index 1ce820c..c694e8f 100644
@@ -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;
 

tools/libxl/xl.c static void parse_global_config(const char *configfile, · line 162

Quoted 4 lines
tools/libxl/xl.c +1 -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);
 
+

There's an extra new line here.

Quoted 43 lines
tools/libxl/xl.c +3 -0
+    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;
tools/libxl/xl.h +1 -0
index 5ad3e17..e72a7d2 100644
@@ -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 {
tools/libxl/xl_cmdimpl.c +6 -0
index 8a478ba..f670c6c 100644
@@ -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);
#3 lore raw

Re: [PATCH 2/2] libxl: Add vif.default.backend to xl.conf

Quoted 4 lines · Roger Pau Monné
Quoted 3 lines · George Dunlap

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

Quoted 8 lines
Quoted 4 lines
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>

(Just one nit below)

Acked + applied (with nit fixed, which I just realised I forgot to note in the commit log, sorry)

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/2
#4 lore raw
In reply to George Dunlap
Quoted 11 lines · George Dunlap

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason to restrict this for network driver domains any more.

This is a candidate for backporting to 4.3.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>
CC Jan Beulich <[email protected]>
#5 lore raw
In reply to George Dunlap

Ping?

Quoted 59 lines · George Dunlap

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason to restrict this for network driver domains any more.

This is a candidate for backporting to 4.3.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Roger Pau Monne <[email protected]>
CC Jan Beulich <[email protected]>
---
 docs/misc/xl-network-configuration.markdown |    6 ++----
 tools/libxl/libxl.c                         |    7 -------
 2 files changed, 2 insertions(+), 11 deletions(-)
docs/misc/xl-network-configuration.markdown +2 -4
index e0d3d2a..3c439d4 100644
@@ -131,10 +131,8 @@ specified IP address to be used by the guest (blocking all others).
 ### backend
 
 Specifies the backend domain which this device should attach to. This
-defaults to domain 0. This option does not work if `run_hotplug_scripts`
-is not disabled in xl.conf (see xl.conf(5) man page for more information
-on this option). Specifying another domain requires setting up a driver
-domain which is outside the scope of this document.
+defaults to domain 0.  Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
 
 ### rate
 
tools/libxl/libxl.c +0 -8
index bd63a30..81785df 100644
@@ -2820,13 +2820,6 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
     rc = libxl__resolve_domid(gc, nic->backend_domname, &nic->backend_domid);
     if (rc < 0) return rc;
 
-    if (nic->backend_domid != LIBXL_TOOLSTACK_DOMID && run_hotplug_scripts) {
-        LOG(ERROR, "cannot use a backend domain different than %d if"
-                   "hotplug scripts are executed from libxl",
-                   LIBXL_TOOLSTACK_DOMID);
-        return ERROR_FAIL;
-    }
-
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (!nic->nictype)
--

1.7.9.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Applied
#6 lore raw

Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]

In reply to George Dunlap

George Dunlap writes ("[PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set"):

Quoted 3 lines

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason to restrict this for network driver domains any more.

Applied, thanks.

Quoted 1 line

This is a candidate for backporting to 4.3.

As usual, we should consider this after it's been in master for a bit.

Ian.

#7 lore raw

Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]

Quoted 8 lines · Ian Jackson

George Dunlap writes ("[PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set"):

Quoted 3 lines

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason to restrict this for network driver domains any more.

Applied, thanks.

Quoted 1 line

This is a candidate for backporting to 4.3.

As usual, we should consider this after it's been in master for a bit.

What is meant to trigger that consideration? Do you have a list somewhere, or are you relying on the submitter to ping after a certain amount of time?

I obviously prefer the first, so I can cross this off my list entirely...

-George

#8 lore raw

Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]

George Dunlap writes ("Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]"):

Quoted 5 lines

What is meant to trigger that consideration? Do you have a list somewhere, or are you relying on the submitter to ping after a certain amount of time?

I obviously prefer the first, so I can cross this off my list entirely...

I don't keep such a list. I probably should.

...

^P^P^P^K

I keep such a list and I have put this commit on it.

Ian.

#9 lore raw

Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]

Quoted 5 lines · Ian Jackson

George Dunlap writes ("Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]"):

Quoted 4 lines

What is meant to trigger that consideration? Do you have a list somewhere, or are you relying on the submitter to ping after a certain amount of time?

Quoted 8 lines
Quoted 1 line

I obviously prefer the first, so I can cross this off my list entirely...

I don't keep such a list. I probably should.

...

^P^P^P^K

I keep such a list and I have put this commit on it.

:-)

#10 lore raw

Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]

George Dunlap writes ("Re: [PATCH 1/2] libxl: Allow network driver domains when run_hotplug_scritps is set [and 1 more messages]"):

Quoted 1 line · Ian Jackson

...

Quoted 3 lines
Quoted 1 line

I keep such a list and I have put this commit on it.

:-)

I have cherry picked this onto 4.3.

It didn't apply cleanly to 4.2, and the commit 05bfd984dfe7 which it depends on doesn't appear to be in 4.2 either.

Thanks,
Ian.