[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Recent xl and network-route scripts [and 1 more messages]
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 ... Ian. # 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], nic->mac[2], _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |