summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0008-virtng.py-virt.sls-Extend-libvirt_domain.patch
blob: eb4fb80346c0265f9126d1868008b5b42cffdd3c (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

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2017 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: 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-pike-common-ha/infra/kvm.yml     | 15 ++++++
 .../baremetal-mcp-pike-odl-ha/infra/kvm.yml        |  3 ++
 5 files changed, 125 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 0e1b7f6..ec9fc78 100644
--- a/mcp/patches/patches.list
+++ b/mcp/patches/patches.list
@@ -17,3 +17,5 @@
 /usr/share/salt-formulas/env: 0012-linux.storage.lvm-Disable-filter.patch
 /usr/share/salt-formulas/env: 0013-libvirt-unix_sock_group-s-libvirtd-libvirt.patch
 /usr/share/salt-formulas/env: 0101-maas-Add-curtin_userdata_arm64_generic_xenial.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-pike-common-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/kvm.yml
index 23f09a7..b28f479 100644
--- a/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/kvm.yml
+++ b/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/kvm.yml
@@ -48,21 +48,33 @@ parameters:
         openstack.control:
           cpu: 4
           ram: 12288
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
         openstack.database:
           cpu: 4
           ram: 6144
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: large
           net_profile: default
         openstack.message_queue:
           cpu: 4
           ram: 2048
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default
         openstack.telemetry:
           cpu: 2
           ram: 3072
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: xxlarge
           net_profile: default
         # stacklight.log:
@@ -83,6 +95,9 @@ parameters:
         openstack.proxy:
           cpu: 2
           ram: 2048
+          hw_firmware_type: uefi
+          virt_machine_model: virt
+          cpu_model: host-passthrough
           disk_profile: small
           net_profile: default_ext
       cluster:
diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-pike-odl-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-pike-odl-ha/infra/kvm.yml
index 6bcc72d..53a1ddd 100644
--- a/mcp/reclass/classes/cluster/baremetal-mcp-pike-odl-ha/infra/kvm.yml
+++ b/mcp/reclass/classes/cluster/baremetal-mcp-pike-odl-ha/infra/kvm.yml
@@ -17,6 +17,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: