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

[Xen-devel] [PATCH 05/28] tools/hotplug: use XEN_SCRIPT_DIR instead of hardcoded path



Helper scripts get installed into XEN_SCRIPT_DIR, but initscripts,
helper scripts and udev rules still refer to the hardcoded location
/etc/xen/scripts/. Update scripts, rules and Makefile to refer to
@XEN_SCRIPT_DIR@ instead.

Update configure.ac to substitute the path in files using
XEN_SCRIPT_DIR. Remove XEN_SCRIPT_DIR from StdGNU.mk and SunOS.mk, its
already in Paths.mk.

Note: In SunOS.mk it refered to PRIVATE_PREFIX, which was introduced by
9f6d07bac9f14aaa8bafe38b4a217e61a3a57842 ("tools: get rid of hardcoded
config dirs").

Please rerun autogen.sh after applying this patch.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 .gitignore                                               |  6 ++++++
 config/StdGNU.mk                                         |  1 -
 config/SunOS.mk                                          |  1 -
 tools/configure.ac                                       |  6 ++++++
 .../Linux/init.d/{xen-watchdog => xen-watchdog.in}       |  2 +-
 tools/hotplug/Linux/init.d/xencommons.in.in              |  2 +-
 tools/hotplug/Linux/init.d/{xendomains => xendomains.in} |  2 +-
 tools/hotplug/Linux/{vif-setup => vif-setup.in}          |  2 +-
 .../Linux/{xen-backend.rules => xen-backend.rules.in}    | 16 ++++++++--------
 .../{xen-hotplug-common.sh => xen-hotplug-common.sh.in}  |  2 +-
 tools/hotplug/Linux/{xendomains => xendomains.in}        |  2 +-
 11 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index 67ed7cb..4344c52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -160,6 +160,12 @@ tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fs-back/fs-backend
 tools/hotplug/common/hotplugpath.sh
+tools/hotplug/Linux/init.d/xen-watchdog
+tools/hotplug/Linux/init.d/xendomains
+tools/hotplug/Linux/vif-setup
+tools/hotplug/Linux/xen-backend.rules
+tools/hotplug/Linux/xen-hotplug-common.sh
+tools/hotplug/Linux/xendomains
 tools/include/xen/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index ddf83d7..4cc3a01 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -48,7 +48,6 @@ XEN_PAGING_DIR = /var/lib/xen/xenpaging
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 BOOT_DIR ?= /boot
 
diff --git a/config/SunOS.mk b/config/SunOS.mk
index d493eca..1470514 100644
--- a/config/SunOS.mk
+++ b/config/SunOS.mk
@@ -32,7 +32,6 @@ PRIVATE_PREFIX = $(LIBDIR)/xen
 PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
 
 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(PRIVATE_PREFIX)/scripts
 
 BOOT_DIR ?= /boot
 
diff --git a/tools/configure.ac b/tools/configure.ac
index 4f45418..cc351c7 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -9,6 +9,8 @@ AC_CONFIG_FILES([
 ../config/Tools.mk
 hotplug/Linux/init.d/xencommons.in
 hotplug/Linux/init.d/sysconfig.xencommons
+hotplug/Linux/init.d/xen-watchdog
+hotplug/Linux/init.d/xendomains
 hotplug/Linux/systemd/proc-xen.mount
 hotplug/Linux/systemd/var-lib-xenstored.mount
 hotplug/Linux/systemd/xenstored.socket
@@ -18,6 +20,10 @@ hotplug/Linux/systemd/xenconsoled.service
 hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service
 hotplug/Linux/systemd/xendomains.service
 hotplug/Linux/systemd/xen-watchdog.service
+hotplug/Linux/vif-setup
+hotplug/Linux/xen-backend.rules
+hotplug/Linux/xen-hotplug-common.sh
+hotplug/Linux/xendomains
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
diff --git a/tools/hotplug/Linux/init.d/xen-watchdog 
b/tools/hotplug/Linux/init.d/xen-watchdog.in
similarity index 97%
rename from tools/hotplug/Linux/init.d/xen-watchdog
rename to tools/hotplug/Linux/init.d/xen-watchdog.in
index 3592fda..32c7268 100644
--- a/tools/hotplug/Linux/init.d/xen-watchdog
+++ b/tools/hotplug/Linux/init.d/xen-watchdog.in
@@ -17,7 +17,7 @@
 ### END INIT INFO
 #
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 DAEMON=${SBINDIR}/xenwatchdogd
 base=$(basename $DAEMON)
diff --git a/tools/hotplug/Linux/init.d/xencommons.in.in 
b/tools/hotplug/Linux/init.d/xencommons.in.in
index a723eb4..bd1d9ba 100644
--- a/tools/hotplug/Linux/init.d/xencommons.in.in
+++ b/tools/hotplug/Linux/init.d/xencommons.in.in
@@ -20,7 +20,7 @@
 
 XENSTORED=@XENSTORED@
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 if [ -d /etc/sysconfig ]; then
        xencommons_config=/etc/sysconfig
diff --git a/tools/hotplug/Linux/init.d/xendomains 
b/tools/hotplug/Linux/init.d/xendomains.in
similarity index 97%
rename from tools/hotplug/Linux/init.d/xendomains
rename to tools/hotplug/Linux/init.d/xendomains.in
index 3857602..5b88e2d 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains.in
@@ -24,7 +24,7 @@
 #                    systemd systems.
 ### END INIT INFO
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 case "$1" in
     start)
diff --git a/tools/hotplug/Linux/vif-setup b/tools/hotplug/Linux/vif-setup.in
similarity index 61%
rename from tools/hotplug/Linux/vif-setup
rename to tools/hotplug/Linux/vif-setup.in
index bcc462e..c3bc662 100644
--- a/tools/hotplug/Linux/vif-setup
+++ b/tools/hotplug/Linux/vif-setup.in
@@ -4,6 +4,6 @@ if test "$script"
 then
     exec $script $*
 else
-    exec /etc/xen/scripts/vif-bridge $*
+    exec @XEN_SCRIPT_DIR@/vif-bridge $*
 fi
 
diff --git a/tools/hotplug/Linux/xen-backend.rules 
b/tools/hotplug/Linux/xen-backend.rules.in
similarity index 62%
rename from tools/hotplug/Linux/xen-backend.rules
rename to tools/hotplug/Linux/xen-backend.rules.in
index a0d409e..7d2f914 100644
--- a/tools/hotplug/Linux/xen-backend.rules
+++ b/tools/hotplug/Linux/xen-backend.rules.in
@@ -1,10 +1,10 @@
-SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", 
RUN+="/etc/xen/scripts/blktap $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", 
RUN+="/etc/xen/scripts/block $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 
$env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", 
ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online type_if=vif"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", 
ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline type_if=vif"
-SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi 
$env{ACTION}"
-SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", 
RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
+SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", 
RUN+="@XEN_SCRIPT_DIR@/blktap $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", 
RUN+="@XEN_SCRIPT_DIR@/block $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="@XEN_SCRIPT_DIR@/vif2 
$env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", 
ACTION=="online", RUN+="@XEN_SCRIPT_DIR@/vif-setup online type_if=vif"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", 
ACTION=="offline", RUN+="@XEN_SCRIPT_DIR@/vif-setup offline type_if=vif"
+SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="@XEN_SCRIPT_DIR@/vscsi 
$env{ACTION}"
+SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", 
RUN+="@XEN_SCRIPT_DIR@/xen-hotplug-cleanup"
 KERNEL=="evtchn", NAME="xen/%k"
 SUBSYSTEM=="xen", KERNEL=="blktap[0-9]*", NAME="xen/%k", MODE="0600"
 SUBSYSTEM=="blktap2", KERNEL=="blktap[0-9]*", NAME="xen/blktap-2/%k", 
MODE="0600"
@@ -12,4 +12,4 @@ KERNEL=="blktap-control", NAME="xen/blktap-2/control", 
MODE="0600"
 KERNEL=="gntdev", NAME="xen/%k", MODE="0600"
 KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600"
 KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600"
-SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", 
RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap"
+SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", 
RUN+="@XEN_SCRIPT_DIR@/vif-setup $env{ACTION} type_if=tap"
diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh 
b/tools/hotplug/Linux/xen-hotplug-common.sh.in
similarity index 98%
rename from tools/hotplug/Linux/xen-hotplug-common.sh
rename to tools/hotplug/Linux/xen-hotplug-common.sh.in
index 7af4688..996e974 100644
--- a/tools/hotplug/Linux/xen-hotplug-common.sh
+++ b/tools/hotplug/Linux/xen-hotplug-common.sh.in
@@ -112,7 +112,7 @@ xenstore_write() {
 # Execute each hook in the <hook> directory.
 #
 call_hooks() {
-  for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do
+  for f in @XEN_SCRIPT_DIR@/${1}-${2}.d/*.hook; do
     if [ -x "$f" ]; then . "$f"; fi
   done
 }
diff --git a/tools/hotplug/Linux/xendomains b/tools/hotplug/Linux/xendomains.in
similarity index 99%
rename from tools/hotplug/Linux/xendomains
rename to tools/hotplug/Linux/xendomains.in
index c45f132..de711b7 100644
--- a/tools/hotplug/Linux/xendomains
+++ b/tools/hotplug/Linux/xendomains.in
@@ -27,7 +27,7 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 CMD=${SBINDIR}/xl
 HEADCOMP="Xen saved domain"

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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