u/fuel: Bump & rebase for _orchestration.conf fix
[armband.git] / patches / opnfv-fuel / 0001-salt-formulas-Add-enable-armband-formula.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Guillermo Herrero <Guillermo.Herrero@enea.com>
10 Date: Tue, 25 Jul 2017 00:58:32 +0200
11 Subject: [PATCH] salt-formulas: Add & enable armband formula
12
13 - prereq: install qemu-efi;
14 - prereq: install vgabios;
15 - prereq: fix missing link for vgabios binary blob;
16 - nova conf: cpu_model=cortex-a57 (only for virtual deploys);
17 - nova conf: virt_type=qemu (only for virtual deploys);
18 - nova compute conf: virt_type=qemu (only for virtual deploys);
19 - nova conf: pointer_model=ps2mouse since AArch64 has no USB tablet;
20
21 [1] https://github.com/openstack/nova/commit/f0f0953
22
23 Signed-off-by: Guillermo Herrero <Guillermo.Herrero@enea.com>
24 Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
25 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
26 ---
27  mcp/config/states/openstack_ha                |  1 +
28  mcp/config/states/openstack_noha              |  2 ++
29  mcp/config/states/virtual_control_plane       |  1 +
30  .../files/nova-libvirt-aarch64-rollup.diff    | 27 ++++++++++++++
31  mcp/salt-formulas/armband/init.sls            |  7 ++++
32  mcp/salt-formulas/armband/nova_config.sls     | 35 +++++++++++++++++++
33  mcp/salt-formulas/armband/nova_libvirt.sls    |  7 ++++
34  mcp/salt-formulas/armband/qemu_efi.sls        |  2 ++
35  mcp/salt-formulas/armband/vgabios.sls         |  7 ++++
36  9 files changed, 89 insertions(+)
37  create mode 100644 mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
38  create mode 100644 mcp/salt-formulas/armband/init.sls
39  create mode 100644 mcp/salt-formulas/armband/nova_config.sls
40  create mode 100644 mcp/salt-formulas/armband/nova_libvirt.sls
41  create mode 100644 mcp/salt-formulas/armband/qemu_efi.sls
42  create mode 100644 mcp/salt-formulas/armband/vgabios.sls
43
44 diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha
45 index 73c44bb6..4ac5d6d5 100755
46 --- a/mcp/config/states/openstack_ha
47 +++ b/mcp/config/states/openstack_ha
48 @@ -52,6 +52,7 @@ salt -I 'neutron:server' state.sls neutron -b 1
49  salt -I 'neutron:gateway' state.sls neutron.gateway
50
51  salt -I 'nova:compute' state.sls nova
52 +wait_for 5.0 "salt -I 'nova:compute' state.sls armband"
53
54  salt -I 'redis:cluster:role:master' state.sls redis
55  salt -I 'redis:server' state.sls redis
56 diff --git a/mcp/config/states/openstack_noha b/mcp/config/states/openstack_noha
57 index 70db238b..52d643df 100755
58 --- a/mcp/config/states/openstack_noha
59 +++ b/mcp/config/states/openstack_noha
60 @@ -54,3 +54,5 @@ salt -I 'ceilometer:server' state.sls ceilometer
61  salt -I 'ceilometer:agent' state.sls ceilometer
62
63  salt -I 'horizon:server' state.sls horizon
64 +
65 +salt -I 'nova:compute' state.sls armband
66 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
67 index 8105b266..cc227a97 100755
68 --- a/mcp/config/states/virtual_control_plane
69 +++ b/mcp/config/states/virtual_control_plane
70 @@ -27,6 +27,7 @@ if [ "${ERASE_ENV}" -eq 1 ]; then
71  fi
72
73  # KVM libvirt first, VCP deployment
74 +wait_for 5.0 "salt -C 'kvm*' state.sls armband"
75  wait_for 5.0 "salt -C 'kvm*' state.sls libvirt"
76
77  salt -C 'kvm* or cmp*' state.apply salt
78 diff --git a/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
79 new file mode 100644
80 index 00000000..1ecbf297
81 --- /dev/null
82 +++ b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
83 @@ -0,0 +1,27 @@
84 +From: Charalampos Kominos <Charalampos.Kominos@enea.com>
85 +Date: Wed, 2 May 2018 14:20:47 +0200
86 +Subject: [PATCH] Allow libvirt to honor root device naming
87 +
88 +Current behaviour in upstream nova is for rootfs to be in /dev/vda
89 +which is the default behaviour when using virtio driver. However when
90 +other devices are requested either by glance or by CLI, nova ignores
91 +that naming and still tries to attach to vda which fails.
92 +
93 +Manually applied in https://review.openstack.org/#/c/214314/
94 +
95 +JIRA: ARMBAND-376
96 +
97 +Signed-off-by: Charalampos Kominos <charalampos.kominos@enea.com>
98 +---
99 +
100 +--- a/nova/virt/libvirt/driver.py
101 ++++ b/nova/virt/libvirt/driver.py
102 +@@ -8257,6 +8257,8 @@
103 +                     "Ignoring supplied device name: %(device_name)s. "
104 +                     "Libvirt can't honour user-supplied dev names",
105 +                     {'device_name': bdm.device_name}, instance=instance)
106 ++                if instance.root_device_name == bdm.device_name:
107 ++                   instance.root_device_name = None
108 +                 bdm.device_name = None
109 +         block_device_info = driver.get_block_device_info(instance,
110 +                                                          block_device_mapping)
111 diff --git a/mcp/salt-formulas/armband/init.sls b/mcp/salt-formulas/armband/init.sls
112 new file mode 100644
113 index 00000000..8a8cf2ab
114 --- /dev/null
115 +++ b/mcp/salt-formulas/armband/init.sls
116 @@ -0,0 +1,7 @@
117 +include:
118 + - armband.qemu_efi
119 + - armband.vgabios
120 + {%- if salt['pkg.version']('python-nova') %}
121 + - armband.nova_libvirt
122 + - armband.nova_config
123 + {%- endif %}
124 diff --git a/mcp/salt-formulas/armband/nova_config.sls b/mcp/salt-formulas/armband/nova_config.sls
125 new file mode 100644
126 index 00000000..31fa031a
127 --- /dev/null
128 +++ b/mcp/salt-formulas/armband/nova_config.sls
129 @@ -0,0 +1,35 @@
130 +{% if grains['virtual'] == 'kvm' %}
131 +nova_virt_type:
132 +  file.replace:
133 +    - name: "/etc/nova/nova.conf"
134 +    - pattern: '^virt_type\s*=.*$'
135 +    - repl: "virt_type = qemu"
136 +nova_compute_virt_type:
137 +  file.replace:
138 +    - name: "/etc/nova/nova-compute.conf"
139 +    - pattern: '^virt_type\s*=.*$'
140 +    - repl: "virt_type = qemu"
141 +{% endif %}
142 +nova_pointer_model:
143 +  file.replace:
144 +    - name: "/etc/nova/nova.conf"
145 +    - pattern: '^#pointer_model\s*=.*$'
146 +    - repl: "pointer_model = ps2mouse"
147 +nova_cpu_mode:
148 +  file.replace:
149 +    - name: "/etc/nova/nova.conf"
150 +    - pattern:  '^cpu_mode\s*=\s*host-passthrough'
151 +    - repl: "cpu_mode = custom"
152 +nova_cpu_model:
153 +  file.replace:
154 +    - name: "/etc/nova/nova.conf"
155 +    - pattern: '^#cpu_model\s*=.*$'
156 +    {% if grains['virtual'] == 'kvm' %}
157 +    - repl: "cpu_model = cortex-a57"
158 +    {% else %}
159 +    - repl: "cpu_model = host"
160 +    {% endif %}
161 +restart_nova-compute:
162 +  cmd:
163 +    - run
164 +    - name: "service nova-compute restart"
165 diff --git a/mcp/salt-formulas/armband/nova_libvirt.sls b/mcp/salt-formulas/armband/nova_libvirt.sls
166 new file mode 100644
167 index 00000000..ff93db80
168 --- /dev/null
169 +++ b/mcp/salt-formulas/armband/nova_libvirt.sls
170 @@ -0,0 +1,7 @@
171 +nova-libvirt-aarch64-rollup:
172 +  file.patch:
173 +  - name: /usr/lib/python2.7/dist-packages
174 +  - source: salt://armband/files/nova-libvirt-aarch64-rollup.diff
175 +  - hash: False
176 +  - options: '-p1'
177 +  - unless: 'test -f /var/cache/salt/minion/files/base/armband/files/nova-libvirt-aarch64-rollup.diff && cd /usr/lib/python2.7/dist-packages && patch -p1 -R --dry-run -r - < /var/cache/salt/minion/files/base/armband/files/nova-libvirt-aarch64-rollup.diff'
178 diff --git a/mcp/salt-formulas/armband/qemu_efi.sls b/mcp/salt-formulas/armband/qemu_efi.sls
179 new file mode 100644
180 index 00000000..c697dae9
181 --- /dev/null
182 +++ b/mcp/salt-formulas/armband/qemu_efi.sls
183 @@ -0,0 +1,2 @@
184 +qemu-efi:
185 +  pkg.installed
186 diff --git a/mcp/salt-formulas/armband/vgabios.sls b/mcp/salt-formulas/armband/vgabios.sls
187 new file mode 100644
188 index 00000000..500c2bcf
189 --- /dev/null
190 +++ b/mcp/salt-formulas/armband/vgabios.sls
191 @@ -0,0 +1,7 @@
192 +vgabios:
193 +  pkg.installed
194 +/usr/share/qemu:
195 +  file.directory
196 +/usr/share/qemu/vgabios-stdvga.bin:
197 +  file.symlink:
198 +    - target: "/usr/share/vgabios/vgabios.bin"