summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-11-26 05:43:39 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-11-26 23:56:20 +0000
commitb49021e1227573fbde13c82f432635ef187b1e83 (patch)
treea0ef84e1ab70b5f1aca9254c3664847c056ab474 /patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch
parent3293d28284b3d2d140f3b82452cfb6b16a7f2f2a (diff)
u/fuel: Bump & rebase for image pre-install
1. Bump to latest Fuel@OPNFV to include: - Bring in newer glusterfs for mtime unsplit brain * Requires adding arch "arm64" to PPA definition in reclass: - (reclass-system) linux.system.repo.glusterfs: Add arm64 arch - Switch nofeature-ha compute nodes to UCA repo * Requires an alternative way of adding linux.enea.com repos; * linux.enea.com repos will now be pre-install into VM images; * Requires refresh on repo arch list handled by Armband patch: - (fuel) baremetal, virtual: Extend arch list for UCA repo 2. Staging proposed patches from upstream Fuel@OPNFV: - Add pre-{install,purge} support for base image * Reference implementation adds pre-installed Armband specifics: - Enea public GPG to APT keys (for below repos); - repos (linux.enea.com/{apt-mk,mcp-repos}/*); - linux-{image,headers}-generic-hwe-16.04-edge; - cloud-init: datasource from NoCloud only; * Allows us to drop kernel installation from state files, installing the kernel only once during image prep, instead of two stages of parallel installs (5 baremetal, 14 VCP); * Ensures Armband repos are pre-configured for infrastructure VMs, allowing us to drop more reclass repo definitions; * Rework armband patch to install kernel only on kvm, cmp: - (fuel) baremetal: linux-image-generic-hwe-16.04-edge 3. Sync reclass repo definitions with upstream change, drop duplicates - [linux][repos] Remove unused repositories [1] * Upstream dropped all "ocata-{security,hotfix,...} repo comps, which are also empty for Armband, so drop them too; * Rework following armband patches: - (reclass-system) linux/system/repo/mcp: Add Armband repos * Move Armband repos to new dedicated reclass classes: - linux.system.repo.mcp.armband.extra (currently empty); - linux.system.repo.mcp.armband.openstack; * Use HTTPS for fetching Enea Armband GPG key; - (fuel) baremetal: Add Armband Openstack repos to kvm, cmp * Consume defs introduced above only on baremetal nodes; 4. Sync documentation with Fuel@OPNFV (cp) 5. Add vim swap files to .gitignore [1] https://github.com/Mirantis/reclass-system-salt-model/commit/1dd1b31 Change-Id: Ibab56279de86f08ad7cd9bc6761f4c525532f811 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> (cherry picked from commit 37083673d6cdddbb9b710f4dd5efe832753e5856)
Diffstat (limited to 'patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch')
-rw-r--r--patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch174
1 files changed, 174 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch b/patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch
new file mode 100644
index 00000000..1ea8f5af
--- /dev/null
+++ b/patches/opnfv-fuel/0008-mcp-salt-formulas-armband-Extend-libvirt_domain.patch
@@ -0,0 +1,174 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: 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: Sun, 20 Aug 2017 22:41:26 +0200
+Subject: [PATCH] mcp: salt-formulas: armband: Extend libvirt_domain
+
+Add new state in armband salt formula that:
+* extends salt's virt libvirt_domain.jinja template with support for:
+ - hw_firmware_type;
+ - virt_machine_model;
+ - cpu_model;
+ These will later be leveraged via salt virt formula with AArch64
+ specific values.
+* to ensure compatibilty of `virt.purge` with NVRAM-enabled domains
+ at undefine time, pass down the proper flag to libvirt from virt.py.
+* re-enable AArch64 bootstrap
+ Recent changes in salt bootstrap script from [1] whitelist a
+ fixed pool of known architectures. Add "arm64" to that list on the
+ fly, as part of `config.gather_bootstrap_script`.
+ NOTE: This change will be leveraged by passing a custom DEB repo to
+ the bootstrap script with `-R linux.enea.com/saltstack`.
+
+NOTE: After running this new state, salt-minion should be restarted
+to pick up the changes, so we'll run it before rebooting kvm nodes.
+
+[1] http://bootstrap.saltstack.com
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ mcp/config/states/virtual_control_plane | 1 +
+ .../armband/files/salt-minion-aarch64-rollup.diff | 101 +++++++++++++++++++++
+ mcp/salt-formulas/armband/salt_minion.sls | 7 ++
+ 3 files changed, 109 insertions(+)
+ create mode 100644 mcp/salt-formulas/armband/files/salt-minion-aarch64-rollup.diff
+ create mode 100644 mcp/salt-formulas/armband/salt_minion.sls
+
+diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
+index 99fb517..88a4488 100755
+--- a/mcp/config/states/virtual_control_plane
++++ b/mcp/config/states/virtual_control_plane
+@@ -40,6 +40,7 @@ salt -C 'kvm*' pkg.install bridge-utils
+ salt -C 'kvm*' state.apply linux.network
+ salt -C 'cmp*' state.apply linux.system
+ salt -C 'cmp*' state.apply linux.network || true
++salt -C 'kvm*' state.apply armband.salt_minion || true
+ salt -C 'kvm* or cmp*' system.reboot
+ wait_for 90 "! salt -C 'kvm* or cmp*' test.ping | " \
+ "tee /dev/stderr | grep -Fq 'Not connected'"
+diff --git a/mcp/salt-formulas/armband/files/salt-minion-aarch64-rollup.diff b/mcp/salt-formulas/armband/files/salt-minion-aarch64-rollup.diff
+new file mode 100644
+index 0000000..9e74c24
+--- /dev/null
++++ b/mcp/salt-formulas/armband/files/salt-minion-aarch64-rollup.diff
+@@ -0,0 +1,101 @@
++From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++Date: Sun Aug 20 18:18:53 2017 +0200
++Subject: [PATCH] cloud.py: Allow AArch64 arch in salt bootstrap
++
++Recent changes in salt bootstrap script from [1] whitelist a
++fixed pool of known architectures. Add "arm64" to that list on the
++fly, as part of `config.gather_bootstrap_script`.
++
++NOTE: This change will be leveraged by passing a custom DEB repo to
++the bootstrap script with `-R linux.enea.com/saltstack`.
++
++[1] http://bootstrap.saltstack.com
++
++Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++---
++
++diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py
++--- a/salt/utils/cloud.py
+++++ b/salt/utils/cloud.py
++@@ -2772,6 +2772,9 @@
++ if not script_content:
++ raise ValueError('No content in bootstrap script !')
++
+++ # NOTE(armband): edit bootstrap script on the fly to allow AArch64
+++ script_content = script_content.replace('"amd64")', '"amd64"|"arm64")')
+++
++ # Get the path to the built-in deploy scripts directory
++ builtin_deploy_dir = os.path.join(
++ os.path.dirname(__file__),
++--
++
++From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++Date: Sun Aug 20 18:18:53 2017 +0200
++Subject: [PATCH] libvirt_domain.jinja: Add AArch64 support
++
++Salt virt state relies on a Jinja template to create a libvirt
++XML definition for each new VM.
++This template needs to be extended with a few specific options
++for AArch64:
++- UEFI loader support (pflash);
++- custom machine model (e.g. 'virt-2.9'), since AArch64 defaults to
++ 'integratorcp';
++- custom cpu model;
++
++Allow all these to be parametrized from the salt virt formula,
++which we will also adapt to allow the params to be passed via our
++reclass model.
++
++Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++---
++
++diff --git a/salt/templates/virt/libvirt_domain.jinja b/salt/templates/virt/libvirt_domain.jinja
++--- a/salt/templates/virt/libvirt_domain.jinja
+++++ b/salt/templates/virt/libvirt_domain.jinja
++@@ -3,11 +3,22 @@
++ <vcpu>{{ cpu }}</vcpu>
++ <memory unit='KiB'>{{ mem }}</memory>
++ <os>
+++ {% if custom_virt_machine %}
+++ <type machine='{{ virt_machine_model }}'>hvm</type>
+++ {% else %}
++ <type>hvm</type>
+++ {% endif %}
+++ {% if os_loader_type == 'pflash' %}
+++ <loader readonly='yes' type='{{ os_loader_type }}'>{{ os_loader }}</loader>
+++ <nvram>{{ os_loader_nvram }}</nvram>
+++ {% endif %}
++ {% for dev in boot_dev %}
++ <boot dev='{{ dev }}' />
++ {% endfor %}
++ </os>
+++ {% if cpu_mode == 'custom' %}
+++ <cpu mode='{{ cpu_model }}' check='none'/>
+++ {% endif %}
++ <devices>
++ {% for diskname, disk in disks.items() %}
++ <disk type='file' device='disk'>
++--
++
++From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++Date: Sun Nov 19 02:18:53 2017 +0200
++Subject: [PATCH] virt.py: undefine: NVRAM flag support
++
++Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
++---
++
++diff --git a/salt/modules/virt.py b/salt/modules/virt.py
++--- a/salt/modules/virt.py
+++++ b/salt/modules/virt.py
++@@ -1523,7 +1523,10 @@
++ salt '*' virt.undefine <domain>
++ '''
++ dom = _get_domain(vm_)
++- return dom.undefine() == 0
+++ try:
+++ return dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) == 0
+++ except libvirt.libvirtError:
+++ return dom.undefine() == 0
++
++
++ def purge(vm_, dirs=False):
+diff --git a/mcp/salt-formulas/armband/salt_minion.sls b/mcp/salt-formulas/armband/salt_minion.sls
+new file mode 100644
+index 0000000..9cce636
+--- /dev/null
++++ b/mcp/salt-formulas/armband/salt_minion.sls
+@@ -0,0 +1,7 @@
++salt-minion-aarch64-rollup:
++ file.patch:
++ - name: /usr/lib/python2.7/dist-packages
++ - source: salt://armband/files/salt-minion-aarch64-rollup.diff
++ - hash: False
++ - options: '-p1'
++ - unless: 'test -f /var/cache/salt/minion/files/base/armband/files/salt-minion-aarch64-rollup.diff && cd /usr/lib/python2.7/dist-packages && patch -p1 -R --dry-run /var/cache/salt/minion/files/base/armband/files/salt-minion-aarch64-rollup.diff'