1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Enea AB and others.
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
13 - prereq: install qemu-efi;
14 - prereq: install vgabios;
15 - prereq: fix missing link for vgabios binary blob;
16 - nova patch: Add video type virtio for AArch64 (backport from [1]);
17 - nova patch: libvirt driver: AArch64: ACPI depends on AAVMF;
18 - nova conf: cpu_model=cortex-a57 (only for virtual deploys);
19 - nova conf: virt_type=qemu (only for virtual deploys);
20 - nova compute conf: virt_type=qemu (only for virtual deploys);
21 - nova conf: pointer_model=ps2mouse since AArch64 has no USB tablet;
23 [1] https://github.com/openstack/nova/commit/f0f0953
25 Signed-off-by: Guillermo Herrero <Guillermo.Herrero@enea.com>
26 Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
27 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
29 mcp/config/states/openstack_ha | 1 +
30 mcp/config/states/openstack_noha | 2 +
31 mcp/config/states/virtual_control_plane | 1 +
32 .../files/nova-libvirt-aarch64-rollup.diff | 106 ++++++++++++++++++
33 mcp/salt-formulas/armband/init.sls | 7 ++
34 mcp/salt-formulas/armband/nova_config.sls | 35 ++++++
35 mcp/salt-formulas/armband/nova_libvirt.sls | 7 ++
36 mcp/salt-formulas/armband/qemu_efi.sls | 2 +
37 mcp/salt-formulas/armband/vgabios.sls | 7 ++
38 9 files changed, 168 insertions(+)
39 create mode 100644 mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
40 create mode 100644 mcp/salt-formulas/armband/init.sls
41 create mode 100644 mcp/salt-formulas/armband/nova_config.sls
42 create mode 100644 mcp/salt-formulas/armband/nova_libvirt.sls
43 create mode 100644 mcp/salt-formulas/armband/qemu_efi.sls
44 create mode 100644 mcp/salt-formulas/armband/vgabios.sls
46 diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha
47 index 73c44bb6..4ac5d6d5 100755
48 --- a/mcp/config/states/openstack_ha
49 +++ b/mcp/config/states/openstack_ha
50 @@ -52,6 +52,7 @@ salt -I 'neutron:server' state.sls neutron -b 1
51 salt -I 'neutron:gateway' state.sls neutron.gateway
53 salt -I 'nova:compute' state.sls nova
54 +wait_for 5.0 "salt -I 'nova:compute' state.sls armband"
56 salt -I 'redis:cluster:role:master' state.sls redis
57 salt -I 'redis:server' state.sls redis
58 diff --git a/mcp/config/states/openstack_noha b/mcp/config/states/openstack_noha
59 index 70db238b..52d643df 100755
60 --- a/mcp/config/states/openstack_noha
61 +++ b/mcp/config/states/openstack_noha
62 @@ -54,3 +54,5 @@ salt -I 'ceilometer:server' state.sls ceilometer
63 salt -I 'ceilometer:agent' state.sls ceilometer
65 salt -I 'horizon:server' state.sls horizon
67 +salt -I 'nova:compute' state.sls armband
68 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
69 index c391cfe6..02a813c9 100755
70 --- a/mcp/config/states/virtual_control_plane
71 +++ b/mcp/config/states/virtual_control_plane
72 @@ -27,6 +27,7 @@ if [ "${ERASE_ENV}" -eq 1 ]; then
75 # KVM libvirt first, VCP deployment
76 +wait_for 5.0 "salt -C 'kvm*' state.sls armband"
77 wait_for 5.0 "salt -C 'kvm*' state.sls libvirt"
79 salt -C 'kvm* or cmp*' state.apply salt
80 diff --git a/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
82 index 00000000..c987a4ce
84 +++ b/mcp/salt-formulas/armband/files/nova-libvirt-aarch64-rollup.diff
86 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
87 +Date: Thu, 24 Aug 2017 10:57:28 +0200
88 +Subject: [PATCH] libvirt: AArch64: ACPI depends on AAVMF
90 +On AArch64, ACPI should be added to domain XML only if guest UEFI
91 +(AAVMF) is also used.
93 +[ Alexandru.Avadanii@enea.com ]
94 +- pike rebase: minor context adj
96 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
97 +Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
101 +diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
102 +--- a/nova/virt/libvirt/driver.py
103 ++++ b/nova/virt/libvirt/driver.py
104 +@@ -4314,7 +4314,10 @@
106 + if (virt_type not in ("lxc", "uml", "parallels", "xen") or
107 + (virt_type == "xen" and guest.os_type == fields.VMMode.HVM)):
108 +- guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI())
109 ++ guestarch = libvirt_utils.get_arch(image_meta)
110 ++ if (guestarch not in (fields.Architecture.ARMV7, fields.Architecture.AARCH64) or
111 ++ image_meta.properties.get('hw_firmware_type') == 'uefi'):
112 ++ guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI())
113 + guest.features.append(vconfig.LibvirtConfigGuestFeatureAPIC())
115 + if (virt_type in ("qemu", "kvm") and
118 +From f0f09530ee9169eb29bc28d4f118676d7dc6640e Mon Sep 17 00:00:00 2001
119 +From: Kevin Zhao <kevin.zhao@arm.com>
120 +Date: Tue, 15 Aug 2017 09:52:09 +0000
121 +Subject: [PATCH] Add video type virtio for AArch64
123 +Currently only "virtio" type is supported on AArch64, and the
124 +other "virrus", "qxl" and "vga" don't work on AArch64 according to
126 +https://www.redhat.com/archives/libvir-list/2016-September/msg00546.html
127 +Then this patch adds the virtio for AArch64 and tweaks the related test cases.
129 +Closes-bug: #1710766
131 +[ Alexandru.Avadanii@enea.com ]
132 +Dropped test changes so it applies cleanly on Newton without more backports.
134 +Change-Id: Iba8a1e671f2b5759b3d9178aa1871d0cf888b26b
135 +Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
136 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
139 +--- a/nova/virt/libvirt/driver.py
140 ++++ b/nova/virt/libvirt/driver.py
141 +@@ -4342,7 +4342,8 @@ def _check_number_of_serial_console(self, num_ports):
142 + allowed=ALLOWED_QEMU_SERIAL_PORTS, virt_type=virt_type)
144 + def _add_video_driver(self, guest, image_meta, flavor):
145 +- VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga", "xen", "qxl")
146 ++ VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga",
147 ++ "xen", "qxl", "virtio")
148 + video = vconfig.LibvirtConfigGuestVideo()
149 + # NOTE(ldbragst): The following logic sets the video.type
150 + # depending on supported defaults given the architecture,
151 +@@ -4360,6 +4361,10 @@ def _add_video_driver(self, guest, image_meta, flavor):
152 + # NOTE(ldbragst): PowerKVM doesn't support 'cirrus' be default
153 + # so use 'vga' instead when running on Power hardware.
155 ++ elif guestarch in (fields.Architecture.AARCH64):
156 ++ # NOTE(kevinz): Only virtio device type is supported by AARCH64
157 ++ # so use 'virtio' instead when running on AArch64 hardware.
158 ++ video.type = 'virtio'
159 + elif CONF.spice.enabled:
161 + if image_meta.properties.get('hw_video_model'):
164 +From dbd4c20de002784a4ffc07b173e82dd84a3af01c Mon Sep 17 00:00:00 2001
165 +From: Charalampos Kominos <Charalampos.Kominos@enea.com>
166 +Date: Wed, 2 May 2018 14:20:47 +0200
167 +Subject: [PATCH] Allow libvirt to honor root device naming
169 +Current behaviour in upstream nova is for rootfs to be in /dev/vda
170 +which is the default behaviour when using virtio driver. However when
171 +other devices are requested either by glance or by CLI, nova ignores
172 +that naming and still tries to attach to vda which fails.
174 +Manually applied in https://review.openstack.org/#/c/214314/
178 +Signed-off-by: Charalampos Kominos <charalampos.kominos@enea.com>
181 +--- a/nova/virt/libvirt/driver.py
182 ++++ b/nova/virt/libvirt/driver.py
183 +@@ -8257,6 +8257,8 @@
184 + "Ignoring supplied device name: %(device_name)s. "
185 + "Libvirt can't honour user-supplied dev names",
186 + {'device_name': bdm.device_name}, instance=instance)
187 ++ if instance.root_device_name == bdm.device_name:
188 ++ instance.root_device_name = None
189 + bdm.device_name = None
190 + block_device_info = driver.get_block_device_info(instance,
191 + block_device_mapping)
192 diff --git a/mcp/salt-formulas/armband/init.sls b/mcp/salt-formulas/armband/init.sls
194 index 00000000..8a8cf2ab
196 +++ b/mcp/salt-formulas/armband/init.sls
201 + {%- if salt['pkg.version']('python-nova') %}
202 + - armband.nova_libvirt
203 + - armband.nova_config
205 diff --git a/mcp/salt-formulas/armband/nova_config.sls b/mcp/salt-formulas/armband/nova_config.sls
207 index 00000000..31fa031a
209 +++ b/mcp/salt-formulas/armband/nova_config.sls
211 +{% if grains['virtual'] == 'kvm' %}
214 + - name: "/etc/nova/nova.conf"
215 + - pattern: '^virt_type\s*=.*$'
216 + - repl: "virt_type = qemu"
217 +nova_compute_virt_type:
219 + - name: "/etc/nova/nova-compute.conf"
220 + - pattern: '^virt_type\s*=.*$'
221 + - repl: "virt_type = qemu"
225 + - name: "/etc/nova/nova.conf"
226 + - pattern: '^#pointer_model\s*=.*$'
227 + - repl: "pointer_model = ps2mouse"
230 + - name: "/etc/nova/nova.conf"
231 + - pattern: '^cpu_mode\s*=\s*host-passthrough'
232 + - repl: "cpu_mode = custom"
235 + - name: "/etc/nova/nova.conf"
236 + - pattern: '^#cpu_model\s*=.*$'
237 + {% if grains['virtual'] == 'kvm' %}
238 + - repl: "cpu_model = cortex-a57"
240 + - repl: "cpu_model = host"
242 +restart_nova-compute:
245 + - name: "service nova-compute restart"
246 diff --git a/mcp/salt-formulas/armband/nova_libvirt.sls b/mcp/salt-formulas/armband/nova_libvirt.sls
248 index 00000000..ff93db80
250 +++ b/mcp/salt-formulas/armband/nova_libvirt.sls
252 +nova-libvirt-aarch64-rollup:
254 + - name: /usr/lib/python2.7/dist-packages
255 + - source: salt://armband/files/nova-libvirt-aarch64-rollup.diff
258 + - 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'
259 diff --git a/mcp/salt-formulas/armband/qemu_efi.sls b/mcp/salt-formulas/armband/qemu_efi.sls
261 index 00000000..c697dae9
263 +++ b/mcp/salt-formulas/armband/qemu_efi.sls
267 diff --git a/mcp/salt-formulas/armband/vgabios.sls b/mcp/salt-formulas/armband/vgabios.sls
269 index 00000000..500c2bcf
271 +++ b/mcp/salt-formulas/armband/vgabios.sls
277 +/usr/share/qemu/vgabios-stdvga.bin:
279 + - target: "/usr/share/vgabios/vgabios.bin"