u/fuel: Bump & rebase for VCP state split
[armband.git] / patches / opnfv-fuel / 0010-mcp-salt-formulas-armband-AArch64-bootstrap.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
3 :
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 20:53:03 +0200
11 Subject: [PATCH] mcp: salt-formulas: armband: AArch64 bootstrap
12
13 Recent changes in salt bootstrap script from [1] whitelist a
14 fixed pool of known architectures. Add "arm64" to that list on the
15 fly, as part of `config.gather_bootstrap_script`.
16
17 NOTE: This change will be leveraged by passing a custom DEB repo to
18 the bootstrap script with `-R linux.enea.com/saltstack`.
19
20 NOTE: After running this new state, salt-minion should be restarted
21 to pick up the changes, so we'll run it before rebooting kvm nodes.
22
23 [1] http://bootstrap.saltstack.com
24
25 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
26 ---
27  mcp/config/states/virtual_control_plane            |  1 +
28  .../armband/bootstrap_script_arm64.sls             |  4 +++
29  mcp/salt-formulas/armband/files/cloud.py.diff      | 29 ++++++++++++++++++++++
30  3 files changed, 34 insertions(+)
31  create mode 100644 mcp/salt-formulas/armband/bootstrap_script_arm64.sls
32  create mode 100644 mcp/salt-formulas/armband/files/cloud.py.diff
33
34 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
35 index 327b159..59424ac 100755
36 --- a/mcp/config/states/virtual_control_plane
37 +++ b/mcp/config/states/virtual_control_plane
38 @@ -7,6 +7,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
39  # KVM, compute node prereqs (libvirt first), VCP deployment
40  salt -C 'kvm*' pkg.install bridge-utils
41  salt -C 'kvm*' state.apply linux.network
42 +salt -C 'kvm*' state.apply armband.bootstrap_script_arm64
43  salt -C 'kvm*' system.reboot
44  wait_for 90 "! salt 'kvm*' test.ping | tee /dev/stderr | grep -Fq 'Not connected'"
45
46 diff --git a/mcp/salt-formulas/armband/bootstrap_script_arm64.sls b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
47 new file mode 100644
48 index 0000000..845dedd
49 --- /dev/null
50 +++ b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
51 @@ -0,0 +1,4 @@
52 +/usr/lib/python2.7/dist-packages/salt/utils/cloud.py:
53 +  file.patch:
54 +  - source:  salt://armband/files/cloud.py.diff
55 +  - hash: "ecd450b187156c1f6a91ea272fd668b0"
56 diff --git a/mcp/salt-formulas/armband/files/cloud.py.diff b/mcp/salt-formulas/armband/files/cloud.py.diff
57 new file mode 100644
58 index 0000000..75c3281
59 --- /dev/null
60 +++ b/mcp/salt-formulas/armband/files/cloud.py.diff
61 @@ -0,0 +1,29 @@
62 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
63 +Date: Sun Aug 20 18:18:53 2017 +0200
64 +Subject: [PATCH] cloud.py: Allow AArch64 arch in salt bootstrap
65 +
66 +Recent changes in salt bootstrap script from [1] whitelist a
67 +fixed pool of known architectures. Add "arm64" to that list on the
68 +fly, as part of `config.gather_bootstrap_script`.
69 +
70 +NOTE: This change will be leveraged by passing a custom DEB repo to
71 +the bootstrap script with `-R linux.enea.com/saltstack`.
72 +
73 +[1] http://bootstrap.saltstack.com
74 +
75 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
76 +---
77 +
78 +diff --git a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
79 +--- a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
80 ++++ b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
81 +@@ -2772,6 +2772,9 @@
82 +     if not script_content:
83 +         raise ValueError('No content in bootstrap script !')
84 +
85 ++    # NOTE(armband): edit bootstrap script on the fly to allow AArch64
86 ++    script_content = script_content.replace('"amd64")', '"amd64"|"arm64")')
87 ++
88 +     # Get the path to the built-in deploy scripts directory
89 +     builtin_deploy_dir = os.path.join(
90 +         os.path.dirname(__file__),