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: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Mon, 21 Aug 2017 01:10:16 +0200
11 Subject: [PATCH] virtng.py, virt.sls: Extend libvirt_domain
13 Extend _modules/virtng.py, salt/control/virt.sls with support for:
18 This functionality relies on the corresponding changes to be
19 implemented in libvirt_domain.jinja template.
21 These will later be leveraged via our reclass model with AArch64
24 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
26 ...-virtng-module-Extend-libvirt_domain.patch | 54 +++++++++++++++++++
27 ...t-control-virt-Extend-libvirt_domain.patch | 51 ++++++++++++++++++
28 mcp/patches/patches.list | 2 +
29 .../cluster/mcp-pike-common-ha/infra/kvm.yml | 15 ++++++
30 .../cluster/mcp-pike-odl-ha/infra/kvm.yml.j2 | 3 ++
31 5 files changed, 125 insertions(+)
32 create mode 100644 mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
33 create mode 100644 mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch
35 diff --git a/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch b/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
37 index 00000000..706b67da
39 +++ b/mcp/patches/0103-virtng-module-Extend-libvirt_domain.patch
41 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
42 +Date: Mon, 21 Aug 2017 02:03:01 +0200
43 +Subject: [PATCH] virtng: module: Extend libvirt_domain
45 +Extend virtng.py with support for passing down new params:
47 +- virt_machine_model;
50 +This functionality relies on the corresponding changes to be
51 +implemented in libvirt_domain.jinja template.
53 +These will later be leveraged via salt virt formula with AArch64
56 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
59 +diff --git a/_modules/virtng.py b/_modules/virtng.py
60 +--- a/_modules/virtng.py
61 ++++ b/_modules/virtng.py
64 + VIRT_DEFAULT_HYPER = 'kvm'
66 ++DEFAULT_UEFI_LOADER_PATH = {
67 ++ "x86_64": "/usr/share/OVMF/OVMF_CODE.fd",
68 ++ "aarch64": "/usr/share/AAVMF/AAVMF_CODE.fd"
72 + if not HAS_ALL_IMPORTS:
74 + # TODO: make bus and model parameterized, this works for 64-bit Linux
75 + context['controller_model'] = 'lsilogic'
77 ++ # TODO: limit cpu_model, hw_firmware_type, virt_machine_type to qemu/kvm
78 ++ # FIXME: parametrize hardcoded path for NVRAM storage
79 ++ if 'hw_firmware_type' in kwargs and kwargs['hw_firmware_type'] == 'uefi':
80 ++ context['os_loader_type'] = 'pflash'
81 ++ context['os_loader'] = DEFAULT_UEFI_LOADER_PATH[os.uname()[-1]]
82 ++ context['os_loader_nvram'] = '/var/lib/libvirt/qemu/nvram/{0}_VARS.fd'.format(name)
84 ++ if 'virt_machine_model' in kwargs:
85 ++ context['custom_virt_machine'] = True
86 ++ context['virt_machine_model'] = kwargs['virt_machine_model']
88 ++ if 'cpu_model' in kwargs:
89 ++ context['cpu_mode'] = 'custom'
90 ++ context['cpu_model'] = kwargs['cpu_model']
92 + if 'boot_dev' in kwargs:
93 + context['boot_dev'] = []
94 + for dev in kwargs['boot_dev'].split():
95 diff --git a/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch b/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch
97 index 00000000..78eb0bff
99 +++ b/mcp/patches/0104-salt-control-virt-Extend-libvirt_domain.patch
101 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
102 +Date: Mon, 21 Aug 2017 02:03:01 +0200
103 +Subject: [PATCH] salt: control: virt: Extend libvirt_domain
105 +Extend salt/control/virt.sls with support for new params:
107 +- virt_machine_model;
110 +This functionality relies on the corresponding changes to be
111 +implemented in libvirt_domain.jinja template, as well as in
112 +salt custom py module virtng.py.
114 +These will later be leveraged via reclass model with AArch64
117 +FIXME: Move all new params to different section, as "size" is
118 +definitely not the best choice.
120 +Example reclass model usage:
124 + openstack.example_vm_type:
125 + hw_firmware_type: uefi
126 + virt_machine_model: virt
127 + cpu_model: host-passthrough
129 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
132 +diff --git a/salt/control/virt.sls b/salt/control/virt.sls
133 +--- a/salt/control/virt.sls
134 ++++ b/salt/control/virt.sls
136 + {%- if node.img_dest is defined %}
137 + img_dest: {{ node.img_dest }}
139 ++ # FIXME(armband): Move these 3 params to different section
140 ++ {%- if size.hw_firmware_type is defined %}
141 ++ hw_firmware_type: {{ size.hw_firmware_type }}
143 ++ {%- if size.virt_machine_model is defined %}
144 ++ virt_machine_model: {{ size.virt_machine_model }}
146 ++ {%- if size.cpu_model is defined %}
147 ++ cpu_model: {{ size.cpu_model }}
149 + - unless: virsh list --all --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$"
151 + #salt_control_seed_{{ cluster_name }}_{{ node_name }}:
152 diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list
153 index ce59395c..39e737d6 100644
154 --- a/mcp/patches/patches.list
155 +++ b/mcp/patches/patches.list
157 /usr/share/salt-formulas/env: 0012-routes-Skip-network-restart-on-noifupdown.patch
158 /usr/share/salt-formulas/env: 0015-Set-ovs-bridges-as-L3-interfaces.patch
159 /usr/share/salt-formulas/env: 0016-Set-boot-source-selections.patch
160 +/usr/share/salt-formulas/env: 0103-virtng-module-Extend-libvirt_domain.patch
161 +/usr/share/salt-formulas/env: 0104-salt-control-virt-Extend-libvirt_domain.patch
162 diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml
163 index df230452..3548155f 100644
164 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml
165 +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml
166 @@ -52,21 +52,33 @@ parameters:
170 + hw_firmware_type: uefi
171 + virt_machine_model: virt
172 + cpu_model: host-passthrough
178 + hw_firmware_type: uefi
179 + virt_machine_model: virt
180 + cpu_model: host-passthrough
183 openstack.message_queue:
186 + hw_firmware_type: uefi
187 + virt_machine_model: virt
188 + cpu_model: host-passthrough
194 + hw_firmware_type: uefi
195 + virt_machine_model: virt
196 + cpu_model: host-passthrough
197 disk_profile: xxlarge
200 @@ -87,6 +99,9 @@ parameters:
204 + hw_firmware_type: uefi
205 + virt_machine_model: virt
206 + cpu_model: host-passthrough
208 net_profile: default_ext
210 diff --git a/mcp/reclass/classes/cluster/mcp-pike-odl-ha/infra/kvm.yml.j2 b/mcp/reclass/classes/cluster/mcp-pike-odl-ha/infra/kvm.yml.j2
211 index 5fc4776d..b19789e3 100644
212 --- a/mcp/reclass/classes/cluster/mcp-pike-odl-ha/infra/kvm.yml.j2
213 +++ b/mcp/reclass/classes/cluster/mcp-pike-odl-ha/infra/kvm.yml.j2
214 @@ -19,6 +19,9 @@ parameters:
218 + hw_firmware_type: uefi
219 + virt_machine_model: virt
220 + cpu_model: host-passthrough