53 |
53 |
constants.HV_INITRD_PATH,
|
54 |
54 |
constants.HV_ROOT_PATH,
|
55 |
55 |
constants.HV_ACPI,
|
|
56 |
constants.HV_SERIAL_CONSOLE,
|
56 |
57 |
]
|
57 |
58 |
|
58 |
59 |
_MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
|
... | ... | |
244 |
245 |
if initrd_path:
|
245 |
246 |
kvm_cmd.extend(['-initrd', initrd_path])
|
246 |
247 |
|
247 |
|
root_path = instance.hvparams[constants.HV_ROOT_PATH]
|
248 |
|
kvm_cmd.extend(['-append', 'console=ttyS0,38400 root=%s ro' % root_path])
|
|
248 |
root_append = 'root=%s ro' % instance.hvparams[constants.HV_ROOT_PATH]
|
|
249 |
if instance.hvparams[constants.HV_SERIAL_CONSOLE]:
|
|
250 |
kvm_cmd.extend(['-append', 'console=ttyS0,38400 %s' % root_append])
|
|
251 |
else:
|
|
252 |
kvm_cmd.extend(['-append', root_append])
|
249 |
253 |
|
250 |
254 |
#"hvm_boot_order",
|
251 |
255 |
#"hvm_cdrom_image_path",
|
... | ... | |
258 |
262 |
monitor_dev = 'unix:%s,server,nowait' % \
|
259 |
263 |
self._InstanceMonitor(instance.name)
|
260 |
264 |
kvm_cmd.extend(['-monitor', monitor_dev])
|
261 |
|
serial_dev = 'unix:%s,server,nowait' % self._InstanceSerial(instance.name)
|
262 |
|
kvm_cmd.extend(['-serial', serial_dev])
|
|
265 |
if instance.hvparams[constants.HV_SERIAL_CONSOLE]:
|
|
266 |
serial_dev = 'unix:%s,server,nowait' % self._InstanceSerial(instance.name)
|
|
267 |
kvm_cmd.extend(['-serial', serial_dev])
|
|
268 |
else:
|
|
269 |
kvm_cmd.extend(['-serial', 'none'])
|
263 |
270 |
|
264 |
271 |
# Save the current instance nics, but defer their expansion as parameters,
|
265 |
272 |
# as we'll need to generate executable temp files for them.
|
... | ... | |
586 |
593 |
"""Return a command for connecting to the console of an instance.
|
587 |
594 |
|
588 |
595 |
"""
|
589 |
|
# FIXME: The socat shell is not perfect. In particular the way we start
|
590 |
|
# it ctrl+c will close it, rather than being passed to the other end.
|
591 |
|
# On the other hand if we pass the option 'raw' (or ignbrk=1) there
|
592 |
|
# will be no way of exiting socat (except killing it from another shell)
|
593 |
|
# and ctrl+c doesn't work anyway, printing ^C rather than being
|
594 |
|
# interpreted by kvm. For now we'll leave it this way, which at least
|
595 |
|
# allows a minimal interaction and changes on the machine.
|
596 |
|
socat_shell = ("%s STDIO,echo=0,icanon=0 UNIX-CONNECT:%s" %
|
597 |
|
(constants.SOCAT_PATH,
|
598 |
|
utils.ShellQuote(cls._InstanceSerial(instance.name))))
|
599 |
|
|
600 |
|
return socat_shell
|
|
596 |
if hvparams[constants.HV_SERIAL_CONSOLE]:
|
|
597 |
# FIXME: The socat shell is not perfect. In particular the way we start
|
|
598 |
# it ctrl+c will close it, rather than being passed to the other end.
|
|
599 |
# On the other hand if we pass the option 'raw' (or ignbrk=1) there
|
|
600 |
# will be no way of exiting socat (except killing it from another shell)
|
|
601 |
# and ctrl+c doesn't work anyway, printing ^C rather than being
|
|
602 |
# interpreted by kvm. For now we'll leave it this way, which at least
|
|
603 |
# allows a minimal interaction and changes on the machine.
|
|
604 |
shell_command = ("%s STDIO,echo=0,icanon=0 UNIX-CONNECT:%s" %
|
|
605 |
(constants.SOCAT_PATH,
|
|
606 |
utils.ShellQuote(cls._InstanceSerial(instance.name))))
|
|
607 |
else:
|
|
608 |
shell_command = "echo 'No serial shell for instance %s'" % instance.name
|
|
609 |
return shell_command
|
601 |
610 |
|
602 |
611 |
def Verify(self):
|
603 |
612 |
"""Verify the hypervisor.
|