aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0015-virtng.py-virt.sls-Extend-libvirt_domain.patch
blob: b44bb17499d26b1445fdd1a08d289b67e09c752d (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
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Mon, 21 Aug 2017 01:10:16 +0200
Subject: [PATCH] virtng.py, virt.sls: Extend libvirt_domain

Extend _modules/virtng.py, salt/control/virt.sls with support for:
- hw_firmware_type;
- virt_machine_model;
- cpu_model;

This functionality relies on the corresponding changes to be
implemented in libvirt_domain.jinja template.

These will later be leveraged via our reclass model with AArch64
specific values.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 .../0103-virtng-module-Extend-libvirt_domain.patch | 54 ++++++++++++++++++++++
 ...4-salt-control-virt-Extend-libvirt_domain.patch | 51 ++++++++++++++++++++
 mcp/patches/patches.list                           |  2 +
 .../baremetal-mcp-ocata-odl-ha/infra/kvm.yml       | 15 ++++++
 .../baremetal-mcp-ocata-ovs-ha/infra/kvm.yml       | 15 ++++++
 5 files changed, 137 insertions(+)
 create mode 100644 mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
 create mode 100644 mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch

diff --git a/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch b/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
new file mode 100644
index 0000000..706b67d
--- /dev/null
+++ b/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
@@ -0,0 +1,54 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 21 Aug 2017 02:03:01 +0200
+Subject: [PATCH] virtng: module: Extend libvirt_domain
+
+Extend virtng.py with support for passing down new params:
+- hw_firmware_type;
+- virt_machine_model;
+- cpu_model;
+
+This functionality relies on the corresponding changes to be
+implemented in libvirt_domain.jinja template.
+
+These will later be leveraged via salt virt formula with AArch64
+specific values.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+
+diff --git a/_modules/virtng.py b/_modules/virtng.py
+--- a/_modules/virtng.py
++++ b/_modules/virtng.py
+@@ -56,6 +56,10 @@
+
+ VIRT_DEFAULT_HYPER = 'kvm'
+
++DEFAULT_UEFI_LOADER_PATH = {
++    "x86_64": "/usr/share/OVMF/OVMF_CODE.fd",
++    "aarch64": "/usr/share/AAVMF/AAVMF_CODE.fd"
++}
+
+ def __virtual__():
+     if not HAS_ALL_IMPORTS:
+@@ -227,6 +231,21 @@
+         # TODO: make bus and model parameterized, this works for 64-bit Linux
+         context['controller_model'] = 'lsilogic'
+
++    # TODO: limit cpu_model, hw_firmware_type, virt_machine_type to qemu/kvm
++    # FIXME: parametrize hardcoded path for NVRAM storage
++    if 'hw_firmware_type' in kwargs and kwargs['hw_firmware_type'] == 'uefi':
++        context['os_loader_type'] = 'pflash'
++        context['os_loader'] = DEFAULT_UEFI_LOADER_PATH[os.uname()[-1]]
++        context['os_loader_nvram'] = '/var/lib/libvirt/qemu/nvram/{0}_VARS.fd'.format(name)
++
++    if 'virt_machine_model' in kwargs:
++        context['custom_virt_machine'] = True
++        context['virt_machine_model'] = kwargs['virt_machine_model']
++
++    if 'cpu_model' in kwargs:
++        context['cpu_mode'] = 'custom'
++        context['cpu_model'] = kwargs['cpu_model']
++
+     if 'boot_dev' in kwargs:
+         context['boot_dev'] = []
+         for dev in kwargs['boot_dev'].split():
diff --git a/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch b/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch
new file mode 100644
index 0000000..a9fe11b
--- /dev/null
+++ b/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch
@@ -0,0 +1,51 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 21 Aug 2017 02:03:01 +0200
+Subject: [PATCH] salt: control: virt: Extend libvirt_domain
+
+Extend salt/control/virt.sls with support for new params:
+- hw_firmware_type;
+- virt_machine_model;
+- cpu_model;
+
+This functionality relies on the corresponding changes to be
+implemented in libvirt_domain.jinja template, as well as in
+salt custom py module virtng.py.
+
+These will later be leveraged via reclass model with AArch64
+specific values.
+
+FIXME: Move all new params to different section, as "size" is
+definitely not the best choice.
+
+Example reclass model usage:
+salt:
+  control:
+    size:
+      openstack.example_vm_type:
+        hw_firmware_type: uefi
+        virt_machine_model: virt
+        cpu_model: host-passthrough
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+
+diff --git a/salt/control/virt.sls b/salt/control/virt.sls
+--- a/salt/control/virt.sls
++++ b/salt/control/virt.sls
+@@ -44,6 +44,16 @@
+       seed: True
+       serial_type: pty
+       console: True
++      # FIXME(armband): Move these 3 params to different section
++      {%- if size.hw_firmware_type is defined %}
++      hw_firmware_type: {{ size.hw_firmware_type }}
++      {%- endif %}
++      {%- if size.virt_machine_model is defined %}
++      virt_machine_model: {{ size.virt_machine_model }}
++      {%- endif %}
++      {%- if size.cpu_model is defined %}
++      cpu_model: {{ size.cpu_model }}
++      {%- endif %}
+   - unless: virsh list --all --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$"
+
+ #salt_control_seed_{{ cluster_name }}_{{ node_name }}:
diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list
index a42f513..67b9c82 100644
--- a/mcp/patches/patches.list
+++ b/mcp/patches/patches.list
@@ -7,3 +7,5 @@
 /usr/share/salt-formulas/env: 0007-linux.network.interface-noifupdown-support.patch
 /usr/share/salt-formulas/env: 0101-maas-Add-curtin_userdata_arm64_generic_xenial.patch
 /usr/share/salt-formulas/env: 0102-libvirt-unix_sock_group-s-libvirtd-libvirt.patch
+/usr/share/salt-formulas/env: 0103-virtng-module-Extend-libvirt_domain.patch
+/usr/share/salt-formulas/env: 0104-salt-control-virt-Extend-libvirt_domain.patch
diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml
index 7c23b68..395ac02 100644
--- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml
+++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-odl-ha/infra/kvm.yml
@@ -34,16 +34,25 @@ parameters:
         openstack.control:
           cpu: 4
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
         openstack.database:
           cpu: 4
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: large
           net_profile: default
         openstack.message_queue:
           cpu: 4
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
 #        openstack.telemetry:
@@ -54,6 +63,9 @@ parameters:
         openstack.proxy:
           cpu: 2
           ram: 4096
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
 #        stacklight.log:
@@ -74,6 +86,9 @@ parameters:
         opendaylight.server:
           cpu: 4
           ram: 6144
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
       cluster:
diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml
index 8677a79..914908d 100644
--- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml
+++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml
@@ -34,26 +34,41 @@ parameters:
         openstack.control:
           cpu: 6
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
         openstack.database:
           cpu: 6
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: large
           net_profile: default
         openstack.message_queue:
           cpu: 6
           ram: 8192
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
         openstack.telemetry:
           cpu: 4
           ram: 4096
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: xxlarge
           net_profile: default
         openstack.proxy:
           cpu: 4
           ram: 4096
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
 #        stacklight.log: