tools/stubdom: get rid of hardcoded pathes
PATCH 1/1 tools/stubdom: get rid of hardcoded pathes
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).
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.
Signature · 6 lines
---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
Config.mk +22 -0
@@ -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
config/StdGNU.mk +1 -0
@@ -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
config/SunOS.mk +1 -0
@@ -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
stubdom/Makefile +7 -3
@@ -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
stubdom/stubdom-dm +17 -14
@@ -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" &
tools/Makefile +2 -4
@@ -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
tools/examples/xend-config.sxp +9 -7
@@ -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
tools/examples/xeninfo.pl +1 -1
@@ -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";
tools/examples/xmexample.hvm +4 -10
@@ -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" #----------------------------------------------------------------------------
tools/examples/xmexample.hvm-stubdom +4 -3
@@ -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" #----------------------------------------------------------------------------
tools/examples/xmexample.pv-grub +1 -1
@@ -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"
tools/examples/xmexample.vti +1 -1
@@ -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'
tools/firmware/Makefile +1 -1
@@ -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
tools/hotplug/Linux/block +2 -2
@@ -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
tools/hotplug/Linux/network-bridge +1 -1
@@ -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
tools/hotplug/Linux/network-nat +2 -1
@@ -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"
tools/hotplug/Linux/network-route +2 -1
@@ -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 "$@"
tools/hotplug/Linux/vif-bridge +3 -3
@@ -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)
tools/hotplug/Linux/vif-nat +3 -3
@@ -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)
tools/hotplug/Linux/vif-route +3 -3
@@ -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)
tools/hotplug/Linux/xen-hotplug-cleanup +1 -1
@@ -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
tools/hotplug/Linux/xen-hotplug-common.sh +2 -1
@@ -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)
tools/hotplug/NetBSD/block-nbsd +4 -1
@@ -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() {
tools/hotplug/NetBSD/vif-bridge-nbsd +4 -1
@@ -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
tools/hotplug/NetBSD/vif-ip-nbsd +4 -1
@@ -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
tools/hotplug/common/Makefile +11 -5
@@ -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)
tools/python/Makefile +7 -13
@@ -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)
tools/python/xen/util/auxbin.py +2 -2
@@ -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)
tools/python/xen/xend/XendConfig.py +22 -7
@@ -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
tools/python/xen/xm/tests/test_create.py +4 -4
@@ -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(),
tools/xm-test/lib/XmTestLib/arch.py +1 -1
@@ -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,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Christoph Egger writes ("[Xen-devel] [PATCH] tools/stubdom: get rid of hardcoded pathes"):
Quoted 3 lines
Attached patch makes xen-tools and stubdom-dm going independent
Quoted 1 line
from hardcoded pathes. It is no possible to install into
/usr/localor anyother non-default directory and use it out-of-the box.
I think this is a laudable goal but I'm not really convinced by the way you've done it. Amongst my comments:
Have you considered an arrangement which substitutes the correct paths into the relevant scripts at build time, rather than run time ? Run-time searching can have problems as it means that you can sometimes find the wrong copy of something if there are multiple different installs.
Config.mk define absolutify_xen_root · line 103
Quoted 7 lines
Config.mk +7
-0+buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1))) +define buildmakevars2file-closure + .PHONY: genpath + genpath: + rm -f $(1); \ + echo "SBINDIR=\"$(SBINDIR)\"" >> $(1); \ + echo "BINDIR=\"$(BINDIR)\"" >> $(1); \
This is really very ugly. Surely it would be better to have the xen-setup[-stumbom] scripts fish things out of the build system, rather than plumbing everything through the environment like this.
The only thing which _needs_ to be plumbed through from the commandline or en environment at install-time is DESTDIR or its equivalent. We can insist on the rest being set in Config.mk or its ilk.
The paths that stubdom looks at should not vary according to the host platform. They should be fixed, as they need to be virtualised anyway.
tools/examples/xend-config.sxp line 4
Quoted 7 lines
tools/examples/xend-config.sxp +2
-0@@ -1,5 +1,7 @@ # -*- sh -*- +from xen.util import auxbin +
*boggle*
I stopped reading the patch at that point I'm afraid.
Ian.
Xen 3.4 / cpufreq=dom0-kernel / ondemand govenor doesn't step
I have just upgraded to Xen 3.4 and its kernel. I use cpufreq=dom0-kernel. I set
the governor to ondemand. In the same setting as Xen 3.3.1 it now doesn't step
upwards, even when I create heavy load. Transistion table demonstrates that:
data://sys/devices/system/cpu/cpu0/cpufreq/stats# cat trans_table
From : To
: 2100000 2000000 1800000 1000000
2100000: 0 0 0 2
2000000: 0 0 0 0
1800000: 0 0 0 0
1000000: 1 0 0 0after an uptime of 30 minutes. The steps shown here came from a manual setting
whilst I set the governor back to userspace. Any idea how to check further?
Does http://xenbits.xensource.com/xen-unstable.hg?rev/674e4d43955f make any
difference in my case? As said, I used the tarballs.
And by the way: what is the actual xen-3.4 testing, I am a bit lost on the website.
BR,
Carsten.
RE: Xen 3.4 / cpufreq=dom0-kernel / ondemand govenor doesn't step
Quoted 24 lines · Carsten Schiers
I have just upgraded to Xen 3.4 and its kernel. I use cpufreq=dom0-kernel. I set
the governor to ondemand. In the same setting as Xen 3.3.1 it now doesn't step
upwards, even when I create heavy load. Transistion table demonstrates that:data://sys/devices/system/cpu/cpu0/cpufreq/stats# cat trans_table From : To : 2100000 2000000 1800000 1000000 2100000: 0 0 0 2 2000000: 0 0 0 0 1800000: 0 0 0 0 1000000: 1 0 0 0after an uptime of 30 minutes. The steps shown here came from a manual setting
whilst I set the governor back to userspace. Any idea how to check further?Does http://xenbits.xensource.com/xen-unstable.hg?rev/674e4d43955f
make any
difference in my case? As said, I used the tarballs.
Quoted 5 lines
And by the way: what is the actual xen-3.4 testing, I am a bit lost on the website.
BR,
Carsten.
Carsten Schiers,
Actually xen cpufreq default option is 'cpufreq=xen', means xen hypervisor will take charge of cpufreq logic, you can try this option. 'cpufreq=dom0-kernel' means dom0 will take charge of cpufreq logic, but this part was not maintained by me.
http://xenbits.xensource.com/xen-unstable.hg?rev/674e4d43955f is not related to 'cpufreq=dom0-kenrel' option.
If you use 'cpufreq=xen', you can set cpufreq para (governor, speed, sampling-rate, threshold, etc.) by grub cmdline at booting time, or by xenpm tools at runtime. currently xenpm tools implement all para same as you can get&set from native linux /sys/devices/system/cpu/cpux/cpufreq interface.
Thanks,
Jinsong
Re: RE: Xen 3.4 / cpufreq=dom0-kernel / ondemand govenor doesn't step
Quoted 5 lines · Jinsong
Actually xen cpufreq default option is 'cpufreq=xen', means xen hypervisor will take charge of cpufreq logic, you can try this option. 'cpufreq=dom0-kernel' means dom0 will take charge of cpufreq logic, but this part was not maintained by me.
Quoted 8 lines
http://xenbits.xensource.com/xen-unstable.hg?rev/674e4d43955f is not related to 'cpufreq=dom0-kenrel' option.
If you use 'cpufreq=xen', you can set cpufreq para (governor, speed, sampling-rate, threshold, etc.) by grub cmdline at booting time, or by xenpm tools at runtime.
currently xenpm tools implement all para same as you can get&set from native linux/sys/devices/system/cpu/cpux/cpufreqinterface.
...and if you want to pursue cpufreq=dom0-kernel further, Mark Langsdorf is the person to contact. You can find his email address in the changelogs and in the list archives, no doubt.
-- Keir
Quoted 1 line · On Thursday 28 May 2009 20:35:17 Ian Jackson wrote:
Christoph Egger writes ("[Xen-devel] [PATCH]
tools/stubdom: get rid of
hardcoded pathes"):
Quoted 5 lines
Quoted 5 lines
Attached patch makes xen-tools and stubdom-dm going independent
Quoted 2 lines
from hardcoded pathes. It is no possible to install into
/usr/localor any
Quoted 8 lines
Quoted 1 line
other non-default directory and use it out-of-the box.
I think this is a laudable goal but I'm not really convinced by the way you've done it. Amongst my comments:
Have you considered an arrangement which substitutes the correct paths into the relevant scripts at build time, rather than run time ?
Yes. The build system is doing this.
Quoted 3 lines
Run-time searching can have problems as it means that you can sometimes find the wrong copy of something if there are multiple different installs.
I talked with the python people on irc.freenode.net what is the python way to substitute certain patterns with pathes defined by the build system. The answer: Python has no pre-processor like C. Therefore, have the build system to write the pathes into a file and use them. That is what I do.
Neither shell scripts have pre-precessors. So I have to do the same for the hotplug scripts.
Quoted 11 lines
Config.mk define absolutify_xen_root · line 103
Quoted 7 lines
Config.mk +7
-0+buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1))) +define buildmakevars2file-closure + .PHONY: genpath + genpath: + rm -f $(1); \ + echo "SBINDIR=\"$(SBINDIR)\"" >> $(1); \ + echo "BINDIR=\"$(BINDIR)\"" >> $(1); \This is really very ugly. Surely it would be better to have the xen-setup[-stumbom] scripts fish things out of the build system, rather than plumbing everything through the environment like this.
To avoid maintaining three copies (tools/python/Makefile, stubdom/Makefile and tools/hotplug/common/Makefile) each with its own tweaks and bugs, I moved the code from tools/python/Makfile into a GNU make macro.
If you know a better way, tell me.
Quoted 4 lines
The only thing which _needs_ to be plumbed through from the commandline or en environment at install-time is DESTDIR or its equivalent. We can insist on the rest being set in Config.mk or its ilk.
No, that's wrong. The way you suggest break the hotplug scripts when you install into a non-default directory.
Quoted 10 lines
The paths that stubdom looks at should not vary according to the host platform. They should be fixed, as they need to be virtualised anyway.
Quoted 5 lines
tools/examples/xend-config.sxp +0
-0@@ -1,5 +1,7 @@ # -*- sh -*-
Quoted 6 lines
tools/examples/xend-config.sxp line 4
Quoted 2 lines
tools/examples/xend-config.sxp +2
-0+from xen.util import auxbin +*boggle*
I stopped reading the patch at that point I'm afraid.
That's necessary to entangle xend from assuming the config files are in /etc. W/o this, you can't really have a working installation in a non-default directory.
Christoph
Signature · 6 lines
---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