[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: provide full path to vif hotplug script script

# 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 @@
     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-changelog mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.