summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0002-salt-formulas-Add-enable-armband-formula.patch
blob: a219e4b5b411cddc1e1d1abb0e0f6afd3d4a80e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2018 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] salt-formulas: Add & enable armband formula

- prereq: install qemu-efi;
- prereq: install vgabios;
- prereq: fix missing link for vgabios binary blob;
- nova patch: Add video type virtio for AArch64 (backport from [1]);
- nova patch: libvirt driver: AArch64: ACPI depends on AAVMF;
- nova patch: force creation of pty device;
- nova conf: cpu_model=cortex-a57 (only for virtual deploys);
- nova conf: virt_type=qemu (only for virtual deploys);
- nova compute conf: virt_type=qemu (only for virtual deploys);
- nova conf: pointer_model=ps2mouse since AArch64 has no USB tablet;

[1] https://github.com/openstack/nova/commit/f0f0953

Signed-off-by: Guillermo Herrero <Guillermo.Herrero@enea.com>
Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 mcp/config/states/openstack_ha                     |   1 +
 mcp/config/states/openstack_noha                   |   2 +
 mcp/config/states/virtual_control_plane            |   1 +
 .../armband/files/nova-libvirt-aarch64-rollup.diff | 165 +++++++++++++++++++++
 mcp/salt-formulas/armband/init.sls                 |   7 +
 mcp/salt-formulas/armband/nova_config.sls          |  35 +++++
 mcp/salt-formulas/armband/nova_libvirt.sls         |   7 +
 mcp/salt-formulas/armband/qemu_efi.sls             |   2 +
 mcp/salt-formulas/armband/vgabios.sls              |   7 +
 9 files changed, 226 insertions(+)
 create mode 100644 mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
 create mode 100644 mcp/salt-formulas/armband/init.sls
 create mode 100644 mcp/salt-formulas/armband/nova_config.sls
 create mode 100644 mcp/salt-formulas/armband/nova_libvirt.sls
 create mode 100644 mcp/salt-formulas/armband/qemu_efi.sls
 create mode 100644 mcp/salt-formulas/armband/vgabios.sls

diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha
index 4f3760f6..115a56c1 100755
--- a/mcp/config/states/openstack_ha
+++ b/mcp/config/states/openstack_ha
@@ -52,6 +52,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
+wait_for 5.0 "salt -I 'nova:compute' state.sls armband"

 salt -C 'I@mongodb:server and *01*' state.sls mongodb || true
 wait_for 10 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'"
diff --git a/mcp/config/states/openstack_noha b/mcp/config/states/openstack_noha
index 4c8cbcf8..1cf54240 100755
--- a/mcp/config/states/openstack_noha
+++ b/mcp/config/states/openstack_noha
@@ -53,6 +53,8 @@ salt -I 'ceilometer:agent' state.sls ceilometer

 salt -I 'horizon:server' state.sls horizon

+salt -I 'nova:compute' state.sls armband
+
 # workaround for the pike horizon is missing css, FUEL-324
 salt -I 'horizon:server' file.symlink \
   /var/lib/openstack-dashboard/static \
diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
index c391cfe6..02a813c9 100755
--- a/mcp/config/states/virtual_control_plane
+++ b/mcp/config/states/virtual_control_plane
@@ -27,6 +27,7 @@ if [ "${ERASE_ENV}" -eq 1 ]; then
 fi

 # KVM libvirt first, VCP deployment
+wait_for 5.0 "salt -C 'kvm*' state.sls armband"
 wait_for 5.0 "salt -C 'kvm*' state.sls libvirt"

 salt -C 'kvm* or cmp*' state.apply salt
