Skip to contentSkip to conversation

add vif-route support to libxl/xl

PATCH Superseded Roger Pau Monne 4 participants 20 messages Feb 6, 2013 – Mar 13, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover add vif-route support to libxl/xl

Support for vif-route was missing in libxl, this patch series adds a gatewaydev/netdev vif option and also allows setting a default gatewaydev in xl.conf global configuration file.

vif-route doesn't support HVM domains because it doesn't support the "add" or "remove" actions.

I would like to request some testing from people that actually use this network mode.

#1 lore raw

PATCH v2 1/4 xl/libxl: add gatewaydev/netdev to vif specification

This option is used by the vif-route hotplug script. A new more descriptive name is used, "gatewaydev", but "netdev" is also supported as a deprecated backwards compatible option.

This option was supported in the past, according to
http://wiki.xen.org/wiki/Vif-route, so we should also support it in libxl.

Cc Ulf Kreutzberg <[email protected]>
Cc Ian Campbell <[email protected]>
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Don't pass a NULL as a value of a env variable
* Change netdev to gatewaydev

---
 docs/misc/xl-network-configuration.markdown |   10 ++++++++++
 tools/libxl/libxl.c                         |    6 +++++-
 tools/libxl/libxl_linux.c                   |    9 ++++++++-
 tools/libxl/libxl_types.idl                 |    1 +
 tools/libxl/xl_cmdimpl.c                    |   14 ++++++++++++++
 5 files changed, 38 insertions(+), 2 deletions(-)
docs/misc/xl-network-configuration.markdown +10 -0
index 5e2f049..e0d3d2a 100644
@@ -67,6 +67,15 @@ added to. The default is `xenbr0`. The bridge must be configured using
 your distribution's network configuration tools. See the [wiki][net]
 for guidance and examples.
 
+### gatewaydev
+
+Specifies the name of the network interface which has an IP and which
+is in the network the VIF should communicate with. This is used in the host
+by the vif-route hotplug script. See [wiki][vifroute] for guidance and
+examples.
+
+NOTE: netdev is a deprecated alias of this option.
+
 ### type
 
 This keyword is valid for HVM guests only.
@@ -158,3 +167,4 @@ on the underlying netback implementation.
 
 [oui]: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier
 [net]: http://wiki.xen.org/wiki/HostConfiguration/Networking
+[vifroute]: http://wiki.xen.org/wiki/Vif-route
tools/libxl/libxl.c +5 -1
index 73e0dc3..5d590f1 100644
@@ -2826,7 +2826,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
     if (rc) goto out;
 
     front = flexarray_make(gc, 16, 1);
