Index: xen-3.1-testing/tools/python/xen/xend/XendBootloader.py =================================================================== --- xen-3.1-testing.orig/tools/python/xen/xend/XendBootloader.py +++ xen-3.1-testing/tools/python/xen/xend/XendBootloader.py @@ -14,6 +14,7 @@ import os, select, errno, stat, signal import random +import re import shlex from xen.xend import sxp @@ -187,3 +188,14 @@ def bootloader_tidy(dom): os.kill(pid, signal.SIGKILL) +def bootfilter(bootloader, bootloader_args, vdisk): + """Is this virtual disk ok to boot from?""" + if vdisk.endswith(':disk'): + vdisk = vdisk[:-5] # temporary work-around for bug 237414 + if bootloader.endswith('domUloader.py'): + for arg in bootloader_args.split(): + if arg.startswith('--entry='): + m = re.match(r'^([hsx]v?d[a-z])[0-9]*:[^,]*(,[^,]*)?$', arg[8:]) + if m: + return vdisk == m.group(1) or vdisk == m.group(2) + return True Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py @@ -42,7 +42,7 @@ from xen.xend import balloon, sxp, uuid, from xen.xend import XendOptions, XendNode, XendConfig from xen.xend.XendConfig import scrub_password -from xen.xend.XendBootloader import bootloader, bootloader_tidy +from xen.xend.XendBootloader import bootloader, bootloader_tidy, bootfilter from xen.xend.XendError import XendError, VmError from xen.xend.XendDevices import XendDevices from xen.xend.XendTask import XendTask @@ -1783,8 +1783,11 @@ class XendDomainInfo: blexec = osdep.pygrub_path blcfg = None - disks = [x for x in self.info['vbd_refs'] - if self.info['devices'][x][1]['bootable']] + disks = [] + for x in self.info['vbd_refs']: + vdisk = self.info['devices'][x][1]['dev'] + if bootfilter(blexec, bootloader_args, vdisk): + disks.append(x) if not disks: msg = "Had a bootloader specified, but no disks are bootable"