ia64/xen-unstable

changeset 7324:903d88857972

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>
author emellor@ewan
date Tue Oct 11 14:55:12 2005 +0100 (2005-10-11)
parents 46bd7564125d
children 293f4417c089
files Makefile tools/console/Makefile tools/misc/xend tools/python/xen/util/Brctl.py tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/server/SrvDaemon.py tools/python/xen/xend/sxp.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py tools/xcutils/Makefile
line diff
     1.1 --- a/Makefile	Tue Oct 11 13:02:59 2005 +0100
     1.2 +++ b/Makefile	Tue Oct 11 14:55:12 2005 +0100
     1.3 @@ -179,7 +179,7 @@ uninstall:
     1.4  	rm -rf $(D)/usr/$(LIBDIR)/libxenctrl* $(D)/usr/$(LIBDIR)/libxenguest*
     1.5  	rm -rf $(D)/usr/$(LIBDIR)/libxenstore*
     1.6  	rm -rf $(D)/usr/$(LIBDIR)/python/xen $(D)/usr/$(LIBDIR)/xen 
     1.7 -	rm -rf $(D)/usr/libexec/xen
     1.8 +	rm -rf $(D)/usr/$(LIBDIR)/xen/bin
     1.9  	rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm
    1.10  	rm -rf $(D)/usr/share/doc/xen
    1.11  	rm -rf $(D)/usr/share/xen
     2.1 --- a/tools/console/Makefile	Tue Oct 11 13:02:59 2005 +0100
     2.2 +++ b/tools/console/Makefile	Tue Oct 11 14:55:12 2005 +0100
     2.3 @@ -3,7 +3,7 @@ XEN_ROOT=../..
     2.4  include $(XEN_ROOT)/tools/Rules.mk
     2.5  
     2.6  DAEMON_INSTALL_DIR = /usr/sbin
     2.7 -CLIENT_INSTALL_DIR = /usr/libexec/xen
     2.8 +CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
     2.9  
    2.10  INSTALL         = install
    2.11  INSTALL_PROG    = $(INSTALL) -m0755
     3.1 --- a/tools/misc/xend	Tue Oct 11 13:02:59 2005 +0100
     3.2 +++ b/tools/misc/xend	Tue Oct 11 14:55:12 2005 +0100
     3.3 @@ -2,9 +2,10 @@
     3.4  #  -*- mode: python; -*-
     3.5  #============================================================================
     3.6  # Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
     3.7 +# Copyright (C) 2005 XenSource Ltd
     3.8  #============================================================================
     3.9  
    3.10 -"""Xen management daemon. Lives in /usr/sbin.
    3.11 +"""Xen management daemon.
    3.12     Provides console server and HTTP management api.
    3.13  
    3.14     Run:
    3.15 @@ -67,14 +68,14 @@ def check_user():
    3.16  
    3.17  def start_xenstored():
    3.18      XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
    3.19 -    cmd = "/usr/sbin/xenstored --pid-file=/var/run/xenstore.pid"
    3.20 +    cmd = "xenstored --pid-file=/var/run/xenstore.pid"
    3.21      if XENSTORED_TRACE:
    3.22          cmd += " -T /var/log/xenstored-trace.log"
    3.23      s,o = commands.getstatusoutput(cmd)
    3.24  
    3.25  def start_consoled():
    3.26      if os.fork() == 0:
    3.27 -        os.execvp('/usr/sbin/xenconsoled', ['/usr/sbin/xenconsoled'])
    3.28 +        os.execvp('xenconsoled', ['xenconsoled'])
    3.29              
    3.30  def main():
    3.31      try:
     4.1 --- a/tools/python/xen/util/Brctl.py	Tue Oct 11 13:02:59 2005 +0100
     4.2 +++ b/tools/python/xen/util/Brctl.py	Tue Oct 11 14:55:12 2005 +0100
     4.3 @@ -5,7 +5,6 @@ import os.path
     4.4  import re
     4.5  import sys
     4.6  
     4.7 -os.defpath = os.defpath + ':/sbin:/usr/sbin:/usr/local/sbin'
     4.8  CMD_IFCONFIG = 'ifconfig'
     4.9  CMD_ROUTE    = 'route'
    4.10  CMD_BRCTL    = 'brctl'
     5.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Tue Oct 11 13:02:59 2005 +0100
     5.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Tue Oct 11 14:55:12 2005 +0100
     5.3 @@ -14,6 +14,8 @@ from struct import pack, unpack, calcsiz
     5.4  
     5.5  from xen.util.xpopen import xPopen3
     5.6  
     5.7 +import xen.util.auxbin
     5.8 +
     5.9  import xen.lowlevel.xc
    5.10  
    5.11  from xen.xend.xenstore.xsutil import IntroduceDomain
    5.12 @@ -21,9 +23,11 @@ from xen.xend.xenstore.xsutil import Int
    5.13  from XendError import XendError
    5.14  from XendLogging import log
    5.15  
    5.16 +
    5.17  SIGNATURE = "LinuxGuestRecord"
    5.18 -PATH_XC_SAVE = "/usr/libexec/xen/xc_save"
    5.19 -PATH_XC_RESTORE = "/usr/libexec/xen/xc_restore"
    5.20 +XC_SAVE = "xc_save"
    5.21 +XC_RESTORE = "xc_restore"
    5.22 +
    5.23  
    5.24  sizeof_int = calcsize("i")
    5.25  sizeof_unsigned_long = calcsize("L")
    5.26 @@ -64,7 +68,7 @@ def save(fd, dominfo, live):
    5.27          # enabled. Passing "0" simply uses the defaults compiled into
    5.28          # libxenguest; see the comments and/or code in xc_linux_save() for
    5.29          # more information.
    5.30 -        cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd),
    5.31 +        cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(xc.handle()), str(fd),
    5.32                 str(dominfo.getDomid()), "0", "0", str(int(live)) ]
    5.33          log.debug("[xc_save]: %s", string.join(cmd))
    5.34  
    5.35 @@ -129,7 +133,7 @@ def restore(xd, fd):
    5.36          store_evtchn = dominfo.store_channel
    5.37          console_evtchn = dominfo.console_channel
    5.38  
    5.39 -        cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd),
    5.40 +        cmd = [xen.util.auxbin.pathTo(XC_RESTORE), str(xc.handle()), str(fd),
    5.41                 str(dominfo.getDomid()), str(nr_pfns),
    5.42                 str(store_evtchn), str(console_evtchn)]
    5.43          log.debug("[xc_restore]: %s", string.join(cmd))
     6.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Tue Oct 11 13:02:59 2005 +0100
     6.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Tue Oct 11 14:55:12 2005 +0100
     6.3 @@ -38,7 +38,7 @@ class Daemon:
     6.4          pythonex = '(?P<python>\S*python\S*)'
     6.5          cmdex = '(?P<cmd>.*)'
     6.6          procre = re.compile('^\s*' + pidex + '\s*' + pythonex + '\s*' + cmdex + '$')
     6.7 -        xendre = re.compile('^/usr/sbin/xend\s*(start|restart)\s*.*$')
     6.8 +        xendre = re.compile('^\S+/xend\s*(start|restart)\s*.*$')
     6.9          procs = os.popen('ps -e -o pid,args 2>/dev/null')
    6.10          for proc in procs:
    6.11              pm = procre.match(proc)
     7.1 --- a/tools/python/xen/xend/sxp.py	Tue Oct 11 13:02:59 2005 +0100
     7.2 +++ b/tools/python/xen/xend/sxp.py	Tue Oct 11 14:55:12 2005 +0100
     7.3 @@ -1,4 +1,4 @@
     7.4 -#!/usr/bin/python
     7.5 +#!/usr/bin/env python
     7.6  #============================================================================
     7.7  # This library is free software; you can redistribute it and/or
     7.8  # modify it under the terms of version 2.1 of the GNU Lesser General Public
     8.1 --- a/tools/python/xen/xm/create.py	Tue Oct 11 13:02:59 2005 +0100
     8.2 +++ b/tools/python/xen/xm/create.py	Tue Oct 11 14:55:12 2005 +0100
     8.3 @@ -14,11 +14,14 @@
     8.4  #============================================================================
     8.5  # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
     8.6  # Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
     8.7 +# Copyright (C) 2005 XenSource Ltd
     8.8  #============================================================================
     8.9  
    8.10  """Domain creation.
    8.11  """
    8.12  import random
    8.13 +import os
    8.14 +import os.path
    8.15  import string
    8.16  import sys
    8.17  import socket
    8.18 @@ -36,6 +39,9 @@ from xen.util import blkif
    8.19  
    8.20  from xen.xm.opts import *
    8.21  
    8.22 +import console
    8.23 +
    8.24 +
    8.25  gopts = Opts(use="""[options] [vars]
    8.26  
    8.27  Create a domain.
    8.28 @@ -879,8 +885,7 @@ def main(argv):
    8.29  
    8.30          dom = make_domain(opts, config)
    8.31          if opts.vals.console_autoconnect:
    8.32 -            cmd = "/usr/libexec/xen/xenconsole %d" % dom
    8.33 -            os.execvp('/usr/libexec/xen/xenconsole', cmd.split())
    8.34 +            console.execConsole(dom)
    8.35          
    8.36  if __name__ == '__main__':
    8.37      main(sys.argv)
     9.1 --- a/tools/python/xen/xm/main.py	Tue Oct 11 13:02:59 2005 +0100
     9.2 +++ b/tools/python/xen/xm/main.py	Tue Oct 11 14:55:12 2005 +0100
     9.3 @@ -38,6 +38,8 @@ from xen.xend import PrettyPrint
     9.4  from xen.xend import sxp
     9.5  from xen.xm.opts import *
     9.6  
     9.7 +import console
     9.8 +
     9.9  
    9.10  shorthelp = """Usage: xm <subcommand> [args]
    9.11      Control, list, and manipulate Xen guest instances
    9.12 @@ -442,12 +444,11 @@ def xm_console(args):
    9.13      from xen.xend.XendClient import server
    9.14      info = server.xend_domain(dom)
    9.15      domid = int(sxp.child_value(info, 'domid', '-1'))
    9.16 -    cmd = "/usr/libexec/xen/xenconsole %d" % domid
    9.17 -    os.execvp('/usr/libexec/xen/xenconsole', cmd.split())
    9.18 -    console = sxp.child(info, "console")
    9.19 +    console.execConsole(domid)
    9.20 +
    9.21  
    9.22  def xm_top(args):
    9.23 -    os.execv('/usr/sbin/xentop', ['/usr/sbin/xentop'])
    9.24 +    os.execvp('xentop', ['xentop'])
    9.25  
    9.26  def xm_dmesg(args):
    9.27      
    10.1 --- a/tools/xcutils/Makefile	Tue Oct 11 13:02:59 2005 +0100
    10.2 +++ b/tools/xcutils/Makefile	Tue Oct 11 14:55:12 2005 +0100
    10.3 @@ -15,7 +15,7 @@ INSTALL_DIR	= $(INSTALL) -d -m0755
    10.4  XEN_ROOT	= ../..
    10.5  include $(XEN_ROOT)/tools/Rules.mk
    10.6  
    10.7 -PROGRAMS_INSTALL_DIR	= /usr/libexec/xen
    10.8 +PROGRAMS_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
    10.9  
   10.10  INCLUDES += -I $(XEN_LIBXC)
   10.11