aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2017-03-02 22:27:58 -0700
committerAndy Lutomirski <luto@kernel.org>2019-06-17 18:24:15 -0700
commit538f1e756139a6b57a4780e7ceb3ac6bcaa4fe6f (patch)
treedfda54238adf39748e059743333e013dca7e1450
parent81ce1e816a21d4a00a09c3c504b8bcfb57b1fa64 (diff)
downloadvirtme-538f1e756139a6b57a4780e7ceb3ac6bcaa4fe6f.tar.gz
Added --show-boot-console option to show the boot console
when running scripts. Signed-off-by: James Yonan <james@openvpn.net>
-rw-r--r--virtme/commands/run.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/virtme/commands/run.py b/virtme/commands/run.py
index 4c27bed..c40e225 100644
--- a/virtme/commands/run.py
+++ b/virtme/commands/run.py
@@ -96,6 +96,8 @@ def make_parser():
help="Initialize everything but don't run the guest")
g.add_argument('--show-command', action='store_true',
help='Show the VM command line')
+ g.add_argument('--show-boot-console', action='store_true',
+ help='Show the boot console when running scripts')
g = parser.add_argument_group(title='Guest userspace configuration')
g.add_argument('--pwd', action='store_true',
@@ -312,7 +314,7 @@ def main():
has_script = False
- def do_script(shellcmd, use_exec=False):
+ def do_script(shellcmd, use_exec=False, show_boot_console=False):
if args.graphics:
arg_fail('scripts and --graphics are mutually exclusive')
@@ -334,6 +336,11 @@ def main():
# but many architecture-specific serial devices don't support that.
qemuargs.extend(['-serial', 'chardev:console'])
+ if show_boot_console:
+ serdev = qemu.quote_optarg(arch.serial_dev_name(0))
+ kernelargs.extend(['console=%s' % serdev,
+ 'earlyprintk=serial,%s,115200' % serdev])
+
# Set up a virtserialport for script I/O
qemuargs.extend(['-chardev', 'stdio,id=stdio,signal=on,mux=off'])
qemuargs.extend(['-device', arch.virtio_dev_type('serial')])
@@ -366,10 +373,10 @@ def main():
os.close(newfd)
if args.script_sh is not None:
- do_script(args.script_sh)
+ do_script(args.script_sh, show_boot_console=args.show_boot_console)
if args.script_exec is not None:
- do_script(shlex.quote(args.script_exec), use_exec=True)
+ do_script(shlex.quote(args.script_exec), use_exec=True, show_boot_console=args.show_boot_console)
if args.net:
qemuargs.extend(['-device', 'virtio-net-pci,netdev=n0'])