xen: pass Xen console in cmdline
Xen's console is attached to hvc0 in PV guests [1]. If an image does set it up on its grub configuration, the instance may not boot properly. Nova is setting the os_cmdline for other hypervisors, so it should do the same for Xen. This way libvirt will configures the domain properly. [1] https://wiki.xen.org/wiki/Xen_FAQ_Console Change-Id: I7600c6e966ab3829185d008077463e9689b9afd5 Closes-Bug: 1691190
This commit is contained in:
parent
3d84232d7b
commit
8ceba86a9d
|
@ -2016,7 +2016,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
self.assertEqual(instance_ref.flavor.vcpus, cfg.vcpus)
|
||||
self.assertEqual(fields.VMMode.EXE, cfg.os_type)
|
||||
self.assertEqual("/sbin/init", cfg.os_init_path)
|
||||
self.assertEqual("console=tty0 console=ttyS0", cfg.os_cmdline)
|
||||
self.assertEqual("console=tty0 console=ttyS0 console=hvc0",
|
||||
cfg.os_cmdline)
|
||||
self.assertIsNone(cfg.os_root)
|
||||
self.assertEqual(3, len(cfg.devices))
|
||||
self.assertIsInstance(cfg.devices[0],
|
||||
|
@ -2041,7 +2042,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
self.assertEqual(instance_ref.vcpus, cfg.vcpus)
|
||||
self.assertEqual(fields.VMMode.EXE, cfg.os_type)
|
||||
self.assertEqual("/sbin/init", cfg.os_init_path)
|
||||
self.assertEqual("console=tty0 console=ttyS0", cfg.os_cmdline)
|
||||
self.assertEqual("console=tty0 console=ttyS0 console=hvc0",
|
||||
cfg.os_cmdline)
|
||||
self.assertIsNone(cfg.os_root)
|
||||
self.assertEqual(3, len(cfg.devices))
|
||||
self.assertIsInstance(cfg.devices[0],
|
||||
|
@ -5338,9 +5340,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
instance_ref,
|
||||
image_meta)
|
||||
|
||||
# the instance has 'root=/dev/vda console=tty0 console=ttyS0' set by
|
||||
# default, so testing an empty string and None value in the
|
||||
# os_command_line image property must pass
|
||||
# the instance has 'root=/dev/vda console=tty0 console=ttyS0
|
||||
# console=hvc0' set by default, so testing an empty string and None
|
||||
# value in the os_command_line image property must pass
|
||||
cfg = drvr._get_guest_config(instance_ref,
|
||||
_fake_network_info(self, 1),
|
||||
image_meta, disk_info)
|
||||
|
@ -6858,11 +6860,10 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
check = (lambda t: "no_timer_check" in t.find('./os/cmdline').
|
||||
text, hypervisor_type == "qemu")
|
||||
check_list.append(check)
|
||||
# Hypervisors that only support vm_mode.HVM and Xen
|
||||
# should not produce configuration that results in kernel
|
||||
# arguments
|
||||
# Hypervisors that only support vm_mode.HVM should not produce
|
||||
# configuration that results in kernel arguments
|
||||
if not expect_kernel and (hypervisor_type in
|
||||
['qemu', 'kvm', 'xen']):
|
||||
['qemu', 'kvm']):
|
||||
check = (lambda t: t.find('./os/root'), None)
|
||||
check_list.append(check)
|
||||
check = (lambda t: t.find('./os/cmdline'), None)
|
||||
|
|
|
@ -138,7 +138,7 @@ DISABLE_PREFIX = 'AUTO: '
|
|||
DISABLE_REASON_UNDEFINED = None
|
||||
|
||||
# Guest config console string
|
||||
CONSOLE = "console=tty0 console=ttyS0"
|
||||
CONSOLE = "console=tty0 console=ttyS0 console=hvc0"
|
||||
|
||||
GuestNumaConfig = collections.namedtuple(
|
||||
'GuestNumaConfig', ['cpuset', 'cputune', 'numaconfig', 'numatune'])
|
||||
|
@ -4158,24 +4158,18 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
root_device_name):
|
||||
if rescue.get('kernel_id'):
|
||||
guest.os_kernel = os.path.join(inst_path, "kernel.rescue")
|
||||
if virt_type == "xen":
|
||||
guest.os_cmdline = "ro root=%s" % root_device_name
|
||||
else:
|
||||
guest.os_cmdline = ("root=%s %s" % (root_device_name, CONSOLE))
|
||||
if virt_type == "qemu":
|
||||
guest.os_cmdline += " no_timer_check"
|
||||
guest.os_cmdline = ("root=%s %s" % (root_device_name, CONSOLE))
|
||||
if virt_type == "qemu":
|
||||
guest.os_cmdline += " no_timer_check"
|
||||
if rescue.get('ramdisk_id'):
|
||||
guest.os_initrd = os.path.join(inst_path, "ramdisk.rescue")
|
||||
|
||||
def _set_guest_for_inst_kernel(self, instance, guest, inst_path, virt_type,
|
||||
root_device_name, image_meta):
|
||||
guest.os_kernel = os.path.join(inst_path, "kernel")
|
||||
if virt_type == "xen":
|
||||
guest.os_cmdline = "ro root=%s" % root_device_name
|
||||
else:
|
||||
guest.os_cmdline = ("root=%s %s" % (root_device_name, CONSOLE))
|
||||
if virt_type == "qemu":
|
||||
guest.os_cmdline += " no_timer_check"
|
||||
guest.os_cmdline = ("root=%s %s" % (root_device_name, CONSOLE))
|
||||
if virt_type == "qemu":
|
||||
guest.os_cmdline += " no_timer_check"
|
||||
if instance.ramdisk_id:
|
||||
guest.os_initrd = os.path.join(inst_path, "ramdisk")
|
||||
# we only support os_command_line with images with an explicit
|
||||
|
@ -4447,6 +4441,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
if virt_type == "xen":
|
||||
if guest.os_type == fields.VMMode.HVM:
|
||||
guest.os_loader = CONF.libvirt.xen_hvmloader_path
|
||||
else:
|
||||
guest.os_cmdline = CONSOLE
|
||||
elif virt_type in ("kvm", "qemu"):
|
||||
if caps.host.cpu.arch in (fields.Architecture.I686,
|
||||
fields.Architecture.X86_64):
|
||||
|
|
Loading…
Reference in New Issue