From 5c9d0f9562191312f0fb6b031546729d398a3bfd Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Tue, 23 May 2017 20:39:28 -0500
Subject: [PATCH] Nova: Disable virtlogd for Libvirt >1.3

This PS disables virtlogd for running libvirt >1.3

See: https://bugzilla.redhat.com/show_bug.cgi?id=1290357

Closes-Bug: 1686069

Change-Id: I27ab690ef41e99e23a57f42b0695b1becb101e69
---
 nova/templates/configmap-etc.yaml     |  2 ++
 nova/templates/daemonset-libvirt.yaml |  4 ++++
 nova/templates/etc/_qemu.conf.tpl     | 28 +++++++++++++++++++++++++++
 tools/overrides/mvp/nova.yaml         |  3 ---
 4 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 nova/templates/etc/_qemu.conf.tpl

diff --git a/nova/templates/configmap-etc.yaml b/nova/templates/configmap-etc.yaml
index 828f4409dc..1bc13fade8 100644
--- a/nova/templates/configmap-etc.yaml
+++ b/nova/templates/configmap-etc.yaml
@@ -96,3 +96,5 @@ data:
 {{ tuple "etc/_resolv.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
   libvirtd.conf: |+
 {{ tuple "etc/_libvirtd.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
+  qemu.conf: |+
+{{ tuple "etc/_qemu.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
diff --git a/nova/templates/daemonset-libvirt.yaml b/nova/templates/daemonset-libvirt.yaml
index c2e70cc4e0..198783ae65 100644
--- a/nova/templates/daemonset-libvirt.yaml
+++ b/nova/templates/daemonset-libvirt.yaml
@@ -66,6 +66,10 @@ spec:
               mountPath: /etc/libvirt/libvirtd.conf
               subPath: libvirtd.conf
               readOnly: true
+            - name: nova-etc
+              mountPath: /etc/libvirt/qemu.conf
+              subPath: qemu.conf
+              readOnly: true
             - name: nova-etc
               mountPath: /etc/nova/nova.conf
               subPath: nova.conf
diff --git a/nova/templates/etc/_qemu.conf.tpl b/nova/templates/etc/_qemu.conf.tpl
new file mode 100644
index 0000000000..8677249d15
--- /dev/null
+++ b/nova/templates/etc/_qemu.conf.tpl
@@ -0,0 +1,28 @@
+# Copyright 2017 The Openstack-Helm Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# The backend to use for handling stdout/stderr output from
+# QEMU processes.
+#
+#  'file': QEMU writes directly to a plain file. This is the
+#          historical default, but allows QEMU to inflict a
+#          denial of service attack on the host by exhausting
+#          filesystem space
+#
+#  'logd': QEMU writes to a pipe provided by virtlogd daemon.
+#          This is the current default, providing protection
+#          against denial of service by performing log file
+#          rollover when a size limit is hit.
+#
+stdio_handler = "file"
diff --git a/tools/overrides/mvp/nova.yaml b/tools/overrides/mvp/nova.yaml
index d293a70aeb..3f0c6af15f 100644
--- a/tools/overrides/mvp/nova.yaml
+++ b/tools/overrides/mvp/nova.yaml
@@ -12,9 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-images:
-  libvirt: quay.io/stackanetes/stackanetes-nova-libvirt:newton
-
 conf:
   nova:
     default: