diff -Nru qemu-2.1+dfsg/debian/changelog qemu-2.1+dfsg/debian/changelog --- qemu-2.1+dfsg/debian/changelog 2015-01-16 16:47:50.000000000 -0600 +++ qemu-2.1+dfsg/debian/changelog 2015-02-09 16:47:16.000000000 -0600 @@ -1,3 +1,10 @@ +qemu (1:2.1+dfsg-11ubuntu3) vivid; urgency=medium + + * Determine if we are running inside a virtual environment. If running inside + a virtualized enviornment do _not_ automatically enable KSM. (LP: #1418339) + + -- Chris J Arges Fri, 06 Feb 2015 15:42:17 -0600 + qemu (1:2.1+dfsg-11ubuntu2) vivid; urgency=medium * Cherrypick upstream patch needed to allow ESx hosts to run under diff -Nru qemu-2.1+dfsg/debian/qemu-system-x86.postinst qemu-2.1+dfsg/debian/qemu-system-x86.postinst --- qemu-2.1+dfsg/debian/qemu-system-x86.postinst 2014-12-17 13:44:05.000000000 -0600 +++ qemu-2.1+dfsg/debian/qemu-system-x86.postinst 2015-02-09 22:23:12.000000000 -0600 @@ -2,6 +2,31 @@ set -e +# Determine if we are running inside a VM. +# First attempt to use systemd-detect-virt if possible otherwise use dmidecode +# or the kernel log. +# This needs to be done before we restart the daemon. +IS_VM=0 +if [ -f /usr/bin/systemd-detect-virt ]; then + /usr/bin/systemd-detect-virt -vq && IS_VM=1 +else + VM_STRINGS="KVM QEMU VMware VirtualBox Xen" + VM_DETECT="$(dmesg | egrep -e '(Hypervisor detected|Booting paravirtualized kernel)' || true)" + VM_DMIDECODE="$(sudo dmidecode | egrep -i 'manufacturer|product|vendor' || true)" + VM_SEARCH=${VM_DETECT}${VM_DMIDECODE} + for vm_string in $VM_STRINGS; do + if [ -z "${VM_SEARCH##*$vm_string*}" ]; then + IS_VM=1; break; + fi + done +fi +# Disable KSM if we are running in a VM +if [ "$IS_VM" = 1 ]; then + if [ -f /etc/default/qemu-kvm ]; then + sed -i 's/KSM_ENABLED=1/KSM_ENABLED=0/' /etc/default/qemu-kvm; + fi +fi + # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER#