* [PATCH] tools: don't require hardcoded path in guest config file
@ 2009-06-19 14:33 Christoph Egger
2009-06-19 15:16 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2009-06-19 14:33 UTC (permalink / raw)
To: xen-devel
[-- 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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] tools: don't require hardcoded path in guest config file 2009-06-19 14:33 [PATCH] tools: don't require hardcoded path in guest config file Christoph Egger @ 2009-06-19 15:16 ` Ian Jackson 2009-06-19 15:32 ` Christoph Egger 2009-06-22 13:01 ` Christoph Egger 0 siblings, 2 replies; 4+ messages in thread From: Ian Jackson @ 2009-06-19 15:16 UTC (permalink / raw) To: Christoph Egger; +Cc: xen-devel Christoph Egger writes ("[Xen-devel] [PATCH] tools: don't require hardcoded path in guest config file"): > 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. In general I think this is a great idea. I just have some detailed quibbles. > + if not os.path.exists(self['platform']['device_model']): > + self['platform']['device_model'] = \ > + auxbin.pathTo(self['platform']['device_model']) I think it would be better just to look for a slash in the specified value, and always prepend the path. Otherwise you end up checking for the file in xend's cwd which is pretty strange behaviour. Treating all /-less values as paths in the expected installation directory is more sensible. > + # 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 Surely it would be better to fix the guest config file parser! > + if os.path.basename(self['PV_kernel']) == 'hvmloader': That workaround is a pretty hideous hack. Thanks, Ian. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools: don't require hardcoded path in guest config file 2009-06-19 15:16 ` Ian Jackson @ 2009-06-19 15:32 ` Christoph Egger 2009-06-22 13:01 ` Christoph Egger 1 sibling, 0 replies; 4+ messages in thread From: Christoph Egger @ 2009-06-19 15:32 UTC (permalink / raw) To: Ian Jackson; +Cc: xen-devel On Friday 19 June 2009 17:16:42 Ian Jackson wrote: > Christoph Egger writes ("[Xen-devel] [PATCH] tools: don't require hardcoded path in guest config file"): > > 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. > > In general I think this is a great idea. > I just have some detailed quibbles. > > > + if not os.path.exists(self['platform']['device_model']): > > + self['platform']['device_model'] = \ > > + auxbin.pathTo(self['platform']['device_model']) > > I think it would be better just to look for a slash in the specified > value, and always prepend the path. Otherwise you end up checking for > the file in xend's cwd which is pretty strange behaviour. > > Treating all /-less values as paths in the expected installation > directory is more sensible. Ok. > > + # 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 > > Surely it would be better to fix the guest config file parser! Right. But I didn't find the exact place where the cwd is actually prepended. It would be great, if you can help out here. > > + if os.path.basename(self['PV_kernel']) == 'hvmloader': > > That workaround is a pretty hideous hack. Yes, it is. Christoph -- ---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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools: don't require hardcoded path in guest config file 2009-06-19 15:16 ` Ian Jackson 2009-06-19 15:32 ` Christoph Egger @ 2009-06-22 13:01 ` Christoph Egger 1 sibling, 0 replies; 4+ messages in thread From: Christoph Egger @ 2009-06-22 13:01 UTC (permalink / raw) To: xen-devel; +Cc: Ian Jackson [-- Attachment #1: Type: text/plain, Size: 1758 bytes --] On Friday 19 June 2009 17:16:42 Ian Jackson wrote: > Christoph Egger writes ("[Xen-devel] [PATCH] tools: don't require hardcoded path in guest config file"): > > 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. > > In general I think this is a great idea. > I just have some detailed quibbles. Attached is a new version. Fixes your quibbles below. I hope you like it. > > + if not os.path.exists(self['platform']['device_model']): > > + self['platform']['device_model'] = \ > > + auxbin.pathTo(self['platform']['device_model']) > > I think it would be better just to look for a slash in the specified > value, and always prepend the path. Otherwise you end up checking for > the file in xend's cwd which is pretty strange behaviour. > > Treating all /-less values as paths in the expected installation > directory is more sensible. > > > + # 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 > > Surely it would be better to fix the guest config file parser! Done. > > + if os.path.basename(self['PV_kernel']) == 'hvmloader': > > That workaround is a pretty hideous hack. Christoph -- ---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: 9102 bytes --] diff -r 703ced548925 config/StdGNU.mk --- a/config/StdGNU.mk Fri Jun 19 08:45:55 2009 +0100 +++ b/config/StdGNU.mk Mon Jun 22 14:59:12 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 703ced548925 config/SunOS.mk --- a/config/SunOS.mk Fri Jun 19 08:45:55 2009 +0100 +++ b/config/SunOS.mk Mon Jun 22 14:59:12 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 703ced548925 tools/firmware/Makefile --- a/tools/firmware/Makefile Fri Jun 19 08:45:55 2009 +0100 +++ b/tools/firmware/Makefile Mon Jun 22 14:59:12 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 703ced548925 tools/python/Makefile --- a/tools/python/Makefile Fri Jun 19 08:45:55 2009 +0100 +++ b/tools/python/Makefile Mon Jun 22 14:59:12 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 703ced548925 tools/python/xen/util/auxbin.py --- a/tools/python/xen/util/auxbin.py Fri Jun 19 08:45:55 2009 +0100 +++ b/tools/python/xen/util/auxbin.py Mon Jun 22 14:59:12 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 703ced548925 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Jun 19 08:45:55 2009 +0100 +++ b/tools/python/xen/xend/XendConfig.py Mon Jun 22 14:59:12 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 os.path.dirname(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,17 @@ 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'] != '': + if self['PV_kernel'] == 'hvmloader': + self['PV_kernel'] = auxbin.pathTo("hvmloader") 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'])) + elif self['platform']['loader'] == 'hvmloader': + self['platform']['loader'] = auxbin.pathTo("hvmloader") + 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 +1560,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 diff -r 703ced548925 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Fri Jun 19 08:45:55 2009 +0100 +++ b/tools/python/xen/xm/create.py Mon Jun 22 14:59:12 2009 +0200 @@ -653,11 +653,39 @@ def configure_image(vals): return None config_image = [ vals.builder ] if vals.kernel: - config_image.append([ 'kernel', os.path.abspath(vals.kernel) ]) + if os.path.dirname(vals.kernel) != "" and os.path.exists(vals.kernel): + config_image.append([ 'kernel', vals.kernel ]) + elif vals.kernel == 'hvmloader': + # Keep hvmloader w/o a path and let xend find it. + # This allows guest migration to a Dom0 having different + # xen install pathes. + config_image.append([ 'kernel', vals.kernel ]) + elif os.path.exists(os.path.abspath(vals.kernel)) + # Keep old behaviour, if path is valid. + config_image.append([ 'kernel', os.path.abspath(vals.kernel) ]) + else: + raise ValueError('Cannot find kernel "%s"' % vals.kernel) if vals.ramdisk: - config_image.append([ 'ramdisk', os.path.abspath(vals.ramdisk) ]) + if os.path.dirname(vals.ramdisk) != "" and os.path.exists(vals.ramdisk): + config_image.append([ 'ramdisk', vals.ramdisk ]) + elif os.path.exists(os.path.abspath(vals.ramdisk)): + # Keep old behaviour, if path is valid. + config_image.append([ 'ramdisk', os.path.abspath(vals.ramdisk) ]) + else: + raise ValueError('Cannot find ramdisk "%s"' % vals.ramdisk) if vals.loader: - config_image.append([ 'loader', os.path.abspath(vals.loader) ]) + if os.path.dirname(vals.loader) != "" and os.path.exists(vals.loader): + config_image.append([ 'loader', vals.loader ]) + elif vals.loader == 'hvmloader': + # Keep hvmloader w/o a path and let xend find it. + # This allows guest migration to a Dom0 having different + # xen install pathes. + config_image.append([ 'loader', vals.loader ]) + elif os.path.exists(os.path.abspath(vals.loader)): + # Keep old behaviour, if path is valid. + config_image.append([ 'loader', os.path.abspath(vals.loader) ]) + else: + raise ValueError('Cannot find loader "%s"' % vals.loader) if vals.cmdline_ip: cmdline_ip = strip('ip=', vals.cmdline_ip) config_image.append(['ip', cmdline_ip]) [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-22 13:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-06-19 14:33 [PATCH] tools: don't require hardcoded path in guest config file Christoph Egger 2009-06-19 15:16 ` Ian Jackson 2009-06-19 15:32 ` Christoph Egger 2009-06-22 13:01 ` Christoph Egger
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.