From 3d7b289719942ac98b49280682614ee2495346c2 Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Tue, 2 May 2017 02:28:31 -0500
Subject: [PATCH] Nova: Implement MVP config

This PS brings in an MVP config for Nova.

The changes to the Libvirt also permit operation on
RHEL family distros.

Closes-Bug: 1683195

Change-Id: I4ce8c9bd53164f1be719271e095edc31e2f3ae4b
---
 nova/_values-mvp.yaml                         | 37 +++++++++++++++++++
 ...nova-api-osapi.sh.tpl => _nova-api.sh.tpl} |  0
 nova/templates/bin/_nova-compute.sh.tpl       |  6 ++-
 nova/templates/configmap-bin.yaml             |  4 +-
 nova/templates/daemonset-libvirt.yaml         |  6 +++
 5 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 nova/_values-mvp.yaml
 rename nova/templates/bin/{_nova-api-osapi.sh.tpl => _nova-api.sh.tpl} (100%)

diff --git a/nova/_values-mvp.yaml b/nova/_values-mvp.yaml
new file mode 100644
index 0000000000..d293a70aeb
--- /dev/null
+++ b/nova/_values-mvp.yaml
@@ -0,0 +1,37 @@
+# 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.
+
+images:
+  libvirt: quay.io/stackanetes/stackanetes-nova-libvirt:newton
+
+conf:
+  nova:
+    default:
+      oslo:
+        log:
+          debug: true
+    libvirt:
+      nova:
+        conf:
+          images_type: null
+          images_rbd_pool: null
+          images_rbd_ceph_conf: null
+          rbd_user: null
+          rbd_secret_uuid: null
+          disk_cachemodes: null
+          hw_disk_discard: null
+    upgrade_levels:
+      nova:
+        conf:
+          compute: null
diff --git a/nova/templates/bin/_nova-api-osapi.sh.tpl b/nova/templates/bin/_nova-api.sh.tpl
similarity index 100%
rename from nova/templates/bin/_nova-api-osapi.sh.tpl
rename to nova/templates/bin/_nova-api.sh.tpl
diff --git a/nova/templates/bin/_nova-compute.sh.tpl b/nova/templates/bin/_nova-compute.sh.tpl
index 7e98c10db3..173273d0a0 100644
--- a/nova/templates/bin/_nova-compute.sh.tpl
+++ b/nova/templates/bin/_nova-compute.sh.tpl
@@ -14,6 +14,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set -x
+set -ex
+
+# Make the Nova Instances Dir as this is not autocreated.
+mkdir -p /var/lib/nova/instances
+
 exec nova-compute \
       --config-file /etc/nova/nova.conf
diff --git a/nova/templates/configmap-bin.yaml b/nova/templates/configmap-bin.yaml
index 265348f654..181d29ff6c 100644
--- a/nova/templates/configmap-bin.yaml
+++ b/nova/templates/configmap-bin.yaml
@@ -31,10 +31,10 @@ data:
 {{ tuple "bin/_libvirt.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
   bootstrap.sh: |
 {{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
+  nova-api.sh: |
+{{ tuple "bin/_nova-api.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
   nova-api-metadata.sh: |
 {{ tuple "bin/_nova-api-metadata.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
-  nova-api-osapi.sh: |
-{{ tuple "bin/_nova-api-osapi.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
   nova-compute.sh: |
 {{ tuple "bin/_nova-compute.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
   nova-conductor.sh: |
diff --git a/nova/templates/daemonset-libvirt.yaml b/nova/templates/daemonset-libvirt.yaml
index 50141b9a80..c2e70cc4e0 100644
--- a/nova/templates/daemonset-libvirt.yaml
+++ b/nova/templates/daemonset-libvirt.yaml
@@ -37,6 +37,7 @@ spec:
       securityContext:
         runAsUser: 0
       hostNetwork: true
+      hostPID: true
       dnsPolicy: ClusterFirst
       containers:
         - name: nova-libvirt
@@ -86,6 +87,8 @@ spec:
               mountPath: /var/lib/libvirt
             - name: run
               mountPath: /run
+            - name: dev
+              mountPath: /dev
             - name: cgroup
               mountPath: /sys/fs/cgroup
             {{- if .Values.ceph.enabled }}
@@ -118,6 +121,9 @@ spec:
         - name: run
           hostPath:
             path: /run
+        - name: dev
+          hostPath:
+            path: /dev
         - name: cgroup
           hostPath:
             path: /sys/fs/cgroup