Manage /etc/default/qemu-kvm file via template

PROD-22202

Change-Id: I9eb3a6dced64bb011b1f2bc757d2f764b845208e
diff --git a/nova/compute.sls b/nova/compute.sls
index d484d26..67d19c8 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -625,5 +625,25 @@
 
 {%- endif %}
 
+{%- if compute.get('qemu', {}).defaults is defined %}
+
+/etc/default/qemu-kvm:
+  file.managed:
+  - source: salt://nova/files/etc-qemu-kvm
+  - context:
+    params: {{ compute.qemu.defaults }}
+  - template: jinja
+  - require:
+    - pkg: nova_compute_packages
+
+qemu_kvm_service:
+  service.running:
+  - name: qemu-kvm
+  - enable: true
+  - watch:
+    - file: /etc/default/qemu-kvm
+
+{%- endif %}
+
 
 {%- endif %}
diff --git a/nova/files/etc-qemu-kvm b/nova/files/etc-qemu-kvm
new file mode 100644
index 0000000..7ba26ec
--- /dev/null
+++ b/nova/files/etc-qemu-kvm
@@ -0,0 +1,18 @@
+# Set to 1 to enable KSM, 0 to disable KSM, and AUTO to use default settings.
+# After changing this setting restart the qemu-kvm service.
+KSM_ENABLED={{ params.get('ksm_enabled', 'AUTO') }}
+SLEEP_MILLISECS={{ params.get('sleep_millisecs', 200) }}
+
+# To load the vhost_net module, which in some cases can speed up
+# network performance, set VHOST_NET_ENABLED to 1.
+#VHOST_NET_ENABLED=0
+{%- if params.vhost_net_enabled is defined %}
+VHOST_NET_ENABLED={{ params.vhost_net_enabled }}
+{%- endif %}
+
+# Set this to 1 if you want hugepages to be available to kvm under
+# /run/hugepages/kvm
+#KVM_HUGEPAGES=0
+{%- if params.kvm_hugepages is defined %}
+KVM_HUGEPAGES={{ params.kvm_hugepages }}
+{%- endif %}