summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0009-mcp-salt-formulas-armband-AArch64-bootstrap.patch
blob: b3139769627907a2f5204cee007c0d666fd2b6fe (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
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: 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 20:53:03 +0200
Subject: [PATCH] mcp: salt-formulas: armband: 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/bootstrap_script_arm64.sls             |  4 +++
 mcp/salt-formulas/armband/files/cloud.py.diff      | 29 ++++++++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 mcp/salt-formulas/armband/bootstrap_script_arm64.sls
 create mode 100644 mcp/salt-formulas/armband/files/cloud.py.diff

diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
index fb1c439..0afd530 100755
--- a/mcp/config/states/virtual_control_plane
+++ b/mcp/config/states/virtual_control_plane
@@ -20,6 +20,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.bootstrap_script_arm64 || 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/bootstrap_script_arm64.sls b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
new file mode 100644
index 0000000..845dedd
--- /dev/null
+++ b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
@@ -0,0 +1,4 @@
+/usr/lib/python2.7/dist-packages/salt/utils/cloud.py:
+  file.patch:
+  - source:  salt://armband/files/cloud.py.diff
+  - hash: "ecd450b187156c1f6a91ea272fd668b0"
diff --git a/mcp/salt-formulas/armband/files/cloud.py.diff b/mcp/salt-formulas/armband/files/cloud.py.diff
new file mode 100644
index 0000000..75c3281
--- /dev/null
+++ b/mcp/salt-formulas/armband/files/cloud.py.diff
@@ -0,0 +1,29 @@
+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//usr/lib/python2.7/dist-packages/salt/utils/cloud.py b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
+--- a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
++++ b//usr/lib/python2.7/dist-packages/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__),
>= [] self.name = name self.order = order self.ci_loop = ci_loop self.description = description def add_test(self, testcase): self.tests_array.append(testcase) def get_tests(self): array_tests = [] for test in self.tests_array: array_tests.append(test) return array_tests def get_test_names(self): array_tests = [] for test in self.tests_array: array_tests.append(test.get_name()) return array_tests def get_test(self, test_name): if self.is_test(test_name): for test in self.tests_array: if test.get_name() == test_name: return test return None def is_test(self, test_name): for test in self.tests_array: if test.get_name() == test_name: return True return False def get_name(self): return self.name def get_order(self): return self.order def get_ci_loop(self): return self.ci_loop def __str__(self): lines = split_text(self.description, LINE_LENGTH - 6) out = "" out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Tier: " + self.name.ljust(LINE_LENGTH - 10) + "|\n") out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Order: " + str(self.order).ljust(LINE_LENGTH - 10) + "|\n") out += ("| CI Loop: " + str(self.ci_loop).ljust(LINE_LENGTH - 12) + "|\n") out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n") for line in lines: out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n") out += ("| Test cases:".ljust(LINE_LENGTH - 1) + "|\n") tests = self.get_test_names() if len(tests) > 0: for i in range(len(tests)): out += ("| - %s |\n" % tests[i].ljust(LINE_LENGTH - 9)) else: out += ("| (There are no supported test cases " .ljust(LINE_LENGTH - 1) + "|\n") out += ("| in this tier for the given scenario) " .ljust(LINE_LENGTH - 1) + "|\n") out += ("|".ljust(LINE_LENGTH - 1) + "|\n") out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2))) return out class TestCase(object): def __init__(self, name, dependency, criteria, blocking, clean_flag, description=""): self.name = name self.dependency = dependency self.criteria = criteria self.blocking = blocking self.clean_flag = clean_flag self.description = description @staticmethod def is_none(item): return item is None or item is "" def is_compatible(self, ci_installer, ci_scenario): try: if not self.is_none(ci_installer): if re.search(self.dependency.get_installer(), ci_installer) is None: return False if not self.is_none(ci_scenario): if re.search(self.dependency.get_scenario(), ci_scenario) is None: return False return True except TypeError: return False def get_name(self): return self.name def get_criteria(self): return self.criteria def is_blocking(self): return self.blocking def needs_clean(self): return self.clean_flag def __str__(self): lines = split_text(self.description, LINE_LENGTH - 6) out = "" out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Testcase: " + self.name.ljust(LINE_LENGTH - 14) + "|\n") out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n") for line in lines: out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n") out += ("| Criteria: " + str(self.criteria).ljust(LINE_LENGTH - 14) + "|\n") out += ("| Dependencies:".ljust(LINE_LENGTH - 1) + "|\n") installer = self.dependency.get_installer() scenario = self.dependency.get_scenario() out += ("| - Installer:" + installer.ljust(LINE_LENGTH - 17) + "|\n") out += ("| - Scenario :" + scenario.ljust(LINE_LENGTH - 17) + "|\n") out += ("|".ljust(LINE_LENGTH - 1) + "|\n") out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2))) return out class Dependency(object): def __init__(self, installer, scenario): self.installer = installer self.scenario = scenario def get_installer(self): return self.installer def get_scenario(self): return self.scenario def __str__(self): return ("Dependency info:\n" " installer: " + self.installer + "\n" " scenario: " + self.scenario + "\n")