summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo@paulo.ac>2018-06-12 11:08:23 -0300
committerPaulo Alcantara <paulo@paulo.ac>2018-06-12 11:08:23 -0300
commitb2e25d453dd8cc667f1429fc35409d8cadb010f3 (patch)
tree2f611545a07034525048ce1e5c31da0a2f44c194
parentaf15f7165d28f0d498d08d4c268c2c54a152f497 (diff)
downloadvmhtool-b2e25d453dd8cc667f1429fc35409d8cadb010f3.tar.gz
vmhtool-b2e25d453dd8cc667f1429fc35409d8cadb010f3.tar.xz
vmhtool-b2e25d453dd8cc667f1429fc35409d8cadb010f3.zip
Introduce '--ncpus' cmd option
Allow the user to specify how many vCPUs will be used by the guest. Signed-off-by: Paulo Alcantara <paulo@paulo.ac>
-rwxr-xr-xvmhelper6
1 files changed, 4 insertions, 2 deletions
diff --git a/vmhelper b/vmhelper
index 04922a8..89e12b8 100755
--- a/vmhelper
+++ b/vmhelper
@@ -49,6 +49,7 @@ Linux options:
(requires: --kernel,--rootfs)
--cmdline=\"foo...\" append extra cmdline params
(requires: --kernel,--rootfs)
+ --ncpus num number of vCPUs that will be used by the guest
";
exit 1;
}
@@ -74,6 +75,7 @@ GetOptions("install=s" => \$cmd_opts{install_iso_path},
"gdb" => \$cmd_opts{gdb_conn},
"serial" => \$cmd_opts{kernel_serial},
"cmdline=s" => \$cmd_opts{kernel_cmdline},
+ "ncpus=s" => \$cmd_opts{cpus_num},
"nographic" => \$cmd_opts{nographic}) or usage();
usage() if $cmd_opts{print_help};
@@ -312,7 +314,7 @@ sub destroy_vm_net {
my %qemu_linux_opts = (
mach => "-machine q35",
- cpu => "-enable-kvm -cpu host -smp sockets=1,cores=2,threads=2",
+ cpu => $cmd_opts{cpus_num} ? "-enable-kvm -cpu host -smp $cmd_opts{cpus_num}" : "-enable-kvm -cpu host -smp sockets=1,cores=2,threads=2",
mem => "-m 2048",
bus => "-device qemu-xhci,id=xhci -device virtio-scsi-pci,id=scsi",
hdd => " -device scsi-hd,drive=hd -drive if=none,file=%s,cache=writeback,id=hd,format=raw,unit=0",
@@ -328,7 +330,7 @@ my %qemu_linux_opts = (
my %qemu_win_opts = (
mach => "-machine q35",
- cpu => "-enable-kvm -cpu host -smp sockets=1,cores=2,threads=2",
+ cpu => $cmd_opts{cpus_num} ? "-enable-kvm -cpu host -smp $cmd_opts{cpus_num}" : "-enable-kvm -cpu host -smp sockets=1,cores=2,threads=2",
mem => "-m 4096",
bus => "-device ich9-ahci,id=ahci -device virtio-scsi-pci,id=scsi -device qemu-xhci,id=xhci",
hdd => "-device scsi-hd,drive=hd,bootindex=0 -drive if=none,file=%s,cache=writeback,id=hd,format=raw,unit=0",