[Pkg-xen-changes] [xen] 76/128: tools-python-xen-relative-path.diff

Ian Campbell ijc-guest at moszumanska.debian.org
Sat Jul 12 09:06:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

ijc-guest pushed a commit to branch feature/4.4-updates
in repository xen.

commit 304ab83d71fd0e5070b81a36d5fa220083a84e09
Author: Bastian Blank <waldi at debian.org>
Date:   Sat Jul 5 11:47:19 2014 +0200

    tools-python-xen-relative-path.diff
---
 tools/python/xen/xend/XendCheckpoint.py |  4 ++--
 tools/python/xen/xend/XendConfig.py     | 12 +++++------
 tools/python/xen/xend/XendDomainInfo.py |  2 +-
 tools/python/xen/xm/create.py           | 35 ++++++++++++++-------------------
 4 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py
index a433ffa..940c9bf 100644
--- a/tools/python/xen/xend/XendCheckpoint.py
+++ b/tools/python/xen/xend/XendCheckpoint.py
@@ -118,7 +118,7 @@ def save(fd, dominfo, network, live, dst, checkpoint=False, node=-1,sock=None):
         # enabled. Passing "0" simply uses the defaults compiled into
         # libxenguest; see the comments and/or code in xc_linux_save() for
         # more information.
-        cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd),
+        cmd = [xen.util.auxbin.path_bin(XC_SAVE), str(fd),
                str(dominfo.getDomid()), "0", "0", 
                str(int(live) | (int(hvm) << 2)) ]
         log.debug("[xc_save]: %s", string.join(cmd))
@@ -299,7 +299,7 @@ def restore(xd, fd, dominfo = None, paused = False, relocating = False):
 
         superpages = restore_image.superpages
 
-        cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
+        cmd = map(str, [xen.util.auxbin.path_bin(XC_RESTORE),
                         fd, dominfo.getDomid(),
                         store_port, console_port, int(is_hvm), pae, apic, superpages, 1])
         log.debug("[xc_restore]: %s", string.join(cmd))
diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py
index 4a226a7..42406f3 100644
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -493,11 +493,11 @@ class XendConfig(dict):
 
         if self.is_hvm() or self.has_rfb():
             if 'device_model' not in self['platform']:
-                self['platform']['device_model'] = auxbin.pathTo("qemu-dm")
+                self['platform']['device_model'] = auxbin.path_bin("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'])
+                    auxbin.path_bin(self['platform']['device_model'])
             # If the device_model is not set the os.path.exists() would raise
             # an exception so we return our error message instead if applicable
             if not self['platform']['device_model']:
@@ -528,14 +528,14 @@ class XendConfig(dict):
                 # 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['PV_kernel'] = auxbin.path_boot("hvmloader")
                     self['platform']['loader'] = self['PV_kernel']
                     self['PV_kernel'] = ''
                 else:
-                    self['platform']['loader'] = auxbin.pathTo("hvmloader")
+                    self['platform']['loader'] = auxbin.path_boot("hvmloader")
                 log.debug("Loader is %s" % str(self['platform']['loader']))
             elif self['platform']['loader'] == 'hvmloader':
-                self['platform']['loader'] = auxbin.pathTo("hvmloader")
+                self['platform']['loader'] = auxbin.path_boot("hvmloader")
             if not os.path.exists(self['platform']['loader']):
                 raise VmError("kernel '%s' not found" % str(self['platform']['loader']))
 
@@ -1653,7 +1653,7 @@ class XendConfig(dict):
                     # is invoked for pvfb services
                     if 'device_model' not in target['platform']:
                         target['platform']['device_model'] = \
-                            auxbin.pathTo("qemu-dm")
+                            auxbin.path_bin("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 --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 8d4ff5c..cb2d36d 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -3244,7 +3244,7 @@ class XendDomainInfo:
         else:
             # Boot using bootloader
             if not blexec or blexec == 'pygrub':
-                blexec = auxbin.pathTo('pygrub')
+                blexec = auxbin.path_bin('pygrub')
 
             blcfg = None
             disks = [x for x in self.info['vbd_refs']
diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py
index 22841aa..2ddf71b 100644
--- a/tools/python/xen/xm/create.py
+++ b/tools/python/xen/xm/create.py
@@ -695,45 +695,39 @@ def configure_image(vals):
         return None
     config_image = [ vals.builder ]
     if vals.kernel:
+        t = auxbin.path_boot(vals.kernel)
         if vals.bootloader:
             # If bootloader is specified, vals.kernel will be used
             # by bootloader when boots DomU. So it is needless to
             # check the path is existent or not.
             config_image.append([ 'kernel', vals.kernel ])
-        elif 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) ])
+        elif t:
+            config_image.append([ 'kernel', t ])
         else:
             raise ValueError('Cannot find kernel "%s"' % vals.kernel)
     if vals.ramdisk:
+        t = auxbin.path_boot(vals.ramdisk)
         if vals.bootloader:
             # Same with 'kernel' above
             config_image.append([ 'ramdisk', vals.ramdisk ])
-        elif 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) ])
+        elif t:
+            config_image.append([ 'ramdisk', t ])
         else:
             raise ValueError('Cannot find ramdisk "%s"' % vals.ramdisk)
     if vals.loader:
-        if os.path.dirname(vals.loader) != "" and os.path.exists(vals.loader):
-            config_image.append([ 'loader', vals.loader ])
-        elif vals.loader == 'hvmloader':
+        t = auxbin.path_boot(vals.loader)
+        if 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) ])
+        elif t:
+            config_image.append([ 'loader', t ])
         else:
             raise ValueError('Cannot find loader "%s"' % vals.loader)
     if vals.cmdline_ip:
@@ -1032,7 +1026,7 @@ def configure_hvm(config_image, vals):
     args = [ 'acpi', 'apic',
              'boot',
              'cpuid', 'cpuid_check',
-             'device_model', 'display',
+             'display',
              'fda', 'fdb',
              'gfx_passthru', 'guest_os_type',
              'hap', 'hpet',
@@ -1054,6 +1048,8 @@ def configure_hvm(config_image, vals):
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
             config_image.append([a, vals.__dict__[a]])
+    if vals.device_model:
+        config_image.append(['device_model', auxbin.path_bin(vals.device_model)])
     if vals.vncpasswd is not None:
         config_image.append(['vncpasswd', vals.vncpasswd])
 
@@ -1120,10 +1116,9 @@ def make_config(vals):
 
     config_image = configure_image(vals)
     if vals.bootloader:
-        if vals.bootloader == "pygrub":
-            vals.bootloader = auxbin.pathTo(vals.bootloader)
+        t = auxbin.path_boot(vals.bootloader)
 
-        config.append(['bootloader', vals.bootloader])
+        config.append(['bootloader', t])
         if vals.bootargs:
             config.append(['bootloader_args', vals.bootargs])
         else:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-xen/xen.git



More information about the Pkg-xen-changes mailing list