+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2017 Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
From: Guillermo Herrero <Guillermo.Herrero@enea.com>
Date: Tue, 25 Jul 2017 00:58:32 +0200
Subject: [PATCH] mcp: salt-formulas: Add & enable armband formula
---
mcp/config/states/maas | 1 +
mcp/config/states/openstack | 2 +
+ mcp/config/states/openstack_ha | 1 +
.../armband/files/nova-libvirt-driver.diff | 48 ++++++++++++++++++++++
mcp/salt-formulas/armband/init.sls | 6 +++
mcp/salt-formulas/armband/libvirt_driver.sls | 5 +++
- mcp/salt-formulas/armband/nova.sls | 34 +++++++++++++++
+ mcp/salt-formulas/armband/nova.sls | 30 ++++++++++++++
mcp/salt-formulas/armband/qemu.sls | 7 ++++
mcp/salt-formulas/armband/vgabios.sls | 6 +++
- 8 files changed, 109 insertions(+)
+ 9 files changed, 106 insertions(+)
create mode 100644 mcp/salt-formulas/armband/files/nova-libvirt-driver.diff
create mode 100644 mcp/salt-formulas/armband/init.sls
create mode 100644 mcp/salt-formulas/armband/libvirt_driver.sls
create mode 100644 mcp/salt-formulas/armband/vgabios.sls
diff --git a/mcp/config/states/maas b/mcp/config/states/maas
-index 31625d8..1e14e5f 100755
+index 01f8ee0..2dd62f9 100755
--- a/mcp/config/states/maas
+++ b/mcp/config/states/maas
-@@ -81,6 +81,7 @@ wait_for 90 "! salt '*' test.ping | tee /dev/stderr | fgrep -q 'Not connected'"
+@@ -81,6 +81,7 @@ wait_for 90 "! salt 'kvm*' test.ping | tee /dev/stderr | fgrep -q 'Not connected
salt -C '* and not cfg01* and not mas01*' state.apply linux,ntp
salt -C '* and not cfg01* and not mas01*' state.apply salt
diff --git a/mcp/config/states/openstack b/mcp/config/states/openstack
-index 5ded58c..270bf35 100755
+index eaab135..050b648 100755
--- a/mcp/config/states/openstack
+++ b/mcp/config/states/openstack
-@@ -26,3 +26,5 @@ salt -I 'neutron:gateway' state.sls neutron
- salt -I 'nova:compute' state.sls nova
+@@ -31,3 +31,5 @@ salt -I 'ceilometer:server' state.sls ceilometer
+ salt -I 'ceilometer:agent' state.sls ceilometer
salt -I 'horizon:server' state.sls horizon
+
+salt -I 'nova:compute' state.sls armband
+diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha
+index cc4279c..32b581f 100755
+--- a/mcp/config/states/openstack_ha
++++ b/mcp/config/states/openstack_ha
+@@ -41,6 +41,7 @@ salt -I 'neutron:server' state.sls neutron -b 1
+ salt -I 'neutron:gateway' state.sls neutron.gateway
+
+ salt -I 'nova:compute' state.sls nova
++salt -I 'nova:compute' state.sls armband
+
+ salt -I 'horizon:server' state.sls horizon
+ salt -I 'nginx:server' state.sls nginx
diff --git a/mcp/salt-formulas/armband/files/nova-libvirt-driver.diff b/mcp/salt-formulas/armband/files/nova-libvirt-driver.diff
new file mode 100644
index 0000000..a5b08da
+
diff --git a/mcp/salt-formulas/armband/nova.sls b/mcp/salt-formulas/armband/nova.sls
new file mode 100644
-index 0000000..ade8c7a
+index 0000000..674f371
--- /dev/null
+++ b/mcp/salt-formulas/armband/nova.sls
-@@ -0,0 +1,34 @@
+@@ -0,0 +1,30 @@
+{% if grains['virtual'] == 'kvm' %}
+nova_virt_type:
+ file.replace:
+ - name: "/etc/nova/nova.conf"
-+ - pattern: ^virt_type =.*$
++ - pattern: '^virt_type\s*=.*$'
+ - repl: "virt_type = qemu"
+{% endif %}
-+
+nova_pointer_model:
+ file.replace:
+ - name: "/etc/nova/nova.conf"
-+ - pattern: ^#pointer_model=.*$
-+ - repl: "pointer_model=ps2mouse"
-+
++ - pattern: '^#pointer_model\s*=.*$'
++ - repl: "pointer_model = ps2mouse"
+nova_cpu_mode:
+ file.replace:
+ - name: "/etc/nova/nova.conf"
-+ - pattern: "^cpu_mode = host-passthrough"
-+ - repl: "cpu_mode=custom"
-+
++ - pattern: '^cpu_mode\s*=\s*host-passthrough'
++ - repl: "cpu_mode = custom"
+nova_cpu_model:
+ file.replace:
+ - name: "/etc/nova/nova.conf"
-+ - pattern: ^#cpu_model=.*$
++ - pattern: '^#cpu_model\s*=.*$'
+ {% if grains['virtual'] == 'kvm' %}
-+ - repl: "cpu_model=cortex-a57"
++ - repl: "cpu_model = cortex-a57"
+ {% else %}
-+ - repl: "cpu_model=host"
++ - repl: "cpu_model = host"
+ {% endif %}
-+
+restart_nova-compute:
+ cmd:
+ - run