Merge "Execute pygrub using nova-rootwrap in xenapi"
This commit is contained in:
commit
c1bdc39fd9
@ -92,6 +92,9 @@ iscsiadm: CommandFilter, iscsiadm, root
|
|||||||
# nova/virt/xenapi/vm_utils.py: 'parted', '--script', dev_path, ..*.
|
# nova/virt/xenapi/vm_utils.py: 'parted', '--script', dev_path, ..*.
|
||||||
parted: CommandFilter, parted, root
|
parted: CommandFilter, parted, root
|
||||||
|
|
||||||
|
# nova/virt/xenapi/vm_utils.py: 'pygrub', '-qn', dev_path
|
||||||
|
pygrub: CommandFilter, /usr/bin/pygrub, root
|
||||||
|
|
||||||
# nova/virt/xenapi/vm_utils.py: fdisk %(dev_path)s
|
# nova/virt/xenapi/vm_utils.py: fdisk %(dev_path)s
|
||||||
fdisk: CommandFilter, /sbin/fdisk, root
|
fdisk: CommandFilter, /sbin/fdisk, root
|
||||||
|
|
||||||
|
@ -1922,14 +1922,21 @@ def _get_this_vm_ref(session):
|
|||||||
def _is_vdi_pv(dev):
|
def _is_vdi_pv(dev):
|
||||||
LOG.debug(_("Running pygrub against %s"), dev)
|
LOG.debug(_("Running pygrub against %s"), dev)
|
||||||
dev_path = utils.make_dev_path(dev)
|
dev_path = utils.make_dev_path(dev)
|
||||||
output = os.popen('pygrub -qn %s' % dev_path)
|
try:
|
||||||
for line in output.readlines():
|
out, err = utils.execute('pygrub', '-qn', dev_path, run_as_root=True)
|
||||||
#try to find kernel string
|
for line in out:
|
||||||
m = re.search('(?<=kernel:)/.*(?:>)', line)
|
# try to find kernel string
|
||||||
if m and m.group(0).find('xen') != -1:
|
m = re.search('(?<=kernel:)/.*(?:>)', line)
|
||||||
LOG.debug(_("Found Xen kernel %s") % m.group(0))
|
if m and m.group(0).find('xen') != -1:
|
||||||
return True
|
LOG.debug(_("Found Xen kernel %s") % m.group(0))
|
||||||
LOG.debug(_("No Xen kernel found. Booting HVM."))
|
return True
|
||||||
|
LOG.debug(_("No Xen kernel found. Booting HVM."))
|
||||||
|
except exception.ProcessExecutionError:
|
||||||
|
LOG.exception(_("Error while executing pygrub! Please, ensure the "
|
||||||
|
"binary is installed correctly, and available in your "
|
||||||
|
"PATH; on some Linux distros, pygrub may be installed "
|
||||||
|
"in /usr/lib/xen-X.Y/bin/pygrub. Attempting to boot "
|
||||||
|
"in HVM mode."))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user