This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Recent xl and network-route scripts [and 1 more messages

To: Ian Campbell <ian.campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] Recent xl and network-route scripts [and 1 more messages]
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Wed, 16 Mar 2011 16:45:46 +0000
Cc: Todd Deshane <todd.deshane@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "W. Michael Petullo" <mike@xxxxxxxx>
Delivery-date: Wed, 16 Mar 2011 09:46:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1300217108.32696.54.camel@xxxxxxxxxxxxxxxxxxxxx>, <61357fd45fd75880c268.1299232940@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: chiark.mail.xen.devel
References: <patchbomb.1299232939@xxxxxxxxxxxxxxxxxxxxx> <61357fd45fd75880c268.1299232940@xxxxxxxxxxxxxxxxxxxxx> <20110217011331.GA3090@xxxxxxxxx> <20110217072944.GA5345@xxxxxxxxxxx> <1297934374.16356.1364.camel@xxxxxxxxxxxxxxxxxxxxxx> <1297937409.16356.1441.camel@xxxxxxxxxxxxxxxxxxxxxx> <19806.37126.458191.518046@xxxxxxxxxxxxxxxxxxxxxxxx> <20110313185342.GA2710@xxxxxxxxx> <1300095333.17339.2081.camel@xxxxxxxxxxxxxxxxxxxxxx> <19839.44019.959627.318484@xxxxxxxxxxxxxxxxxxxxxxxx> <1300217108.32696.54.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Ian Campbell writes ("Re: [Xen-devel] Recent xl and network-route scripts"):
> On Tue, 2011-03-15 at 18:12 +0000, Ian Jackson wrote:
> > How about something like:
> > 
> > -    flexarray_append(back, nic->script);
> > +    flexarray_append(back, nic->script[0]=='/' ? nic->script :
> > +     libxl__sprintf(&gc, "%s/%s", libxl_xen_script_dir_path(), 
> > nic->script));

I've applied the patch below.

> Assuming there's an "if (nic-script)" above this context I think makes
> sense.

There wasn't, so I added one.  Looking at the code I think it's not
necessary but now is not the time to take the risk ...


# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1300293865 0
# Node ID 4ca13a170482edc642b8a7d8c68556c4194f11d0
# Parent  8074dff66e9791cef6be06dd9a24176a59f88c5e
libxl: provide full path to vif hotplug script script

This improves compatibility with xm style config files since xend does
this (see NetifController.getDeviceDetails() in
tools/python/xen/xend/server/netif.py) and
tools/hotplug/Linux/vif-setup expects an absolute path to the script.

This patch supports both absolute and relative paths in the
configuration.  Also, if somehow nic->script==NULL, don't add write
the entry to xenstore at all (rather than crashing due to the new
check for absolute vs relative path).

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 8074dff66e97 -r 4ca13a170482 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Mar 16 09:35:32 2011 +0000
+++ b/tools/libxl/libxl.c       Wed Mar 16 16:44:25 2011 +0000
@@ -1234,8 +1234,13 @@ int libxl_device_nic_add(libxl_ctx *ctx,
     flexarray_append(back, "1");
     flexarray_append(back, "state");
     flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
-    flexarray_append(back, "script");
-    flexarray_append(back, nic->script);
+    if (nic->script) {
+        flexarray_append(back, "script");
+        flexarray_append(back, nic->script[0]=='/' ? nic->script
+                         : libxl__sprintf(&gc, "%s/%s",
+                                          libxl_xen_script_dir_path(),
+                                          nic->script));
+    }
     flexarray_append(back, "mac");
     flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
                                                  nic->mac[0], nic->mac[1], 

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>