We should stub out is_vdi_pv in virt/xenapi/vm_utils.py:
def is_vdi_pv(dev): LOG.debug(_("Running pygrub against %s"), dev)
output = os.popen('pygrub -qn /dev/%s' % dev)
for line in output.readlines(): #try to find kernel string
m = re.search('(?<=kernel:)/.*(?:>)', line)
if m and m.group(0).find('xen') != -1: LOG.debug(_("Found Xen kernel %s") % m.group(0)) return True LOG.debug(_("No Xen kernel found. Booting HVM."))
return False
return with_vdi_attached_here(session, vdi_ref, True, is_vdi_pv)
The test does not fail because we do not check pygrub's exit code, we just parse its output (which is "pygrub: not found"!). If we are unable to find the string for a PV kernel in the output we automatically assume HVM.
We should stub out is_vdi_pv in virt/xenapi/ vm_utils. py:
def is_vdi_pv(dev):
LOG. debug(_ ("Running pygrub against %s"), dev)
#try to find kernel string '(?<=kernel: )/.*(?: >)', line) 0).find( 'xen') != -1:
LOG. debug(_ ("Found Xen kernel %s") % m.group(0))
return True
LOG. debug(_ ("No Xen kernel found. Booting HVM.")) attached_ here(session, vdi_ref, True, is_vdi_pv)
output = os.popen('pygrub -qn /dev/%s' % dev)
for line in output.readlines():
m = re.search(
if m and m.group(
return False
return with_vdi_
The test does not fail because we do not check pygrub's exit code, we just parse its output (which is "pygrub: not found"!). If we are unable to find the string for a PV kernel in the output we automatically assume HVM.
I will stub out this function.