From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] tools: don't require hardcoded path in guest config file
Date: Fri, 19 Jun 2009 16:33:19 +0200 [thread overview]
Message-ID: <200906191633.19343.Christoph.Egger@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
Hi!
Attached patch allows xen tools to no longer require the hardcoded path's to
hvmloader, qemu-dm and stubdom-dm in the guest config files.
This improves usability since the user no longer needs to know where
hvmloader and qemu-dm have been installed and is a step
in making guest migrations possible where hvmloader, qemu-dm and stubdom-dm
have different install directories.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---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_firmwaredir.diff --]
[-- Type: text/x-diff, Size: 6971 bytes --]
diff -r dc0d1200e3f3 config/StdGNU.mk
--- a/config/StdGNU.mk Thu Jun 18 15:32:48 2009 +0100
+++ b/config/StdGNU.mk Fri Jun 19 16:13:51 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 dc0d1200e3f3 config/SunOS.mk
--- a/config/SunOS.mk Thu Jun 18 15:32:48 2009 +0100
+++ b/config/SunOS.mk Fri Jun 19 16:13:51 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 dc0d1200e3f3 tools/firmware/Makefile
--- a/tools/firmware/Makefile Thu Jun 18 15:32:48 2009 +0100
+++ b/tools/firmware/Makefile Fri Jun 19 16:13:51 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 dc0d1200e3f3 tools/python/Makefile
--- a/tools/python/Makefile Thu Jun 18 15:32:48 2009 +0100
+++ b/tools/python/Makefile Fri Jun 19 16:13:51 2009 +0200
@@ -13,19 +13,20 @@ 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"
+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 "SHAREDIR=\"$(SHAREDIR)\"" >> ${xenpath}
- echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> ${xenpath}
- echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> ${xenpath}
- echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> ${xenpath}
+ rm -f $(XENPATH)
+ echo "SBINDIR=\"$(SBINDIR)\"" >> $(XENPATH)
+ echo "BINDIR=\"$(BINDIR)\"" >> $(XENPATH)
+ echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(XENPATH)
+ echo "LIBDIR=\"$(LIBDIR)\"" >> $(XENPATH)
+ echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(XENPATH)
+ echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(XENPATH)
+ echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(XENPATH)
+ echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(XENPATH)
+ echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(XENPATH)
buildpy: genpath
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
@@ -91,6 +92,7 @@ test:
.PHONY: clean
clean:
+ rm -f $(XENPATH)
rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/auxbin.pyc
rm -f $(DEPS)
diff -r dc0d1200e3f3 tools/python/xen/util/auxbin.py
--- a/tools/python/xen/util/auxbin.py Thu Jun 18 15:32:48 2009 +0100
+++ b/tools/python/xen/util/auxbin.py Fri Jun 19 16:13:51 2009 +0200
@@ -19,8 +19,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 *
def execute(exe, args = None):
exepath = pathTo(exe)
@@ -33,7 +32,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 dc0d1200e3f3 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Thu Jun 18 15:32:48 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py Fri Jun 19 16:13:51 2009 +0200
@@ -16,6 +16,7 @@
#============================================================================
import logging
+import os
import re
import time
import types
@@ -39,7 +40,7 @@ from xen.util.blkif import blkdev_name_t
from xen.util.pci import pci_opts_list_from_sxp, pci_convert_sxp_to_dict
from xen.xend.XendSXPDev import dev_dict_to_sxp
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 \
@@ -1549,7 +1564,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
[-- 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-06-19 14:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-19 14:33 Christoph Egger [this message]
2009-06-19 15:16 ` [PATCH] tools: don't require hardcoded path in guest config file Ian Jackson
2009-06-19 15:32 ` Christoph Egger
2009-06-22 13:01 ` 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=200906191633.19343.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.