-    back = flexarray_make(gc, 16, 1);
+    back = flexarray_make(gc, 18, 1);
 
     if (nic->devid == -1) {
         if ((nic->devid = libxl__device_nextid(gc, domid, "vif") < 0)) {
@@ -2862,6 +2862,10 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(back, "ip");
         flexarray_append(back, libxl__strdup(gc, nic->ip));
     }
+    if (nic->gatewaydev) {
+        flexarray_append(back, "gatewaydev");
+        flexarray_append(back, libxl__strdup(gc, nic->gatewaydev));
+    }
 
     if (nic->rate_interval_usecs > 0) {
         flexarray_append(back, "rate");
tools/libxl/libxl_linux.c +8 -1
index 1fed3cd..60fc533 100644
@@ -84,11 +84,16 @@ static char **get_hotplug_env(libxl__gc *gc,
                               char *script, libxl__device *dev)
 {
     const char *type = libxl__device_kind_to_string(dev->backend_kind);
+    char *be_path = libxl__device_backend_path(gc, dev);
     char **env;
+    char *gatewaydev;
     int nr = 0;
     libxl_nic_type nictype;
 
-    const int arraysize = 13;
+    gatewaydev = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/%s", be_path,
+                                                        "gatewaydev"));
+
+    const int arraysize = 15;
     GCNEW_ARRAY(env, arraysize);
     env[nr++] = "script";
     env[nr++] = script;
@@ -98,6 +103,8 @@ static char **get_hotplug_env(libxl__gc *gc,
     env[nr++] = GCSPRINTF("backend/%s/%u/%d", type, dev->domid, dev->devid);
     env[nr++] = "XENBUS_BASE_PATH";
     env[nr++] = "backend";
+    env[nr++] = "netdev";
+    env[nr++] = gatewaydev ? : "";
     if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) {
         if (libxl__nic_type(gc, dev, &nictype)) {
             LOG(ERROR, "unable to get nictype");
tools/libxl/libxl_types.idl +1 -0
index acc4bc9..0112a7a 100644
@@ -382,6 +382,7 @@ libxl_device_nic = Struct("device_nic", [
     ("nictype", libxl_nic_type),
     ("rate_bytes_per_interval", uint64),
     ("rate_interval_usecs", uint32),
+    ("gatewaydev", string),
     ])
 
 libxl_device_pci = Struct("device_pci", [
tools/libxl/xl_cmdimpl.c +14 -0
index 080bbd8..dc1788e 100644
@@ -1205,6 +1205,14 @@ static void parse_config_data(const char *config_source,
                     parse_vif_rate(&config, (p2 + 1), nic);
                 } else if (!strcmp(p, "accel")) {
                     fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
+                } else if (!strcmp(p, "netdev")) {
+                    fprintf(stderr, "the netdev parameter is deprecated, "
+                                    "please use gatewaydev instead\n");
+                    free(nic->gatewaydev);
+                    nic->gatewaydev = strdup(p2 + 1);
+                } else if (!strcmp(p, "gatewaydev")) {
+                    free(nic->gatewaydev);
+                    nic->gatewaydev = strdup(p2 + 1);
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
 skip_nic:
@@ -5471,6 +5479,12 @@ int main_networkattach(int argc, char **argv)
             }
         } else if (MATCH_OPTION("bridge", *argv, oparg)) {
             replace_string(&nic.bridge, oparg);
+        } else if (MATCH_OPTION("netdev", *argv, oparg)) {
+            fprintf(stderr, "the netdev parameter is deprecated, "
+                            "please use gatewaydev instead\n");
+            replace_string(&nic.gatewaydev, oparg);
+        } else if (MATCH_OPTION("gatewaydev", *argv, oparg)) {
+            replace_string(&nic.gatewaydev, oparg);
         } else if (MATCH_OPTION("ip", *argv, oparg)) {
             replace_string(&nic.ip, oparg);
         } else if (MATCH_OPTION("script", *argv, oparg)) {
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] xl/libxl: add gatewaydev/netdev to vif specification

Quoted 10 lines · Roger Pau Monne

This option is used by the vif-route hotplug script. A new more descriptive name is used, "gatewaydev", but "netdev" is also supported as a deprecated backwards compatible option.

This option was supported in the past, according to
http://wiki.xen.org/wiki/Vif-route, so we should also support it in libxl.

Quoted 127 lines
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Don't pass a NULL as a value of a env variable
* Change netdev to gatewaydev

---
 docs/misc/xl-network-configuration.markdown |   10 ++++++++++
 tools/libxl/libxl.c                         |    6 +++++-
 tools/libxl/libxl_linux.c                   |    9 ++++++++-
 tools/libxl/libxl_types.idl                 |    1 +
 tools/libxl/xl_cmdimpl.c                    |   14 ++++++++++++++
 5 files changed, 38 insertions(+), 2 deletions(-)
docs/misc/xl-network-configuration.markdown +10 -0
index 5e2f049..e0d3d2a 100644
@@ -67,6 +67,15 @@ added to. The default is `xenbr0`. The bridge must be configured using
 your distribution's network configuration tools. See the [wiki][net]
 for guidance and examples.
 
+### gatewaydev
+
+Specifies the name of the network interface which has an IP and which
+is in the network the VIF should communicate with. This is used in the host
+by the vif-route hotplug script. See [wiki][vifroute] for guidance and
+examples.
+
+NOTE: netdev is a deprecated alias of this option.
+
 ### type
 
 This keyword is valid for HVM guests only.
@@ -158,3 +167,4 @@ on the underlying netback implementation.
 
 [oui]: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier
 [net]: http://wiki.xen.org/wiki/HostConfiguration/Networking
+[vifroute]: http://wiki.xen.org/wiki/Vif-route
tools/libxl/libxl.c +5 -1
index 73e0dc3..5d590f1 100644
@@ -2826,7 +2826,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
     if (rc) goto out;
 
     front = flexarray_make(gc, 16, 1);
-    back = flexarray_make(gc, 16, 1);
+    back = flexarray_make(gc, 18, 1);
 
     if (nic->devid == -1) {
         if ((nic->devid = libxl__device_nextid(gc, domid, "vif") < 0)) {
@@ -2862,6 +2862,10 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
         flexarray_append(back, "ip");
         flexarray_append(back, libxl__strdup(gc, nic->ip));
     }
+    if (nic->gatewaydev) {
+        flexarray_append(back, "gatewaydev");
+        flexarray_append(back, libxl__strdup(gc, nic->gatewaydev));
+    }
 
     if (nic->rate_interval_usecs > 0) {
         flexarray_append(back, "rate");
tools/libxl/libxl_linux.c +8 -1
index 1fed3cd..60fc533 100644
@@ -84,11 +84,16 @@ static char **get_hotplug_env(libxl__gc *gc,
                               char *script, libxl__device *dev)
 {
     const char *type = libxl__device_kind_to_string(dev->backend_kind);
+    char *be_path = libxl__device_backend_path(gc, dev);
     char **env;
+    char *gatewaydev;
     int nr = 0;
     libxl_nic_type nictype;
 
-    const int arraysize = 13;
+    gatewaydev = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/%s", be_path,
+                                                        "gatewaydev"));
+
+    const int arraysize = 15;
     GCNEW_ARRAY(env, arraysize);
     env[nr++] = "script";
     env[nr++] = script;
@@ -98,6 +103,8 @@ static char **get_hotplug_env(libxl__gc *gc,
     env[nr++] = GCSPRINTF("backend/%s/%u/%d", type, dev->domid, dev->devid);
     env[nr++] = "XENBUS_BASE_PATH";
     env[nr++] = "backend";
+    env[nr++] = "netdev";
+    env[nr++] = gatewaydev ? : "";
     if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) {
         if (libxl__nic_type(gc, dev, &nictype)) {
             LOG(ERROR, "unable to get nictype");
tools/libxl/libxl_types.idl +1 -0
index acc4bc9..0112a7a 100644
@@ -382,6 +382,7 @@ libxl_device_nic = Struct("device_nic", [
     ("nictype", libxl_nic_type),
     ("rate_bytes_per_interval", uint64),
     ("rate_interval_usecs", uint32),
+    ("gatewaydev", string),
     ])
 
 libxl_device_pci = Struct("device_pci", [
tools/libxl/xl_cmdimpl.c +8 -0
index 080bbd8..dc1788e 100644
@@ -1205,6 +1205,14 @@ static void parse_config_data(const char *config_source,
                     parse_vif_rate(&config, (p2 + 1), nic);
                 } else if (!strcmp(p, "accel")) {
                     fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
+                } else if (!strcmp(p, "netdev")) {
+                    fprintf(stderr, "the netdev parameter is deprecated, "
+                                    "please use gatewaydev instead\n");
+                    free(nic->gatewaydev);
+                    nic->gatewaydev = strdup(p2 + 1);
+                } else if (!strcmp(p, "gatewaydev")) {
+                    free(nic->gatewaydev);
+                    nic->gatewaydev = strdup(p2 + 1);
                 }
             } while ((p = strtok(NULL, ",")) != NULL);
 skip_nic:
@@ -5471,6 +5479,12 @@ int main_networkattach(int argc, char **argv)
             }
         } else if (MATCH_OPTION("bridge", *argv, oparg)) {

tools/libxl/xl_cmdimpl.c int main_networkattach(int argc, char **argv) · line 5490

Quoted 10 lines
tools/libxl/xl_cmdimpl.c +6 -0
             replace_string(&nic.bridge, oparg);
+        } else if (MATCH_OPTION("netdev", *argv, oparg)) {
+            fprintf(stderr, "the netdev parameter is deprecated, "
+                            "please use gatewaydev instead\n");
+            replace_string(&nic.gatewaydev, oparg);
+        } else if (MATCH_OPTION("gatewaydev", *argv, oparg)) {
+            replace_string(&nic.gatewaydev, oparg);
         } else if (MATCH_OPTION("ip", *argv, oparg)) {
             replace_string(&nic.ip, oparg);
         } else if (MATCH_OPTION("script", *argv, oparg)) {

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

#3 lore raw

PATCH v2 2/4 xl: allow specifying a default gatewaydev in xl.conf

In reply to Roger Pau Monne

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.

Cc Ulf Kreutzberg <[email protected]>
Cc Ian Campbell <[email protected]>
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Rename defaultnetdev to vif.default.gatewaydev

---
 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(-)
docs/man/xl.conf.pod.5 +6 -0
index 82c6b20..f8f7e7f 100644
@@ -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
tools/examples/xl.conf +3 -0
index 28ab796..9a03fff 100644
@@ -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"
tools/libxl/xl.c +4 -0
index ecbcd3b..f657216 100644
@@ -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;
@@ -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, "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;
tools/libxl/xl.h +1 -0
index be6f38b..b881f92 100644
@@ -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 {
tools/libxl/xl_cmdimpl.c +5 -0
index dc1788e..7796498 100644
@@ -1141,6 +1141,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;
Signature · 7 lines
1.7.7.5 (Apple Git-26)


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

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Roger,

after applying patch v2 1/4 and 2/4 (are there missing some?) to git checkout c23ea051ccee613e668b2a87817d49a28215ac8b of
git://xenbits.xen.org/xen.git xen

I get the following error(s) during compiling with 'make tools':

In file included from libxl.h:355,

                 from xl_cmdtable.c:17:

_libxl_types.h:437: error: duplicate member ‘gatewaydev’ make[3]: *** [xl_cmdtable.o] Error 1

Quoted 4 lines · Roger Pau Monne

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.

Thanks and best regards,
Ulf

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

#5 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Quoted 4 lines · Ulf Kreutzberg

Roger,

after applying patch v2 1/4 and 2/4 (are there missing some?)

Well, you might want to try 3/4 and 4/4 also, but they are not mandatory.

Quoted 9 lines

to git checkout c23ea051ccee613e668b2a87817d49a28215ac8b of
git://xenbits.xen.org/xen.git xen

I get the following error(s) during compiling with 'make tools':

In file included from libxl.h:355,

                 from xl_cmdtable.c:17:

_libxl_types.h:437: error: duplicate member ‘gatewaydev’ make[3]: *** [xl_cmdtable.o] Error 1

Could you take a look at tools/libxl/libxl_types.idl?

You should have something like the following chunk:

libxl_device_nic = Struct("device_nic", [

    ("backend_domid", libxl_domid),
    ("devid", libxl_devid),
    ("mtu", integer),
    ("model", string),
    ("mac", libxl_mac),
    ("ip", string),
    ("bridge", string),
    ("ifname", string),
    ("script", string),
    ("nictype", libxl_nic_type),
    ("rate_bytes_per_interval", uint64),
    ("rate_interval_usecs", uint32),
    ("gatewaydev", string),
    ])

(With only one "gatewaydev").

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

#6 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Hello Roger,
hello everybody,

sorry for the late reply.

Quoted 20 lines · Roger Pau Monné

Could you take a look at tools/libxl/libxl_types.idl?

You should have something like the following chunk:

libxl_device_nic = Struct("device_nic", [

    ("backend_domid", libxl_domid),
    ("devid", libxl_devid),
    ("mtu", integer),
    ("model", string),
    ("mac", libxl_mac),
    ("ip", string),
    ("bridge", string),
    ("ifname", string),
    ("script", string),
    ("nictype", libxl_nic_type),
    ("rate_bytes_per_interval", uint64),
    ("rate_interval_usecs", uint32),
    ("gatewaydev", string),
    ])
Quoted 2 lines

(With only one "gatewaydev").

That was my copy'n'paste mistake - fixed.

I could see that after applying patches V1 the parameter "netdev" is parsed correctly and the main ip is passed to xen scripts. However, I could not get xen 4.3 running so I had to test 4.3 tools on 4.2.1 hypervisor, which could not start the domU, but debug output of the scripts showed me everything is parsed as expected.

The mac address still is not parsed if digits are not padded with leading zero, like "mac=de:ad:a:1e:42:3" - the rest of the line is ignored without any error.

However, I was not able to apply patches V2 after that, they do not seem to work together with the first patch series.
Only patching with V2 resulted in missing "netdev" member in libxl_device_nic (libxl_types.idl). After editing the file and adding the definition, it compiled so far.

xl with only patches V2 applied does parse neither netdev nor gatewaydev as it seems.

Best regards,
Ulf

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

#7 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Quoted 36 lines · Ulf Kreutzberg

Hello Roger,
hello everybody,

sorry for the late reply.

Quoted 20 lines · Roger Pau Monné

Could you take a look at tools/libxl/libxl_types.idl?

You should have something like the following chunk:

libxl_device_nic = Struct("device_nic", [

    ("backend_domid", libxl_domid),
    ("devid", libxl_devid),
    ("mtu", integer),
    ("model", string),
    ("mac", libxl_mac),
    ("ip", string),
    ("bridge", string),
    ("ifname", string),
    ("script", string),
    ("nictype", libxl_nic_type),
    ("rate_bytes_per_interval", uint64),
    ("rate_interval_usecs", uint32),
    ("gatewaydev", string),
    ])
Quoted 2 lines

(With only one "gatewaydev").

That was my copy'n'paste mistake - fixed.

I could see that after applying patches V1 the parameter "netdev" is parsed correctly and the main ip is passed to xen scripts. However, I could not get xen 4.3 running so I had to test 4.3 tools on 4.2.1 hypervisor, which could not start the domU, but debug output of the scripts showed me everything is parsed as expected.

Quoted 6 lines

The mac address still is not parsed if digits are not padded with leading zero, like "mac=de:ad:a:1e:42:3" - the rest of the line is ignored without any error.

However, I was not able to apply patches V2 after that, they do not seem to work together with the first patch series.

Hello Ulf,

Version v2 should be applied without v1, they are not additional patches, it's a revision of the same patches (trying to apply both will lead to errors). To simplify it I've pushed the patches to my git repo, so you can fetch them easily:

$ git clone -b vif_route_v2 git://xenbits.xen.org/people/royger/xen.git

More information about how to build Xen from source can be found at
http://wiki.xen.org/wiki/Compiling_Xen_From_Source#Building_from_Source.

Hope this helps, Roger.

Quoted 4 lines

Only patching with V2 resulted in missing "netdev" member in libxl_device_nic (libxl_types.idl). After editing the file and adding the definition, it compiled so far.

Quoted 8 lines

xl with only patches V2 applied does parse neither netdev nor gatewaydev as it seems.

Best regards,
Ulf

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

#8 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Hello Roger,
hi all,

Quoted 7 lines · Roger Pau Monné
Quoted 6 lines

The mac address still is not parsed if digits are not padded with leading zero, like "mac=de:ad:a:1e:42:3" - the rest of the line is ignored without any error.

However, I was not able to apply patches V2 after that, they do not seem to work together with the first patch series.

Quoted 9 lines

Hello Ulf,

Version v2 should be applied without v1, they are not additional patches, it's a revision of the same patches (trying to apply both will lead to errors). To simplify it I've pushed the patches to my git repo, so you can fetch them easily:

$ git clone -b vif_route_v2 git://xenbits.xen.org/people/royger/xen.git

Many thanks, building that tree definitely works. (Still could not get xen 4.3 running, but that is not the issue here). I have tested the utils with Xen 4.2.1 and parsing of domu configs with netdev= and gatewaydev= parameter works perfectly. Domu does start up and is reacheable. I wonder if you could backport these changes to 4.2?

One caveat: the mac address and therfore the rest of the domu config still is not parsed if not padded with leading zeros, as mentioned before.

Best regards,
Ulf

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

#9 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Quoted 18 lines · Ulf Kreutzberg

Hello Roger,
hi all,

Quoted 14 lines · Roger Pau Monné
Quoted 6 lines

The mac address still is not parsed if digits are not padded with leading zero, like "mac=de:ad:a:1e:42:3" - the rest of the line is ignored without any error.

However, I was not able to apply patches V2 after that, they do not seem to work together with the first patch series.

Hello Ulf,

Version v2 should be applied without v1, they are not additional patches, it's a revision of the same patches (trying to apply both will lead to errors). To simplify it I've pushed the patches to my git repo, so you can fetch them easily:

Quoted 8 lines
Quoted 2 lines
$ git clone -b vif_route_v2 git://xenbits.xen.org/people/royger/xen.git

Many thanks, building that tree definitely works. (Still could not get xen 4.3 running, but that is not the issue here). I have tested the utils with Xen 4.2.1 and parsing of domu configs with netdev= and gatewaydev= parameter works perfectly. Domu does start up and is reacheable. I wonder if you could backport these changes to 4.2?

Are you OK if I add your "Tested-by"?

Could you please take a look at the patches when you can IanJ? I would like to get this off my patch queue :)

Quoted 6 lines

One caveat: the mac address and therfore the rest of the domu config still is not parsed if not padded with leading zeros, as mentioned before.

Best regards,
Ulf

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

#10 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Roger,

sorry for the very-late reply...

Quoted 3 lines · Roger Pau Monné

Are you OK if I add your "Tested-by"?

That is OK, of course.

Thanks and regards,
Ulf

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

Acked-by on v2 2/4
#11 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

In reply to Roger Pau Monne
Quoted 11 lines · Roger Pau Monne

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.

Cc Ulf Kreutzberg <[email protected]>
Cc Ian Campbell <[email protected]>
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Rename defaultnetdev to vif.default.gatewaydev

That whole file is a bit uncomfortable ad-hoc in its naming, but oh well.

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

#12 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Quoted 13 lines · Ian Campbell
Quoted 11 lines · Roger Pau Monne

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.

Cc Ulf Kreutzberg <[email protected]>
Cc Ian Campbell <[email protected]>
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Rename defaultnetdev to vif.default.gatewaydev

Quoted 2 lines

That whole file is a bit uncomfortable ad-hoc in its naming, but oh well.

Although if you fancied writing down some sort of simple "schema" (which is far too grand a word for what I'm thinking of) which fits the scheme you are using here and could serve as guidance for future new variable names, that would be very nice.

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

#13 lore raw

Re: [PATCH v2 2/4] xl: allow specifying a default gatewaydev in xl.conf

Quoted 14 lines · Ian Campbell
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Roger Pau Monne

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.

Cc Ulf Kreutzberg <[email protected]>
Cc Ian Campbell <[email protected]>
Cc George Dunlap <[email protected]>

---
Changes since v1:
* Rename defaultnetdev to vif.default.gatewaydev

Quoted 7 lines
Quoted 2 lines

That whole file is a bit uncomfortable ad-hoc in its naming, but oh well.

Although if you fancied writing down some sort of simple "schema" (which is far too grand a word for what I'm thinking of) which fits the scheme you are using here and could serve as guidance for future new variable names, that would be very nice.

Thanks for the review, I guess the best place for this would be a comment on the code next to the section that parses the global options.

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

#14 lore raw

PATCH v2 3/4 xl: add vif.default.bridge

In reply to Roger Pau Monne

This is a replacement for defaultbridge xl.conf option. The now deprecated defaultbridge is still supported.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/examples/xl.conf |    3 +++
 tools/libxl/xl.c       |   13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
tools/examples/xl.conf +3 -0
index 9a03fff..4451176 100644
@@ -23,3 +23,6 @@
 
 # default gateway device to use with vif-route hotplug script
 #vif.default.gatewaydev="eth0"
+
+# default bridge device to use with vif-bridge hotplug scripts
+#vif.default.bridge="bridge0"
tools/libxl/xl.c +11 -2
index f657216..100ab32 100644
@@ -89,8 +89,17 @@ static void parse_global_config(const char *configfile,
     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, "defaultbridge", &buf, 0)) {
+        fprintf(stderr, "the global config option defaultbridge is deprecated, "
+                        "please switch to vif.default.bridge\n");
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }
+
+    if (!xlu_cfg_get_string (config, "vif.default.bridge", &buf, 0)) {
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }
 
     if (!xlu_cfg_get_string (config, "vif.default.gatewaydev", &buf, 0))
         default_gatewaydev = strdup(buf);
Signature · 7 lines
1.7.7.5 (Apple Git-26)


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

Re: [PATCH v2 3/4] xl: add vif.default.bridge

Quoted 9 lines · Roger Pau Monne

This is a replacement for defaultbridge xl.conf option. The now deprecated defaultbridge is still supported.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/examples/xl.conf |    3 +++
 tools/libxl/xl.c       |   13 +++++++++++--

No change to docs/man/xl.conf.pod.5? 2 files changed, 14 insertions(+), 2 deletions(-)

tools/examples/xl.conf line 28

Quoted 12 lines
tools/examples/xl.conf +3 -0
index 9a03fff..4451176 100644
@@ -23,3 +23,6 @@
 
 # default gateway device to use with vif-route hotplug script
 #vif.default.gatewaydev="eth0"
+
+# default bridge device to use with vif-bridge hotplug scripts
+#vif.default.bridge="bridge0"

Common names (at least in Linux-land) are "xenbr0" and "br0". Unless this conflicts massively with *BSD perhaps using one of those would be useful?

Quoted 11 lines
tools/libxl/xl.c +1 -2
index f657216..100ab32 100644
@@ -89,8 +89,17 @@ static void parse_global_config(const char *configfile,
     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, "defaultbridge", &buf, 0)) {

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

Quoted 10 lines
tools/libxl/xl.c +10 -0
+        fprintf(stderr, "the global config option defaultbridge is deprecated, "
+                        "please switch to vif.default.bridge\n");
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }
+
+    if (!xlu_cfg_get_string (config, "vif.default.bridge", &buf, 0)) {
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }

Put else if (!xlu.... ("defaultbridge")... ) here instead of above so we only warn if the user gave defaultbridge but not vif.default.bridge?

Ian.

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

#16 lore raw

Re: [PATCH v2 3/4] xl: add vif.default.bridge

Quoted 4 lines · Ian Campbell
Quoted 3 lines · Roger Pau Monne

This is a replacement for defaultbridge xl.conf option. The now deprecated defaultbridge is still supported.

Quoted 8 lines
Quoted 6 lines
Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/examples/xl.conf |    3 +++
 tools/libxl/xl.c       |   13 +++++++++++--

No change to docs/man/xl.conf.pod.5?

My bad, I'm going to add it now.

Quoted 9 lines
2 files changed, 14 insertions(+),

2 deletions(-)

Quoted 7 lines
tools/examples/xl.conf +0 -0
index 9a03fff..4451176 100644
@@ -23,3 +23,6 @@
 
Quoted 9 lines

tools/examples/xl.conf line 28

Quoted 5 lines
tools/examples/xl.conf +3 -0
 # default gateway device to use with vif-route hotplug script
 #vif.default.gatewaydev="eth0"
+
+# default bridge device to use with vif-bridge hotplug scripts
+#vif.default.bridge="bridge0"

Common names (at least in Linux-land) are "xenbr0" and "br0". Unless this conflicts massively with *BSD perhaps using one of those would be useful?

I use bridgeX on both Linux and BSD, but that's just my choice. br0 or xenbr0 is probably more common, so I'm going to change it.

Quoted 10 lines
Quoted 10 lines
tools/libxl/xl.c +0 -0
index f657216..100ab32 100644
@@ -89,8 +89,17 @@ static void parse_global_config(const char *configfile,
     if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
         default_vifscript = strdup(buf);
 
Quoted 16 lines

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

Quoted 13 lines
tools/libxl/xl.c +11 -2
-    if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0))
-	default_bridge = strdup(buf);
+    if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0)) {
+        fprintf(stderr, "the global config option defaultbridge is deprecated, "
+                        "please switch to vif.default.bridge\n");
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }
+
+    if (!xlu_cfg_get_string (config, "vif.default.bridge", &buf, 0)) {
+        free(default_bridge);
+        default_bridge = strdup(buf);
+    }

Put else if (!xlu.... ("defaultbridge")... ) here instead of above so we only warn if the user gave defaultbridge but not vif.default.bridge?

Since "defaultbridge" is now deprecated I think we should warn the user about it, even if vif.default.bridge is also specified (which also doesn't make much sense to use both)

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

#17 lore raw

PATCH v2 4/4 xl: add vif.default.script

In reply to Roger Pau Monne

Replace vifscript with vif.default.script. The old config option is kept for backwards compatibility.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/xl.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
tools/libxl/xl.c +10 -1
index 100ab32..92565d1 100644
@@ -86,8 +86,17 @@ static void parse_global_config(const char *configfile,
         exit(1);
     }
 
-    if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
+    if (!xlu_cfg_get_string (config, "vifscript", &buf, 0)) {
+        fprintf(stderr, "the global config option vifscript is deprecated, "
+                        "please switch to vif.default.script\n");
+        free(default_vifscript);
         default_vifscript = strdup(buf);
+    }
+
+    if (!xlu_cfg_get_string (config, "vif.default.script", &buf, 0)) {
+        free(default_vifscript);
+        default_vifscript = strdup(buf);
+    }
 
     if (!xlu_cfg_get_string (config, "defaultbridge", &buf, 0)) {
         fprintf(stderr, "the global config option defaultbridge is deprecated, "
Signature · 7 lines
1.7.7.5 (Apple Git-26)


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

Re: [PATCH v2 4/4] xl: add vif.default.script

Quoted 6 lines · Roger Pau Monne

Replace vifscript with vif.default.script. The old config option is kept for backwards compatibility.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>

I haven't done a detailed review of the code, but the naming looks fine to me.

-George

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

#19 lore raw

Re: [PATCH v2 4/4] xl: add vif.default.script

In reply to Roger Pau Monne
Quoted 8 lines · Roger Pau Monne

Replace vifscript with vif.default.script. The old config option is kept for backwards compatibility.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/xl.c |   11 ++++++++++-

Needs docs changes too I expect.

Quoted 12 lines
 1 files changed, 10 insertions(+), 1 deletions(-)
tools/libxl/xl.c +1 -1
index 100ab32..92565d1 100644
@@ -86,8 +86,17 @@ static void parse_global_config(const char *configfile,
         exit(1);
     }
 
-    if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
+    if (!xlu_cfg_get_string (config, "vifscript", &buf, 0)) {

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

Quoted 10 lines
tools/libxl/xl.c +9 -0
+        fprintf(stderr, "the global config option vifscript is deprecated, "
+                        "please switch to vif.default.script\n");
+        free(default_vifscript);
         default_vifscript = strdup(buf);
+    }
+
+    if (!xlu_cfg_get_string (config, "vif.default.script", &buf, 0)) {
+        free(default_vifscript);
+        default_vifscript = strdup(buf);
+    }

Same comment as 3/4 about checking the deprecated name second.

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