commit:     a968d725358b1fd45022dc278bcca35fc9244686
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 21:09:19 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 21:09:19 2016 +0000
URL:        https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=a968d725

Add MACHINE, CPU, ENABLE_KVM options

ENABLE_KVM replaces the DISABLE_KVM option that was present only in the init 
script.  It did not have a corresponding conf.d option example.
MACHINE allows for the specifcation of the system to emulate.
CPU allows setting the specific cpu to emulate.

 .../qemu-init-scripts/files/qemu-conf.example          | 18 ++++++++++++++++++
 app-emulation/qemu-init-scripts/files/qemu-init-script |  6 ++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example 
b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 6ccd6fc..acdebcb 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -81,6 +81,24 @@ DISKIMAGE=/mnt/kvm/gentoo64.qcow2
 
 ##  General settings
 
+# The machine type to use
+# see qemu help
+# default is Standard PC (i440FX + PIIX, 1996)
+#
+#MACHINE="q35"
+
+# Enable/diasble kvm
+#
+# null value == disabled
+# non null value == enabled
+#
+ENABLE_KVM=1
+
+# cpu option
+# see qemu help
+#
+#CPU=host
+
 # RAM memory allocated for the virtual machine
 #
 # Defaults to 512M

diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script 
b/app-emulation/qemu-init-scripts/files/qemu-init-script
index ff42d78..1ca9670 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -186,8 +186,10 @@ start() {
                -runas ${DROP_USER} -name ${VMNAME} \
                -drive 
file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none}${DRIVE_FORMAT:+,format=${DRIVE_FORMAT}}
 \
                "${NIC_COMMAND[@]}" \
-               ${DISABLE_KVM:---enable-kvm}  \
-               ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${OTHER_ARGS}
+               ${ENABLE_KVM:+--enable-kvm} ${CPU:+-cpu ${CPU}} \
+               ${MACHINE:+-M ${MACHINE}} \
+               ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} \
+               ${OTHER_ARGS}
        einfo "invoking ${@}"
        "${@}"
        ret=$?

Reply via email to