From: Alexandru Avadanii Date: Mon, 21 Aug 2017 19:00:48 +0000 (+0200) Subject: salt: virt: seedng: Add AArch64 support X-Git-Tag: opnfv-5.0.RC1~81 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=1c7244f450d220447ee7efafaa3397ab5317da28;p=armband.git salt: virt: seedng: Add AArch64 support Change-Id: I8642701586296ae171d702bb4b6ad0f9bef36c9e Signed-off-by: Alexandru Avadanii --- diff --git a/patches/opnfv-fuel/0003-classes-virtual-AArch64-virtio-NIC-names-sync.patch b/patches/opnfv-fuel/0003-classes-virtual-AArch64-virtio-NIC-names-sync.patch index 812195b7..d62448f3 100644 --- a/patches/opnfv-fuel/0003-classes-virtual-AArch64-virtio-NIC-names-sync.patch +++ b/patches/opnfv-fuel/0003-classes-virtual-AArch64-virtio-NIC-names-sync.patch @@ -54,10 +54,10 @@ index 63e58a2..2f8e94a 100644 type: eth proto: static diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/opendaylight/control.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/opendaylight/control.yml -index 6e37978..e9e6056 100644 +index 6bc0f51..4dacc73 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/opendaylight/control.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl-router/opendaylight/control.yml -@@ -11,7 +11,7 @@ parameters: +@@ -10,7 +10,7 @@ parameters: linux: network: interface: diff --git a/patches/opnfv-fuel/0004-mcp-salt-formulas-Add-enable-armband-formula.patch b/patches/opnfv-fuel/0004-mcp-salt-formulas-Add-enable-armband-formula.patch index ab0462d0..58607cd1 100644 --- a/patches/opnfv-fuel/0004-mcp-salt-formulas-Add-enable-armband-formula.patch +++ b/patches/opnfv-fuel/0004-mcp-salt-formulas-Add-enable-armband-formula.patch @@ -36,7 +36,7 @@ Signed-off-by: Alexandru Avadanii create mode 100644 mcp/salt-formulas/armband/vgabios.sls diff --git a/mcp/config/states/maas b/mcp/config/states/maas -index acee8c0..f0de58d 100755 +index 0c01617..99d923b 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -48,6 +48,7 @@ wait_for "! salt '*' test.ping | tee /dev/stderr | fgrep -q 'Not connected'" diff --git a/patches/opnfv-fuel/0009-classes-baremetal-AArch64-virtio-NIC-names-sync.patch b/patches/opnfv-fuel/0009-classes-baremetal-AArch64-virtio-NIC-names-sync.patch index 5609a976..94686f3b 100644 --- a/patches/opnfv-fuel/0009-classes-baremetal-AArch64-virtio-NIC-names-sync.patch +++ b/patches/opnfv-fuel/0009-classes-baremetal-AArch64-virtio-NIC-names-sync.patch @@ -48,7 +48,7 @@ index 77443de..824b979 100644 master: accept_policy: open_mode diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml -index 5c33f9e..8b09e76 100644 +index 1608c65..8677a79 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml @@ -25,7 +25,8 @@ parameters: diff --git a/patches/opnfv-fuel/0011-network-public-mgmt-Use-arm-pod3-POD-config.patch b/patches/opnfv-fuel/0011-network-public-mgmt-Use-arm-pod3-POD-config.patch index b12cf277..ab078c26 100644 --- a/patches/opnfv-fuel/0011-network-public-mgmt-Use-arm-pod3-POD-config.patch +++ b/patches/opnfv-fuel/0011-network-public-mgmt-Use-arm-pod3-POD-config.patch @@ -27,7 +27,7 @@ index cf7b3b3..2b4e724 100755 # Variables below are disabled for now, to be re-introduced or removed later diff --git a/mcp/config/states/maas b/mcp/config/states/maas -index f0de58d..4b306af 100755 +index 99d923b..13a8263 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -20,7 +20,7 @@ salt -C 'mas01*' state.apply linux.network.interface diff --git a/patches/opnfv-fuel/0015-mcp-salt-formulas-armband-Extend-libvirt_domain.patch b/patches/opnfv-fuel/0015-mcp-salt-formulas-armband-Extend-libvirt_domain.patch index 7bdb14b9..f56cb68a 100644 --- a/patches/opnfv-fuel/0015-mcp-salt-formulas-armband-Extend-libvirt_domain.patch +++ b/patches/opnfv-fuel/0015-mcp-salt-formulas-armband-Extend-libvirt_domain.patch @@ -21,7 +21,7 @@ Signed-off-by: Alexandru Avadanii create mode 100644 mcp/salt-formulas/armband/libvirt_domain_template.sls diff --git a/mcp/config/states/maas b/mcp/config/states/maas -index 4b306af..d99dfc4 100755 +index 13a8263..fef7a62 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -48,7 +48,7 @@ wait_for "! salt '*' test.ping | tee /dev/stderr | fgrep -q 'Not connected'" diff --git a/patches/opnfv-fuel/0016-virtng.py-virt.sls-Extend-libvirt_domain.patch b/patches/opnfv-fuel/0016-virtng.py-virt.sls-Extend-libvirt_domain.patch index ec1c6afe..1a64c6d6 100644 --- a/patches/opnfv-fuel/0016-virtng.py-virt.sls-Extend-libvirt_domain.patch +++ b/patches/opnfv-fuel/0016-virtng.py-virt.sls-Extend-libvirt_domain.patch @@ -151,7 +151,7 @@ index a42f513..67b9c82 100644 +/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-ocata-ovs-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml -index 8b09e76..ff06a15 100644 +index 8677a79..914908d 100644 --- a/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/baremetal-mcp-ocata-ovs-ha/infra/kvm.yml @@ -34,26 +34,41 @@ parameters: diff --git a/patches/opnfv-fuel/0017-mcp-salt-formulas-armband-AArch64-bootstrap.patch b/patches/opnfv-fuel/0017-mcp-salt-formulas-armband-AArch64-bootstrap.patch new file mode 100644 index 00000000..2f5c0c57 --- /dev/null +++ b/patches/opnfv-fuel/0017-mcp-salt-formulas-armband-AArch64-bootstrap.patch @@ -0,0 +1,82 @@ +From: Alexandru Avadanii +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 +--- + mcp/config/states/maas | 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/maas b/mcp/config/states/maas +index fef7a62..75da696 100755 +--- a/mcp/config/states/maas ++++ b/mcp/config/states/maas +@@ -43,6 +43,7 @@ salt -C '* and not cfg01* and not mas01*' saltutil.sync_all + + salt -C 'kvm*' pkg.install bridge-utils + salt -C 'kvm*' state.apply linux.network ++salt -C 'kvm*' state.apply armband.bootstrap_script_arm64 + salt -C 'kvm*' system.reboot + wait_for "! salt '*' test.ping | tee /dev/stderr | fgrep -q '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 ++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 ++--- ++ ++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__), diff --git a/patches/opnfv-fuel/0018-seedng-module-Add-AArch64-repo.patch b/patches/opnfv-fuel/0018-seedng-module-Add-AArch64-repo.patch new file mode 100644 index 00000000..330d416a --- /dev/null +++ b/patches/opnfv-fuel/0018-seedng-module-Add-AArch64-repo.patch @@ -0,0 +1,54 @@ +From: Alexandru Avadanii +Date: Mon, 21 Aug 2017 20:42:00 +0200 +Subject: [PATCH] seedng: module: Add AArch64 repo + +salt custom py module seedng.py should use custom repo arg +"-R linux.enea.com/saltstack" on AArch64 nodes. + +Signed-off-by: Alexandru Avadanii +--- + .../0105-seedng-module-Add-AArch64-repo.patch | 25 ++++++++++++++++++++++ + mcp/patches/patches.list | 1 + + 2 files changed, 26 insertions(+) + create mode 100644 mcp/patches/0105-seedng-module-Add-AArch64-repo.patch + +diff --git a/mcp/patches/0105-seedng-module-Add-AArch64-repo.patch b/mcp/patches/0105-seedng-module-Add-AArch64-repo.patch +new file mode 100644 +index 0000000..e191421 +--- /dev/null ++++ b/mcp/patches/0105-seedng-module-Add-AArch64-repo.patch +@@ -0,0 +1,25 @@ ++From: Alexandru Avadanii ++Date: Mon, 21 Aug 2017 02:03:01 +0200 ++Subject: [PATCH] seedng: module: Add AArch64 repo ++ ++salt custom py module seedng.py should use custom repo arg ++"-R linux.enea.com/saltstack" on AArch64 nodes. ++ ++Signed-off-by: Alexandru Avadanii ++--- ++ ++diff --git a/_modules/seedng.py b/_modules/seedng.py ++--- a/_modules/seedng.py +++++ b/_modules/seedng.py ++@@ -256,8 +256,10 @@ ++ boot_, tmppath = (prep_bootstrap(mpt) ++ or salt.syspaths.BOOTSTRAP) ++ # Exec the chroot command +++ cmdR = '-R linux.enea.com/saltstack' if os.uname()[-1] == 'aarch64' else '' ++ cmd = 'if type salt-minion; then exit 0; ' ++- cmd += 'else sh {0} -c /tmp; fi'.format(os.path.join(tmppath, 'bootstrap-salt.sh')) +++ cmd += 'else sh {0} {1} -c /tmp; fi'.format( +++ os.path.join(tmppath, 'bootstrap-salt.sh'), cmdR) ++ return not __salt__['cmd.run_chroot'](mpt, cmd, python_shell=True)['retcode'] ++ ++ +diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list +index 67b9c82..b4b2b30 100644 +--- a/mcp/patches/patches.list ++++ b/mcp/patches/patches.list +@@ -9,3 +9,4 @@ + /usr/share/salt-formulas/env: 0102-libvirt-unix_sock_group-s-libvirtd-libvirt.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 ++/usr/share/salt-formulas/env: 0105-seedng-module-Add-AArch64-repo.patch