diff options
author | emellor@ewan <emellor@ewan> | 2005-10-11 14:55:12 +0100 |
---|---|---|
committer | emellor@ewan <emellor@ewan> | 2005-10-11 14:55:12 +0100 |
commit | af1b5637f43be85942027749777c21bee4d84e65 (patch) | |
tree | 272106a1a4c2527d73dc6f8d3d0040125468bf55 | |
parent | 490bab7b96c76d645c143e37a4adad5a3f597bbf (diff) | |
download | xen-af1b5637f43be85942027749777c21bee4d84e65.tar.gz xen-af1b5637f43be85942027749777c21bee4d84e65.tar.bz2 xen-af1b5637f43be85942027749777c21bee4d84e65.zip |
Allow parallel 32- and 64-bit Xen installations. Move xc_save, xc_restore,
and xenconsole out of /usr/libexec/xen and into one of /usr/lib/xen/bin or
/usr/lib64/xen/bin. Remove all the PATH hacking inside Xend, and rely upon
the PATH being set correctly from outside. Added an auxbin module for
handling the hacky stuff.
Replace the few /usr/bin/python bang paths with /usr/bin/env python.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | tools/console/Makefile | 2 | ||||
-rw-r--r-- | tools/misc/xend | 7 | ||||
-rw-r--r-- | tools/python/xen/util/Brctl.py | 1 | ||||
-rw-r--r-- | tools/python/xen/xend/XendCheckpoint.py | 12 | ||||
-rw-r--r-- | tools/python/xen/xend/server/SrvDaemon.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xend/sxp.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xm/create.py | 9 | ||||
-rw-r--r-- | tools/python/xen/xm/main.py | 9 | ||||
-rw-r--r-- | tools/xcutils/Makefile | 2 |
10 files changed, 29 insertions, 19 deletions
@@ -179,7 +179,7 @@ uninstall: rm -rf $(D)/usr/$(LIBDIR)/libxenctrl* $(D)/usr/$(LIBDIR)/libxenguest* rm -rf $(D)/usr/$(LIBDIR)/libxenstore* rm -rf $(D)/usr/$(LIBDIR)/python/xen $(D)/usr/$(LIBDIR)/xen - rm -rf $(D)/usr/libexec/xen + rm -rf $(D)/usr/$(LIBDIR)/xen/bin rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm rm -rf $(D)/usr/share/doc/xen rm -rf $(D)/usr/share/xen diff --git a/tools/console/Makefile b/tools/console/Makefile index 3e1471d99c..a27aa8e458 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -3,7 +3,7 @@ XEN_ROOT=../.. include $(XEN_ROOT)/tools/Rules.mk DAEMON_INSTALL_DIR = /usr/sbin -CLIENT_INSTALL_DIR = /usr/libexec/xen +CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin INSTALL = install INSTALL_PROG = $(INSTALL) -m0755 diff --git a/tools/misc/xend b/tools/misc/xend index e1a6b4f437..f2db3c100b 100644 --- a/tools/misc/xend +++ b/tools/misc/xend @@ -2,9 +2,10 @@ # -*- mode: python; -*- #============================================================================ # Copyright (C) 2004 Mike Wray <mike.wray@hp.com> +# Copyright (C) 2005 XenSource Ltd #============================================================================ -"""Xen management daemon. Lives in /usr/sbin. +"""Xen management daemon. Provides console server and HTTP management api. Run: @@ -67,14 +68,14 @@ def check_user(): def start_xenstored(): XENSTORED_TRACE = os.getenv("XENSTORED_TRACE") - cmd = "/usr/sbin/xenstored --pid-file=/var/run/xenstore.pid" + cmd = "xenstored --pid-file=/var/run/xenstore.pid" if XENSTORED_TRACE: cmd += " -T /var/log/xenstored-trace.log" s,o = commands.getstatusoutput(cmd) def start_consoled(): if os.fork() == 0: - os.execvp('/usr/sbin/xenconsoled', ['/usr/sbin/xenconsoled']) + os.execvp('xenconsoled', ['xenconsoled']) def main(): try: diff --git a/tools/python/xen/util/Brctl.py b/tools/python/xen/util/Brctl.py index 28506057f2..9ae8fdf51d 100644 --- a/tools/python/xen/util/Brctl.py +++ b/tools/python/xen/util/Brctl.py @@ -5,7 +5,6 @@ import os.path import re import sys -os.defpath = os.defpath + ':/sbin:/usr/sbin:/usr/local/sbin' CMD_IFCONFIG = 'ifconfig' CMD_ROUTE = 'route' CMD_BRCTL = 'brctl' diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py index 3d45bdb60a..d8ae85b91e 100644 --- a/tools/python/xen/xend/XendCheckpoint.py +++ b/tools/python/xen/xend/XendCheckpoint.py @@ -14,6 +14,8 @@ from struct import pack, unpack, calcsize from xen.util.xpopen import xPopen3 +import xen.util.auxbin + import xen.lowlevel.xc from xen.xend.xenstore.xsutil import IntroduceDomain @@ -21,9 +23,11 @@ from xen.xend.xenstore.xsutil import IntroduceDomain from XendError import XendError from XendLogging import log + SIGNATURE = "LinuxGuestRecord" -PATH_XC_SAVE = "/usr/libexec/xen/xc_save" -PATH_XC_RESTORE = "/usr/libexec/xen/xc_restore" +XC_SAVE = "xc_save" +XC_RESTORE = "xc_restore" + sizeof_int = calcsize("i") sizeof_unsigned_long = calcsize("L") @@ -64,7 +68,7 @@ def save(fd, dominfo, live): # enabled. Passing "0" simply uses the defaults compiled into # libxenguest; see the comments and/or code in xc_linux_save() for # more information. - cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd), + cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(xc.handle()), str(fd), str(dominfo.getDomid()), "0", "0", str(int(live)) ] log.debug("[xc_save]: %s", string.join(cmd)) @@ -129,7 +133,7 @@ def restore(xd, fd): store_evtchn = dominfo.store_channel console_evtchn = dominfo.console_channel - cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd), + cmd = [xen.util.auxbin.pathTo(XC_RESTORE), str(xc.handle()), str(fd), str(dominfo.getDomid()), str(nr_pfns), str(store_evtchn), str(console_evtchn)] log.debug("[xc_restore]: %s", string.join(cmd)) diff --git a/tools/python/xen/xend/server/SrvDaemon.py b/tools/python/xen/xend/server/SrvDaemon.py index 0248d18ab7..543502ad95 100644 --- a/tools/python/xen/xend/server/SrvDaemon.py +++ b/tools/python/xen/xend/server/SrvDaemon.py @@ -38,7 +38,7 @@ class Daemon: pythonex = '(?P<python>\S*python\S*)' cmdex = '(?P<cmd>.*)' procre = re.compile('^\s*' + pidex + '\s*' + pythonex + '\s*' + cmdex + '$') - xendre = re.compile('^/usr/sbin/xend\s*(start|restart)\s*.*$') + xendre = re.compile('^\S+/xend\s*(start|restart)\s*.*$') procs = os.popen('ps -e -o pid,args 2>/dev/null') for proc in procs: pm = procre.match(proc) diff --git a/tools/python/xen/xend/sxp.py b/tools/python/xen/xend/sxp.py index 47c439c1d5..88a81cdc8a 100644 --- a/tools/python/xen/xend/sxp.py +++ b/tools/python/xen/xend/sxp.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python #============================================================================ # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index a6498c72ad..5da1acc3da 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -14,11 +14,14 @@ #============================================================================ # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com> # Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> +# Copyright (C) 2005 XenSource Ltd #============================================================================ """Domain creation. """ import random +import os +import os.path import string import sys import socket @@ -36,6 +39,9 @@ from xen.util import blkif from xen.xm.opts import * +import console + + gopts = Opts(use="""[options] [vars] Create a domain. @@ -879,8 +885,7 @@ def main(argv): dom = make_domain(opts, config) if opts.vals.console_autoconnect: - cmd = "/usr/libexec/xen/xenconsole %d" % dom - os.execvp('/usr/libexec/xen/xenconsole', cmd.split()) + console.execConsole(dom) if __name__ == '__main__': main(sys.argv) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 615ef4ef60..082bdb6367 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -38,6 +38,8 @@ from xen.xend import PrettyPrint from xen.xend import sxp from xen.xm.opts import * +import console + shorthelp = """Usage: xm <subcommand> [args] Control, list, and manipulate Xen guest instances @@ -442,12 +444,11 @@ def xm_console(args): from xen.xend.XendClient import server info = server.xend_domain(dom) domid = int(sxp.child_value(info, 'domid', '-1')) - cmd = "/usr/libexec/xen/xenconsole %d" % domid - os.execvp('/usr/libexec/xen/xenconsole', cmd.split()) - console = sxp.child(info, "console") + console.execConsole(domid) + def xm_top(args): - os.execv('/usr/sbin/xentop', ['/usr/sbin/xentop']) + os.execvp('xentop', ['xentop']) def xm_dmesg(args): diff --git a/tools/xcutils/Makefile b/tools/xcutils/Makefile index 2a0d13b4ce..b7de270e07 100644 --- a/tools/xcutils/Makefile +++ b/tools/xcutils/Makefile @@ -15,7 +15,7 @@ INSTALL_DIR = $(INSTALL) -d -m0755 XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -PROGRAMS_INSTALL_DIR = /usr/libexec/xen +PROGRAMS_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin INCLUDES += -I $(XEN_LIBXC) |