diff --git a/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
new file mode 100644
index 00000000..a480a20c
--- /dev/null
+++ b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
@@ -0,0 +1,165 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Thu, 24 Aug 2017 10:57:28 +0200
+Subject: [PATCH] libvirt: AArch64: ACPI depends on AAVMF
+
+On AArch64, ACPI should be added to domain XML only if guest UEFI
+(AAVMF) is also used.
+
+[ Alexandru.Avadanii@enea.com ]
+- pike rebase: minor context adj
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
+
+---
+
+diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
+--- a/nova/virt/libvirt/driver.py
++++ b/nova/virt/libvirt/driver.py
+@@ -4314,7 +4314,10 @@
+
+         if (virt_type not in ("lxc", "uml", "parallels", "xen") or
+                 (virt_type == "xen" and guest.os_type == fields.VMMode.HVM)):
+-            guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI())
++            guestarch = libvirt_utils.get_arch(image_meta)
++            if (guestarch not in (fields.Architecture.ARMV7, fields.Architecture.AARCH64) or
++                image_meta.properties.get('hw_firmware_type') == 'uefi'):
++                    guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI())
+             guest.features.append(vconfig.LibvirtConfigGuestFeatureAPIC())
+
+         if (virt_type in ("qemu", "kvm") and
+--
+
+From f0f09530ee9169eb29bc28d4f118676d7dc6640e Mon Sep 17 00:00:00 2001
+From: Kevin Zhao <kevin.zhao@arm.com>
+Date: Tue, 15 Aug 2017 09:52:09 +0000
+Subject: [PATCH] Add video type virtio for AArch64
+
+Currently only "virtio" type is supported on AArch64, and the
+other "virrus", "qxl" and "vga" don't work on AArch64 according to
+libvirt upstream:
+https://www.redhat.com/archives/libvir-list/2016-September/msg00546.html
+Then this patch adds the virtio for AArch64 and tweaks the related test cases.
+
+Closes-bug: #1710766
+
+[ Alexandru.Avadanii@enea.com ]
+Dropped test changes so it applies cleanly on Newton without more backports.
+
+Change-Id: Iba8a1e671f2b5759b3d9178aa1871d0cf888b26b
+Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+
+--- a/nova/virt/libvirt/driver.py
++++ b/nova/virt/libvirt/driver.py
+@@ -4342,7 +4342,8 @@ def _check_number_of_serial_console(self, num_ports):
+                 allowed=ALLOWED_QEMU_SERIAL_PORTS, virt_type=virt_type)
+
+     def _add_video_driver(self, guest, image_meta, flavor):
+-        VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga", "xen", "qxl")
++        VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga",
++                               "xen", "qxl", "virtio")
+         video = vconfig.LibvirtConfigGuestVideo()
+         # NOTE(ldbragst): The following logic sets the video.type
+         # depending on supported defaults given the architecture,
+@@ -4360,6 +4361,10 @@ def _add_video_driver(self, guest, image_meta, flavor):
+             # NOTE(ldbragst): PowerKVM doesn't support 'cirrus' be default
+             # so use 'vga' instead when running on Power hardware.
+             video.type = 'vga'
++        elif guestarch in (fields.Architecture.AARCH64):
++            # NOTE(kevinz): Only virtio device type is supported by AARCH64
++            # so use 'virtio' instead when running on AArch64 hardware.
++            video.type = 'virtio'
+         elif CONF.spice.enabled:
+             video.type = 'qxl'
+         if image_meta.properties.get('hw_video_model'):
+---
+
+From ac6d3cd85ffe94115f15134406ba0d366e938764 Mon Sep 17 00:00:00 2001
+From: Charalampos Kominos <Charalampos.Kominos@enea.com>
+Date: Tue, 13 Mar 2018 17:02:56 +0100
+Subject: [PATCH] Allow nova to create a pty device for aarch64VM
+
+Armband relies on Ubuntu Xenial and UCA Pike packages. The Nova package in UCA
+explicitly disables AArch64 serial console access by removing the second pty
+device due to libvirt/QEMU limitations in the Xenial release / UCA Pike.
+Since Armband provides newer versions for the core virtualization packages,
+we can safely bring back the serial console in Nova.
+
+JIRA: ARMBAND-352
+
+Signed-off-by: Charalampos Kominos <charalampos.kominos@enea.com>
+---
+
+--- a/nova/virt/libvirt/driver.py
++++ b/nova/virt/libvirt/driver.py
+@@ -4666,13 +4666,11 @@
+                   self._is_s390x_guest(image_meta)):
+             self._create_consoles_s390x(guest_cfg, instance,
+                                         flavor, image_meta)
+-        elif (virt_type in ("qemu", "kvm") and
+-                  self._is_arm_guest(image_meta)):
+-            # NOTE(jamespage): libvirt 2.5.0 as shipped in Ubuntu zesty
+-            #                  and the Pike UCA needs to be configured
+-            #                  for compatibility on arm64.
+-            self._create_consoles_arm(guest_cfg, instance,
+-                                      flavor, image_meta)
++
++        #ARMband: Canonical applies a patch to align with libvirt 2.5.0 in UCA repos
++        #         which removes the console on aarch64. Since ARMband uses a newer
++        #         libvirt version we can safely revert that change.
++
+         elif virt_type in ("qemu", "kvm"):
+             self._create_consoles_qemu_kvm(guest_cfg, instance,
+                                         flavor, image_meta)
+@@ -4681,12 +4679,6 @@
+         s390x_archs = (fields.Architecture.S390, fields.Architecture.S390X)
+         return libvirt_utils.get_arch(image_meta) in s390x_archs
+
+-    def _is_arm_guest(self, image_meta):
+-        arm_archs = (fields.Architecture.AARCH64,
+-                     fields.Architecture.ARMV7B,
+-                     fields.Architecture.ARMV7)
+-        return libvirt_utils.get_arch(image_meta) in arm_archs
+-
+     def _create_consoles_qemu_kvm(self, guest_cfg, instance, flavor,
+                                   image_meta):
+         char_dev_cls = vconfig.LibvirtConfigGuestSerial
+@@ -4716,25 +4708,6 @@
+                                     "sclplm")
+        self._create_pty_device(guest_cfg, char_dev_cls, "sclp", log_path)
+
+-    def _create_consoles_arm(self, guest_cfg, instance, flavor, image_meta):
+-        char_dev_cls = vconfig.LibvirtConfigGuestConsole
+-        log_path = self._get_console_log_path(instance)
+-        if CONF.serial_console.enabled:
+-            if not self._serial_ports_already_defined(instance):
+-                num_ports = hardware.get_number_of_serial_ports(flavor,
+-                                                                image_meta)
+-                self._check_number_of_serial_console(num_ports)
+-                self._create_serial_consoles(guest_cfg, num_ports,
+-                                             char_dev_cls, log_path)
+-        else:
+-            # NOTE(jamespage): Force creation of file device for compatibility
+-            #                  with aarch64 + libvirt 2.5.0
+-            self._create_file_device(guest_cfg, instance, char_dev_cls,
+-                                     force=True)
+-        # NOTE(jamespage): Skip creation of pty devices; they only work with
+-        #                  the virtio driver which does not capture early
+-        #                  boot on aarch64
+-
+     def _create_pty_device(self, guest_cfg, char_dev_cls, target_type=None,
+                            log_path=None):
+         def _create_base_dev():
+@@ -4772,8 +4745,8 @@
+                guest_cfg.add_device(_create_base_dev())
+
+     def _create_file_device(self, guest_cfg, instance, char_dev_cls,
+-                            target_type=None, force=False):
+-        if self._is_virtlogd_available() and not force:
++                            target_type=None):
++        if self._is_virtlogd_available():
+             return
+
+         consolelog = char_dev_cls()
diff --git a/mcp/salt-formulas/armband/init.sls b/mcp/salt-formulas/armband/init.sls
new file mode 100644
index 00000000..8a8cf2ab
--- /dev/null
+++ b/mcp/salt-formulas/armband/init.sls
@@ -0,0 +1,7 @@
+include:
+ - armband.qemu_efi
+ - armband.vgabios
+ {%- if salt['pkg.version']('python-nova') %}
+ - armband.nova_libvirt
+ - armband.nova_config
+ {%- endif %}
diff --git a/mcp/salt-formulas/armband/nova_config.sls b/mcp/salt-formulas/armband/nova_config.sls
new file mode 100644
index 00000000..31fa031a
--- /dev/null
+++ b/mcp/salt-formulas/armband/nova_config.sls
@@ -0,0 +1,35 @@
+{% if grains['virtual'] == 'kvm' %}
+nova_virt_type:
+  file.replace:
+    - name: "/etc/nova/nova.conf"
+    - pattern: '^virt_type\s*=.*$'
+    - repl: "virt_type = qemu"
+nova_compute_virt_type:
+  file.replace:
+    - name: "/etc/nova/nova-compute.conf"
+    - pattern: '^virt_type\s*=.*$'
+    - repl: "virt_type = qemu"
+{% endif %}
+nova_pointer_model:
+  file.replace:
+    - name: "/etc/nova/nova.conf"
+    - pattern: '^#pointer_model\s*=.*$'
+    - repl: "pointer_model = ps2mouse"
+nova_cpu_mode:
+  file.replace:
+    - name: "/etc/nova/nova.conf"
+    - pattern:  '^cpu_mode\s*=\s*host-passthrough'
+    - repl: "cpu_mode = custom"
+nova_cpu_model:
+  file.replace:
+    - name: "/etc/nova/nova.conf"
+    - pattern: '^#cpu_model\s*=.*$'
+    {% if grains['virtual'] == 'kvm' %}
+    - repl: "cpu_model = cortex-a57"
+    {% else %}
+    - repl: "cpu_model = host"
+    {% endif %}
+restart_nova-compute:
+  cmd:
+    - run
+    - name: "service nova-compute restart"
diff --git a/mcp/salt-formulas/armband/nova_libvirt.sls b/mcp/salt-formulas/armband/nova_libvirt.sls
new file mode 100644
index 00000000..bc2cbda9
--- /dev/null
+++ b/mcp/salt-formulas/armband/nova_libvirt.sls
@@ -0,0 +1,7 @@
+nova-libvirt-aarch64-rollup:
+  file.patch:
+  - name: /usr/lib/python2.7/dist-packages
+  - source: salt://armband/files/nova-libvirt-aarch64-rollup.diff
+  - hash: False
+  - options: '-p1'
+  - 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 /var/cache/salt/minion/files/base/armband/files/nova-libvirt-aarch64-rollup.diff'
diff --git a/mcp/salt-formulas/armband/qemu_efi.sls b/mcp/salt-formulas/armband/qemu_efi.sls
new file mode 100644
index 00000000..c697dae9
--- /dev/null
+++ b/mcp/salt-formulas/armband/qemu_efi.sls
@@ -0,0 +1,2 @@
+qemu-efi:
+  pkg.installed
diff --git a/mcp/salt-formulas/armband/vgabios.sls b/mcp/salt-formulas/armband/vgabios.sls
new file mode 100644
index 00000000..500c2bcf
--- /dev/null
+++ b/mcp/salt-formulas/armband/vgabios.sls
@@ -0,0 +1,7 @@
+vgabios:
+  pkg.installed
+/usr/share/qemu:
+  file.directory
+/usr/share/qemu/vgabios-stdvga.bin:
+  file.symlink:
+    - target: "/usr/share/vgabios/vgabios.bin"