summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <palcantara@suse.de>2018-04-18 15:20:44 -0300
committerPaulo Alcantara <palcantara@suse.de>2018-04-18 15:20:44 -0300
commit3a2ab6f42dd62cef0b575a8589dae7df090f3c54 (patch)
tree02c319541e3eba6453aa1ef60523c42d3ce2fbe6
parent12d5e3485e232a6f91134e6b7e90fb079baa36ef (diff)
downloadvmhtool-3a2ab6f42dd62cef0b575a8589dae7df090f3c54.tar.gz
vmhtool-3a2ab6f42dd62cef0b575a8589dae7df090f3c54.tar.xz
vmhtool-3a2ab6f42dd62cef0b575a8589dae7df090f3c54.zip
Introduce --nographic|-N cmdline option
This enables users to start up vms with no display at all. Signed-off-by: Paulo Alcantara <palcantara@suse.de>
-rwxr-xr-xvmhelper47
1 files changed, 26 insertions, 21 deletions
diff --git a/vmhelper b/vmhelper
index cffb82e..dca7716 100755
--- a/vmhelper
+++ b/vmhelper
@@ -25,12 +25,33 @@ my $print_help;
my $initrd_img = '';
my $shared_dirs = '';
my $gen_new_conf;
+my $nographic;
+
+sub usage {
+ print STDERR "Usage: " . basename($0). " [name] [options]
+ -h, --help print this help
+ -i, --install image create a new vm and install it from an ISO image
+ -v, --virtio image attach virtio drivers ISO image into guest
+ -I, --initrd pass initramfs image to kernel
+ -k, --kernel path run the guest with a custom kernel image
+ -b, --build build custom kernel before running guest
+ -c, --config file custom kernel config file
+ -m, --modules install kernel modules in rootfs image
+ -s, --share=foo,bar,... share directories between host and guest
+ -l, --list list all vms
+ -d, --delete delete vm
+ -w, --win MS windows specifics
+ -n, --new generate new config file
+ -N, --nographic disable graphics when running vm
+";
+ exit 1;
+}
GetOptions("install=s" => \$install_iso_path,
"virtio=s" => \$virtio_drv_path,
"kernel=s" => \$kernel_path,
"build" => \$build_kernel,
- "Initrd=s" => \$initrd_img,
+ "initrd|I=s" => \$initrd_img,
"config=s" => \$config_path,
"modules" => \$install_modules,
"list" => \$list_vms,
@@ -38,7 +59,8 @@ GetOptions("install=s" => \$install_iso_path,
"help" => \$print_help,
"win" => \$windows_guest,
"share=s" => \$shared_dirs,
- "new" => \$gen_new_conf);
+ "new" => \$gen_new_conf,
+ "nographic|N" => \$nographic) or usage();
usage() if $print_help;
@@ -128,25 +150,6 @@ sub resolve_name {
return "<unknown>";
}
-sub usage {
- print STDERR "Usage: " . basename($0). " [name] [options]
- -h, --help print this help
- -i, --install image create a new vm and install it from an ISO image
- -v, --virtio image attach virtio drivers ISO image into guest
- -I, --initrd pass initramfs image to kernel
- -k, --kernel path run the guest with a custom kernel image
- -b, --build build custom kernel before running guest
- -c, --config file custom kernel config file
- -m, --modules install kernel modules in rootfs image
- -s, --share=foo,bar,... share directories between host and guest
- -l, --list list all vms
- -d, --delete delete vm
- -w, --win MS windows specifics
- -n, --new generate new config file
-";
- exit 1;
-}
-
if ($list_vms) {
open(my $conf, "<", $vm_info) or exit 0;
printf STDERR "%-25s%-20s%-15s\n", "name", "macaddr", "ipaddr";
@@ -546,6 +549,8 @@ if ($kernel_path) {
}
$qemu_cmd .= " " . sprintf $qemu_linux_opts{'initrd'}, $initrd_img;
}
+} else {
+ $qemu_cmd .= " -nographic -device virtio-serial-pci -serial mon:stdio" if $nographic;
}
system($qemu_cmd);