From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] tools/stubdom: get rid of hardcoded pathes
Date: Thu, 28 May 2009 18:42:48 +0200 [thread overview]
Message-ID: <200905281842.48191.Christoph.Egger@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
Hi!
Attached patch makes xen-tools and stubdom-dm going independent
from hardcoded pathes. It is no possible to install into /usr/local or any
other non-default directory and use it out-of-the box.
This allows us to have different Xen versions in different directories,
simplifies packaging for distributions.
It also finds 'hvmloader' and 'qemu-dm'/'stubdom-dm' w/o specifying
an absolut path.
This allows us to migrate guests between Dom0's where even standard
install directories are different (i.e. migrate between Solaris Dom0, NetBSD
Dom0 and Linux Dom0).
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
P.S.: Above is only true for PV-guests only until Ian applies my
build system patches for ioemu. I'll resend the ioemu next week
since there's some extra stuff, that isn't in the earlier patches.
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_path.diff --]
[-- Type: text/x-diff, Size: 31077 bytes --]
diff -r fe84a14aacd1 Config.mk
--- a/Config.mk Thu May 28 11:07:19 2009 +0100
+++ b/Config.mk Thu May 28 18:15:43 2009 +0200
@@ -87,6 +87,28 @@ define absolutify_xen_root
export XEN_ROOT
endef
+define buildmakevars2shellvars
+ PREFIX="$(PREFIX)"; \
+ XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
+ export PREFIX; \
+ export XEN_SCRIPT_DIR
+endef
+
+buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
+define buildmakevars2file-closure
+ .PHONY: genpath
+ genpath:
+ rm -f $(1); \
+ echo "SBINDIR=\"$(SBINDIR)\"" >> $(1); \
+ echo "BINDIR=\"$(BINDIR)\"" >> $(1); \
+ echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1); \
+ echo "LIBDIR=\"$(LIBDIR)\"" >> $(1); \
+ echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1); \
+ echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1); \
+ echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1); \
+ echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1)
+endef
+
ifeq ($(debug),y)
CFLAGS += -g
endif
diff -r fe84a14aacd1 config/StdGNU.mk
--- a/config/StdGNU.mk Thu May 28 11:07:19 2009 +0100
+++ b/config/StdGNU.mk Thu May 28 18:15:43 2009 +0200
@@ -36,6 +36,7 @@ MANDIR = $(SHAREDIR)/man
MAN1DIR = $(MANDIR)/man1
MAN8DIR = $(MANDIR)/man8
SBINDIR = $(PREFIX)/sbin
+XENFIRMWAREDIR = $(LIBDIR_x86_32)/xen/boot
PRIVATE_PREFIX = $(LIBDIR)/xen
PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
diff -r fe84a14aacd1 config/SunOS.mk
--- a/config/SunOS.mk Thu May 28 11:07:19 2009 +0100
+++ b/config/SunOS.mk Thu May 28 18:15:43 2009 +0200
@@ -30,6 +30,7 @@ MANDIR = $(PREFIX)/share/man
MAN1DIR = $(MANDIR)/man1
MAN8DIR = $(MANDIR)/man8
SBINDIR = $(PREFIX)/sbin
+XENFIRMWAREDIR = $(LIBDIR)/xen/boot
PRIVATE_PREFIX = $(LIBDIR)/xen
PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
diff -r fe84a14aacd1 stubdom/Makefile
--- a/stubdom/Makefile Thu May 28 11:07:19 2009 +0100
+++ b/stubdom/Makefile Thu May 28 18:15:43 2009 +0200
@@ -77,8 +77,12 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PR
TARGETS=ioemu c caml grub
+STUBDOMPATH="stubdompath.sh"
+genpath-target = $(call buildmakevars2file,$(STUBDOMPATH))
+$(eval $(genpath-target))
+
.PHONY: all
-all: build
+all: genpath build
ifeq ($(STUBDOM_SUPPORTED),1)
build: ioemu-stubdom c-stubdom pv-grub
else
@@ -270,8 +274,7 @@ libxc-$(XEN_TARGET_ARCH)/libxenctrl.a li
ioemu: cross-zlib cross-libpci libxc
[ -f ioemu/config-host.mak ] || \
( $(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- export PREFIX; \
+ $(buildmakevars2shellvars); \
cd ioemu ; \
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
@@ -374,6 +377,7 @@ clean:
$(MAKE) -C caml clean
$(MAKE) -C c clean
rm -fr grub-$(XEN_TARGET_ARCH)
+ rm -f $(STUBDOMPATH)
[ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
-[ ! -d ioemu ] || $(MAKE) -C ioemu clean
diff -r fe84a14aacd1 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm Thu May 28 11:07:19 2009 +0100
+++ b/stubdom/stubdom-dm Thu May 28 18:15:43 2009 +0200
@@ -5,6 +5,9 @@
# dm script around stubdomains.
#
+. ./stubdompath.sh
+stubdom_configdir="${XEN_CONFIG_DIR}/stubdoms"
+
# To fit xterms nicely
height=339
@@ -72,7 +75,7 @@ term() {
(
[ -n "$vncpid" ] && kill -9 $vncpid
xm destroy $domname-dm
- rm /etc/xen/stubdoms/$domname-dm
+ rm ${stubdom_configdir}/$domname-dm
) &
# We need to exit immediately so as to let xend do the commands above
exit 0
@@ -89,9 +92,9 @@ do
done
# Generate stubdom config file
-mkdir -p /etc/xen/stubdoms &>/dev/null
-echo "#This file is autogenerated, edit $domname instead!" > /etc/xen/stubdoms/$domname-dm
-echo "kernel = '/usr/lib/xen/boot/ioemu-stubdom.gz'" >> /etc/xen/stubdoms/$domname-dm
+mkdir -p ${stubdom_configdir} &>/dev/null
+echo "#This file is autogenerated, edit $domname instead!" > ${stubdom_configdir}/$domname-dm
+echo "kernel = '${XENFIRMWAREDIR}/ioemu-stubdom.gz'" >> ${stubdom_configdir}/$domname-dm
vfb="sdl=$sdl, opengl=$opengl"
test "$DISPLAY" && vfb="$vfb, display=$DISPLAY"
@@ -100,9 +103,9 @@ test $vnc != 0 && vfb="$vfb, vnc=$vnc, v
vncpasswd=`xenstore-read /local/domain/0/backend/vfb/$domid/0/vncpasswd 2>/dev/null`
test "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
test "$keymap" && vfb="$vfb, keymap=$keymap"
-echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
+echo "vfb = ['$vfb']" >> ${stubdom_configdir}/$domname-dm
-echo -n "disk = [ " >> /etc/xen/stubdoms/$domname-dm
+echo -n "disk = [ " >> ${stubdom_configdir}/$domname-dm
j=0
for i in `xenstore-ls /local/domain/$domid/device/vbd | grep 'backend =' | awk '{print $3}'`
do
@@ -116,13 +119,13 @@ do
vbd_devtype=`xenstore-read $vbd_front/device-type`
if [ $j -ne 0 ]
then
- echo -n "," >> /etc/xen/stubdoms/$domname-dm
+ echo -n "," >> ${stubdom_configdir}/$domname-dm
fi
- echo -n "'$vbd_type:$vbd_disk,$vbd_dev:$vbd_devtype,$vbd_mode'" >> /etc/xen/stubdoms/$domname-dm
+ echo -n "'$vbd_type:$vbd_disk,$vbd_dev:$vbd_devtype,$vbd_mode'" >> ${stubdom_configdir}/$domname-dm
j=$(( $j + 1 ))
done
-echo " ] " >> /etc/xen/stubdoms/$domname-dm
-echo -n "vif = [ " >> /etc/xen/stubdoms/$domname-dm
+echo " ] " >> ${stubdom_configdir}/$domname-dm
+echo -n "vif = [ " >> ${stubdom_configdir}/$domname-dm
j=0
for i in `xenstore-ls /local/domain/$domid/device/vif | grep 'backend =' | awk '{print $3}'`
do
@@ -131,13 +134,13 @@ do
vif_mac=`xenstore-read $i/mac`
if [ $j -ne 0 ]
then
- echo -n "," >> /etc/xen/stubdoms/$domname-dm
+ echo -n "," >> ${stubdom_configdir}/$domname-dm
fi
- echo -n "'mac=$vif_mac'" >> /etc/xen/stubdoms/$domname-dm
+ echo -n "'mac=$vif_mac'" >> ${stubdom_configdir}/$domname-dm
j=$(( $j + 1 ))
done
-echo " ] " >> /etc/xen/stubdoms/$domname-dm
-creation="xm create -c /etc/xen/stubdoms/$domname-dm target=$domid memory=32 extra=\"$extra\""
+echo " ] " >> ${stubdom_configdir}/$domname-dm
+creation="xm create -c ${stubdom_configdir}/$domname-dm target=$domid memory=32 extra=\"$extra\""
(while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
#xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
diff -r fe84a14aacd1 tools/Makefile
--- a/tools/Makefile Thu May 28 11:07:19 2009 +0100
+++ b/tools/Makefile Thu May 28 18:15:43 2009 +0200
@@ -94,10 +98,7 @@ ioemu-dir-find:
fi
set -e; \
$(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- XEN_SCRIPT_DIR=$(XEN_SCRIPT_DIR); \
- export PREFIX; \
- export XEN_SCRIPT_DIR; \
+ $(buildmakevars2shellvars); \
cd ioemu-dir; \
./xen-setup $(IOEMU_CONFIGURE_CROSS)
@@ -106,6 +107,7 @@ subdir-all-ioemu-dir subdir-install-ioem
subdir-clean-ioemu-dir:
set -e; if test -d ioemu-dir/.; then \
$(absolutify_xen_root); \
+ $(buildmakevars2shellvars); \
$(MAKE) -C ioemu-dir clean; \
fi
diff -r fe84a14aacd1 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xend-config.sxp Thu May 28 18:15:43 2009 +0200
@@ -1,5 +1,7 @@
# -*- sh -*-
+from xen.util import auxbin
+
#
# Xend configuration file.
#
@@ -51,7 +53,7 @@
# Optionally, the TCP Xen-API server can use SSL by specifying the private
# key and certificate location:
#
-# (9367 pam '' /etc/xen/xen-api.key /etc/xen/xen-api.crt)
+# (9367 pam '' auxbin.xen_configdir() + /xen-api.key auxbin.xen_configdir() + /xen-api.crt)
#
# Default:
# (xen-api-server ((unix)))
@@ -77,8 +79,8 @@
# SSL key and certificate to use for the legacy TCP XMLRPC interface.
# Setting these will mean that this port serves only SSL connections as
# opposed to plaintext ones.
-#(xend-tcp-xmlrpc-server-ssl-key-file /etc/xen/xmlrpc.key)
-#(xend-tcp-xmlrpc-server-ssl-cert-file /etc/xen/xmlrpc.crt)
+#(xend-tcp-xmlrpc-server-ssl-key-file auxbin.xen_configdir() + /xmlrpc.key)
+#(xend-tcp-xmlrpc-server-ssl-cert-file auxbin.xen_configdir() + /xmlrpc.crt)
# Port xend should use for the HTTP interface, if xend-http-server is set.
@@ -94,8 +96,8 @@
# SSL key and certificate to use for the ssl relocation interface, if
# xend-relocation-ssl-server is set.
-#(xend-relocation-server-ssl-key-file /etc/xen/xmlrpc.key)
-#(xend-relocation-server-ssl-cert-file /etc/xen/xmlrpc.crt)
+#(xend-relocation-server-ssl-key-file auxbin.xen_configdir() + /xmlrpc.key)
+#(xend-relocation-server-ssl-cert-file auxbin.xen_configdir() + /xmlrpc.crt)
# Whether to use ssl as default when relocating.
#(xend-relocation-ssl no)
@@ -219,7 +221,7 @@
# TightVNC/RealVNC/UltraVNC clients do not.
#
# To enable this create x509 certificates / keys in the
-# directory /etc/xen/vnc
+# directory auxbin.xen_configdir() + /vnc
#
# ca-cert.pem - The CA certificate
# server-cert.pem - The Server certificate signed by the CA
@@ -230,7 +232,7 @@
# The certificate dir can be pointed elsewhere..
#
-# (vnc-x509-cert-dir /etc/xen/vnc)
+# (vnc-x509-cert-dir auxbin.xen_configdir() + /vnc)
# The server can be told to request & validate an x509
# certificate from the client. Only clients with a cert
diff -r fe84a14aacd1 tools/examples/xeninfo.pl
--- a/tools/examples/xeninfo.pl Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xeninfo.pl Thu May 28 18:15:43 2009 +0200
@@ -210,7 +210,7 @@ sub get_vm_type
# which is something like:
# 'PV_kernel': '/boot/vmlinuz-2.6.18-xen',
# or
- # 'PV_kernel': '/usr/lib/xen/boot/hvmloader',
+ # 'PV_kernel': 'hvmloader',
if ("$vm_pv_kernel_results->{'Value'}" =~ m/hvm/i)
{
$host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "HVM";
diff -r fe84a14aacd1 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xmexample.hvm Thu May 28 18:15:43 2009 +0200
@@ -6,16 +6,9 @@
# you can set the parameters for the domain on the xm command line.
#============================================================================
-import os, re
-
-arch_libdir = 'lib'
-arch = os.uname()[4]
-if os.uname()[0] == 'Linux' and re.search('64', arch):
- arch_libdir = 'lib64'
-
#----------------------------------------------------------------------------
# Kernel image file.
-kernel = "/usr/lib/xen/boot/hvmloader"
+kernel = "hvmloader"
# The domain build function. HVM domain uses 'hvm'.
builder='hvm'
@@ -128,7 +121,7 @@ disk = [ 'file:/var/images/min-el3-i386.
#============================================================================
# Device Model to be used
-device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
+device_model = 'qemu-dm'
#-----------------------------------------------------------------------------
# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
@@ -154,7 +147,8 @@ vnc=1
#----------------------------------------------------------------------------
# address that should be listened on for the VNC server if vnc is set.
-# default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
+# default is to use 'vnc-listen' setting from
+# auxbin.xen_configdir() + /xend-config.sxp
#vnclisten="127.0.0.1"
#----------------------------------------------------------------------------
diff -r fe84a14aacd1 tools/examples/xmexample.hvm-stubdom
--- a/tools/examples/xmexample.hvm-stubdom Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xmexample.hvm-stubdom Thu May 28 18:15:43 2009 +0200
@@ -11,7 +11,7 @@
#----------------------------------------------------------------------------
# Kernel image file.
-kernel = "/usr/lib/xen/boot/hvmloader"
+kernel = "hvmloader"
# The domain build function. HVM domain uses 'hvm'.
builder='hvm'
@@ -118,7 +118,7 @@ disk = [ 'file:/var/images/min-el3-i386.
#
# STUBDOM: this is a script that creates the stub domain running the device
# model
-device_model = '/usr/lib/xen/bin/stubdom-dm'
+device_model = 'stubdom-dm'
#-----------------------------------------------------------------------------
# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
@@ -146,7 +146,8 @@ vnc=1
#----------------------------------------------------------------------------
# address that should be listened on for the VNC server if vnc is set.
-# default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
+# default is to use 'vnc-listen' setting from
+# auxbin.xen_configdir() + /xend-config.sxp
#vnclisten="127.0.0.1"
#----------------------------------------------------------------------------
diff -r fe84a14aacd1 tools/examples/xmexample.pv-grub
--- a/tools/examples/xmexample.pv-grub Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xmexample.pv-grub Thu May 28 18:15:43 2009 +0200
@@ -8,7 +8,7 @@
#----------------------------------------------------------------------------
# PV GRUB image file.
-kernel = "/usr/lib/xen/boot/pv-grub.gz"
+kernel = "pv-grub.gz"
# Optional provided menu.lst.
#ramdisk = "/boot/guests/menu.lst"
diff -r fe84a14aacd1 tools/examples/xmexample.vti
--- a/tools/examples/xmexample.vti Thu May 28 11:07:19 2009 +0100
+++ b/tools/examples/xmexample.vti Thu May 28 18:15:43 2009 +0200
@@ -12,7 +12,7 @@ arch = os.uname()[4]
#----------------------------------------------------------------------------
# Kernel image file.
-kernel = "/usr/lib/xen/boot/guest_firmware.bin"
+kernel = "guest_firmware.bin"
# The domain build function. VTI domain uses 'hvm'.
builder='hvm'
diff -r fe84a14aacd1 tools/firmware/Makefile
--- a/tools/firmware/Makefile Thu May 28 11:07:19 2009 +0100
+++ b/tools/firmware/Makefile Thu May 28 18:15:43 2009 +0200
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
# hvmloader is a 32-bit protected mode binary.
TARGET := hvmloader/hvmloader
-INST_DIR := $(DESTDIR)$(LIBDIR_x86_32)/xen/boot
+INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
SUBDIRS :=
SUBDIRS += rombios
diff -r fe84a14aacd1 tools/hotplug/Linux/block
--- a/tools/hotplug/Linux/block Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/block Thu May 28 18:15:43 2009 +0200
@@ -377,5 +377,5 @@ mount it read-write in a guest domain."
esac
# If we've reached here, $t is neither phy nor file, so fire a helper script.
-[ -x /etc/xen/scripts/block-"$t" ] && \
- /etc/xen/scripts/block-"$t" "$command" $node
+[ -x ${XEN_SCRIPT_DIR}/block-"$t" ] && \
+ ${XEN_SCRIPT_DIR}/block-"$t" "$command" $node
diff -r fe84a14aacd1 tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/network-bridge Thu May 28 18:15:43 2009 +0200
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# This script creates a bridge (default ${netdev}), adds a device
diff -r fe84a14aacd1 tools/hotplug/Linux/network-nat
--- a/tools/hotplug/Linux/network-nat Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/network-nat Thu May 28 18:15:43 2009 +0200
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script when using NAT.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# Usage:
@@ -18,6 +18,7 @@
#============================================================================
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/xen-script-common.sh"
. "$dir/xen-network-common.sh"
diff -r fe84a14aacd1 tools/hotplug/Linux/network-route
--- a/tools/hotplug/Linux/network-route Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/network-route Thu May 28 18:15:43 2009 +0200
@@ -2,7 +2,7 @@
#============================================================================
# Default Xen network start/stop script.
# Xend calls a network script when it starts.
-# The script name to use is defined in /etc/xen/xend-config.sxp
+# The script name to use is defined in ${XEN_CONFIG_DIR}/xend-config.sxp
# in the network-script field.
#
# Usage:
@@ -17,6 +17,7 @@
#============================================================================
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/xen-script-common.sh"
evalVariables "$@"
diff -r fe84a14aacd1 tools/hotplug/Linux/vif-bridge
--- a/tools/hotplug/Linux/vif-bridge Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/vif-bridge Thu May 28 18:15:43 2009 +0200
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-bridge
+# ${XEN_SCRIPT_DIR}/vif-bridge
#
# Script for configuring a vif in bridged mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then this script is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then this script is the default.
#
# Usage:
# vif-bridge (add|remove|online|offline)
diff -r fe84a14aacd1 tools/hotplug/Linux/vif-nat
--- a/tools/hotplug/Linux/vif-nat Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/vif-nat Thu May 28 18:15:43 2009 +0200
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-nat
+# ${XEN_SCRIPT_DIR}/vif-nat
#
# Script for configuring a vif in routed-nat mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then vif-bridge is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then vif-bridge is the default.
#
# Usage:
# vif-nat (add|remove|online|offline)
diff -r fe84a14aacd1 tools/hotplug/Linux/vif-route
--- a/tools/hotplug/Linux/vif-route Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/vif-route Thu May 28 18:15:43 2009 +0200
@@ -1,12 +1,12 @@
#!/bin/bash
#============================================================================
-# /etc/xen/vif-route
+# ${XEN_SCRIPT_DIR}/vif-route
#
# Script for configuring a vif in routed mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
-# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
-# places, then vif-bridge is the default.
+# in ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then vif-bridge is the default.
#
# Usage:
# vif-route (add|remove|online|offline)
diff -r fe84a14aacd1 tools/hotplug/Linux/xen-hotplug-cleanup
--- a/tools/hotplug/Linux/xen-hotplug-cleanup Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-cleanup Thu May 28 18:15:43 2009 +0200
@@ -3,7 +3,7 @@
dir=$(dirname "$0")
. "$dir/xen-hotplug-common.sh"
-# Claim the lock protecting /etc/xen/scripts/block. This stops a race whereby
+# Claim the lock protecting ${XEN_SCRIPT_DIR}/block. This stops a race whereby
# paths in the store would disappear underneath that script as it attempted to
# read from the store checking for device sharing.
# Any other scripts that do similar things will have to have their lock
diff -r fe84a14aacd1 tools/hotplug/Linux/xen-hotplug-common.sh
--- a/tools/hotplug/Linux/xen-hotplug-common.sh Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-common.sh Thu May 28 18:15:43 2009 +0200
@@ -17,13 +17,14 @@
dir=$(dirname "$0")
+. "$dir/hotplugpath.sh"
. "$dir/logging.sh"
. "$dir/xen-script-common.sh"
. "$dir/locking.sh"
exec 2>>/var/log/xen/xen-hotplug.log
-export PATH="/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
+export PATH="${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
export LANG="POSIX"
unset $(set | grep ^LC_ | cut -d= -f1)
diff -r fe84a14aacd1 tools/hotplug/NetBSD/block-nbsd
--- a/tools/hotplug/NetBSD/block-nbsd Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/NetBSD/block-nbsd Thu May 28 18:15:43 2009 +0200
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: block xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
error() {
diff -r fe84a14aacd1 tools/hotplug/NetBSD/vif-bridge-nbsd
--- a/tools/hotplug/NetBSD/vif-bridge-nbsd Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/NetBSD/vif-bridge-nbsd Thu May 28 18:15:43 2009 +0200
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: vif-bridge xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
xpath=$1
diff -r fe84a14aacd1 tools/hotplug/NetBSD/vif-ip-nbsd
--- a/tools/hotplug/NetBSD/vif-ip-nbsd Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/NetBSD/vif-ip-nbsd Thu May 28 18:15:43 2009 +0200
@@ -4,7 +4,10 @@
# Called by xenbackendd
# Usage: vif-ip xsdir_backend_path state
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DIR=$(dirname "$0")
+. "${DIR}/hotplugpath.sh"
+
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
xpath=$1
diff -r fe84a14aacd1 tools/hotplug/common/Makefile
--- a/tools/hotplug/common/Makefile Thu May 28 11:07:19 2009 +0100
+++ b/tools/hotplug/common/Makefile Thu May 28 18:15:43 2009 +0200
@@ -1,17 +1,22 @@
-XEN_ROOT = ../../../
+XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/Rules.mk
+HOTPLUGPATH="hotplugpath.sh"
+
# OS-independent hotplug scripts go in this directory
-# Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+# Xen scripts to go there.
+XEN_SCRIPTS = $(HOTPLUGPATH)
XEN_SCRIPT_DATA =
+genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
+$(eval $(genpath-target))
+
.PHONY: all
-all:
+all: build
.PHONY: build
-build:
+build: genpath
.PHONY: install
install: all install-scripts
@@ -31,3 +36,4 @@ install-scripts:
.PHONY: clean
clean:
+ rm -f $(HOTPLUGPATH)
diff -r fe84a14aacd1 tools/python/Makefile
--- a/tools/python/Makefile Thu May 28 11:07:19 2009 +0100
+++ b/tools/python/Makefile Thu May 28 18:15:43 2009 +0200
@@ -13,19 +13,12 @@ POTFILE := $(PODIR)/xen-xm.pot
I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
NLSDIR = $(SHAREDIR)/locale
-xenpath = "xen/util/path.py"
-
-.PHONY: build buildpy genpath
-genpath:
- rm -f ${xenpath}
- echo "SBINDIR=\"$(SBINDIR)\"" >> ${xenpath}
- echo "BINDIR=\"$(BINDIR)\"" >> ${xenpath}
- echo "LIBEXEC=\"$(LIBEXEC)\"" >> ${xenpath}
- echo "LIBDIR=\"$(LIBDIR)\"" >> ${xenpath}
- echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> ${xenpath}
- echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> ${xenpath}
- echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> ${xenpath}
+XENPATH = "xen/util/path.py"
+genpath-target = $(call buildmakevars2file,$(XENPATH))
+$(eval $(genpath-target))
+
+.PHONY: build buildpy
buildpy: genpath
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
@@ -86,10 +79,11 @@ install-messages: all
.PHONY: test
test:
- export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); python test.py -b -u
+ export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); $(PYTHON) test.py -b -u
.PHONY: clean
clean:
+ rm -f $(XENPATH)
rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/auxbin.pyc
rm -f $(DEPS)
diff -r fe84a14aacd1 tools/python/xen/util/auxbin.py
--- a/tools/python/xen/util/auxbin.py Thu May 28 11:07:19 2009 +0100
+++ b/tools/python/xen/util/auxbin.py Thu May 28 18:15:43 2009 +0200
@@ -20,7 +20,7 @@ import os
import os.path
import sys
from xen.util.path import SBINDIR,BINDIR,LIBEXEC,LIBDIR,PRIVATE_BINDIR
-from xen.util.path import XEN_CONFIG_DIR, XEN_SCRIPT_DIR
+from xen.util.path import XENFIRMWAREDIR, XEN_CONFIG_DIR, XEN_SCRIPT_DIR
def execute(exe, args = None):
exepath = pathTo(exe)
@@ -33,7 +33,7 @@ def execute(exe, args = None):
print exepath, ": ", exn
sys.exit(1)
-SEARCHDIRS = [ BINDIR, SBINDIR, LIBEXEC, PRIVATE_BINDIR ]
+SEARCHDIRS = [ BINDIR, SBINDIR, LIBEXEC, PRIVATE_BINDIR, XENFIRMWAREDIR ]
def pathTo(exebin):
for dir in SEARCHDIRS:
exe = os.path.join(dir, exebin)
diff -r fe84a14aacd1 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Thu May 28 11:07:19 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py Thu May 28 18:15:43 2009 +0200
@@ -16,6 +16,7 @@
#============================================================================
import logging
+import os
import re
import time
import types
@@ -39,7 +40,7 @@ from xen.xend.server.netif import random
from xen.util.blkif import blkdev_name_to_number, blkdev_uname_to_file
from xen.util.pci import assigned_or_requested_vslot
from xen.util import xsconstants
-import xen.util.auxbin
+from xen.util import auxbin
log = logging.getLogger("xend.XendConfig")
log.setLevel(logging.WARN)
@@ -460,7 +461,11 @@ class XendConfig(dict):
if self.is_hvm() or self.has_rfb():
if 'device_model' not in self['platform']:
- self['platform']['device_model'] = xen.util.auxbin.pathTo("qemu-dm")
+ self['platform']['device_model'] = auxbin.pathTo("qemu-dm")
+ # device_model may be set to 'qemu-dm' or 'stubdom-dm' w/o a path
+ if not os.path.exists(self['platform']['device_model']):
+ self['platform']['device_model'] = \
+ auxbin.pathTo(self['platform']['device_model'])
if self.is_hvm():
if 'timer_mode' not in self['platform']:
@@ -478,11 +483,21 @@ class XendConfig(dict):
if 'loader' not in self['platform']:
# Old configs may have hvmloader set as PV_kernel param
if self.has_key('PV_kernel') and self['PV_kernel'] != '':
- self['platform']['loader'] = self['PV_kernel']
- self['PV_kernel'] = ''
+ # XXX basename works around a bug somewhere in the guest
+ # config file parser which prepends cwd to the kernel
+ # w/o checking if the result is valid if no absolute
+ # path is specified
+ if os.path.basename(self['PV_kernel']) == 'hvmloader':
+ self['PV_kernel'] = auxbin.pathTo('hvmloader')
+ self['platform']['loader'] = self['PV_kernel']
+ else:
+ self['platform']['loader'] = self['PV_kernel']
+ self['PV_kernel'] = ''
else:
- self['platform']['loader'] = "/usr/lib/xen/boot/hvmloader"
+ self['platform']['loader'] = auxbin.pathTo("hvmloader")
log.debug("Loader is %s" % str(self['platform']['loader']))
+ if not os.path.exists(self['platform']['loader']):
+ raise VmError("kernel '%s' not found" % str(self['platform']['loader']))
# Compatibility hack, can go away soon.
if 'soundhw' not in self['platform'] and \
@@ -1608,7 +1623,7 @@ class XendConfig(dict):
# is invoked for pvfb services
if 'device_model' not in target['platform']:
target['platform']['device_model'] = \
- xen.util.auxbin.pathTo("qemu-dm")
+ auxbin.pathTo("qemu-dm")
# Finally, if we are a pvfb, we need to make a vkbd
# as well that is not really exposed to Xen API
@@ -1734,7 +1749,7 @@ class XendConfig(dict):
try:
pci_states.append(pci_state[1])
except IndexError:
- raise XendError("Error reading state while parsing pci sxp")
+ raise VmError("Error reading state while parsing pci sxp")
dev_config['states'] = pci_states
return dev_config
diff -r fe84a14aacd1 tools/python/xen/xm/tests/test_create.py
--- a/tools/python/xen/xm/tests/test_create.py Thu May 28 11:07:19 2009 +0100
+++ b/tools/python/xen/xm/tests/test_create.py Thu May 28 18:15:43 2009 +0200
@@ -153,14 +153,14 @@ cpu_weight = 0.75
try:
os.write(fd,
'''
-kernel = "/usr/lib/xen/boot/hvmloader"
+kernel = "hvmloader"
builder='hvm'
memory = 128
name = "ExampleHVMDomain"
vcpus=1
vif = [ 'type=ioemu, bridge=xenbr0' ]
disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ]
-device_model = '/usr/lib/xen/bin/qemu-dm'
+device_model = 'qemu-dm'
sdl=0
vnc=1
vncviewer=1
@@ -170,7 +170,7 @@ ne2000=0
os.close(fd)
self.t('-f %s display=fakedisplay' % fname,
- { 'kernel' : '/usr/lib/xen/boot/hvmloader',
+ { 'kernel' : 'hvmloader',
'builder' : 'hvm',
'memory' : 128,
'name' : 'ExampleHVMDomain',
@@ -179,7 +179,7 @@ ne2000=0
'vif' : ['type=ioemu, bridge=xenbr0'],
'disk' : [['file:/var/images/min-el3-i386.img',
'ioemu:hda', 'w', None]],
- 'device_model': '/usr/lib/xen/bin/qemu-dm',
+ 'device_model': 'qemu-dm',
'extra' : ('VNC_VIEWER=%s:%d ' %
(xen.xm.create.get_host_addr(),
diff -r fe84a14aacd1 tools/xm-test/lib/XmTestLib/arch.py
--- a/tools/xm-test/lib/XmTestLib/arch.py Thu May 28 11:07:19 2009 +0100
+++ b/tools/xm-test/lib/XmTestLib/arch.py Thu May 28 18:15:43 2009 +0200
@@ -77,7 +77,7 @@ ia_HVMDefaults = {"memory" :
"acpi" : 0,
"disk" : ["file:%s/disk.img,ioemu:%s,w!" %
(getRdPath(), BLOCK_ROOT_DEV)],
- "kernel" : "/usr/lib/xen/boot/hvmloader",
+ "kernel" : "hvmloader",
"builder" : "hvm",
"sdl" : 0,
"vnc" : 0,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2009-05-28 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 16:42 Christoph Egger [this message]
2009-05-28 18:35 ` [PATCH] tools/stubdom: get rid of hardcoded pathes Ian Jackson
2009-05-28 19:49 ` Xen 3.4 / cpufreq=dom0-kernel / ondemand govenor doesn't step Carsten Schiers
2009-06-01 3:52 ` Liu, Jinsong
2009-06-01 7:47 ` Keir Fraser
2009-06-02 9:30 ` [PATCH] tools/stubdom: get rid of hardcoded pathes Christoph Egger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905281842.48191.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.