[MaaS] Implement aarch64 tags for kernel_opts 15/66115/4
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sat, 29 Dec 2018 22:54:32 +0000 (23:54 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Thu, 3 Jan 2019 12:44:23 +0000 (13:44 +0100)
On AArch64, 1G hugepages need to be enabled via kernel cmdline
before mounting hugetlbfs [1].
Leverage MaaS tags to apply custom kernel args to AArch64 nodes.

[1] https://wiki.debian.org/Hugepages

Change-Id: Ie68ddf805836ee62f725019b0b873082b1d40948
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch [new file with mode: 0644]
mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2
mcp/scripts/pharos

diff --git a/mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch b/mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch
new file mode 100644 (file)
index 0000000..77d8ff7
--- /dev/null
@@ -0,0 +1,95 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2018 Mirantis Inc., 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: Sat, 29 Dec 2018 23:09:01 +0100
+Subject: [PATCH] Implement 'tags' support
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ README.rst       |  5 +++++
+ _modules/maas.py | 26 ++++++++++++++++++++++++++
+ maas/region.sls  |  8 ++++++++
+ 3 files changed, 39 insertions(+)
+
+diff --git a/README.rst b/README.rst
+index 78d8aef..8c35458 100644
+--- a/README.rst
++++ b/README.rst
+@@ -181,6 +181,11 @@ Single MAAS region service [single UI/API]:
+           mac: '66:55:44:33:22:11'
+       commissioning_scripts:
+         00-maas-05-simplify-network-interfaces: /etc/maas/files/commisioning_scripts/00-maas-05-simplify-network-interfaces
++      tags:
++        aarch64_hugepages_1g:
++          comment: 'Enable 1G pagesizes on aarch64'
++          definition: '//capability[@id="asimd"]'
++          kernel_opts: 'default_hugepagesz=1G hugepagesz=1G'
+       maas_config:
+         # domain: mydomain.local # This function broken
+         http_proxy: http://192.168.0.10:3142
+diff --git a/_modules/maas.py b/_modules/maas.py
+index 28e46c5..f56ed34 100644
+--- a/_modules/maas.py
++++ b/_modules/maas.py
+@@ -876,6 +876,28 @@ class Domain(MaasObject):
+         return ret
+
+
++class Tags(MaasObject):
++    def __init__(self):
++        super(Tags, self).__init__()
++        self._all_elements_url = u'api/2.0/tags/'
++        self._create_url = u'api/2.0/tags/'
++        self._config_path = 'region.tags'
++        self._update_url = u'api/2.0/tags/{0}/'
++        self._update_key = 'name'
++
++    def fill_data(self, name, tag_data):
++        data = {
++            'name': name,
++        }
++        for key in ['comment', 'definition', 'kernel_opts']:
++            if key in tag_data:
++                data[key] = tag_data[key]
++        return data
++
++    def update(self, new, old):
++        return new
++
++
+ class MachinesStatus(MaasObject):
+     @classmethod
+     def execute(cls, objects_name=None):
+@@ -1064,5 +1086,9 @@ def process_sshprefs():
+     return SSHPrefs().process()
+
+
++def process_tags():
++    return Tags().process()
++
++
+ def wait_for_machine_status(**kwargs):
+     return MachinesStatus.wait_for_machine_status(**kwargs)
+diff --git a/maas/region.sls b/maas/region.sls
+index 4a7f6cc..52fb952 100644
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -444,4 +444,12 @@ maas_sshkey_{{ idx }}:
+ {% endfor %}
+ {%- endif %}
+
++{%- if region.get('tags', False)  %}
++maas_tags:
++  module.run:
++  - name: maas.process_tags
++  - require:
++    - cmd: maas_login_admin
++{%- endif %}
++
+ {%- endif %}
index 18d2081..6727ab3 100644 (file)
@@ -29,6 +29,13 @@ parameters:
     opnfv_maas_timeout_deploying: {{ nm.maas_timeout_deploying }}
   maas:
     region:
+{%- if '-ovs-' in conf.MCP_DEPLOY_SCENARIO or '-fdio-' in conf.MCP_DEPLOY_SCENARIO %}
+      tags:
+        aarch64_hugepages_1g:
+          comment: 'Enable 1G pagesizes on aarch64'
+          definition: '//capability[@id="asimd"]'
+          kernel_opts: 'default_hugepagesz=1G hugepagesz=1G'
+{%- endif %}
       timeout:
         # Set maas.wait_for_<state> timeouts to ~2.5x of MaaS <state> timeout
         ready: {{ nm.maas_timeout_comissioning * 150 }}
index 8f43c9a..2b40625 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 8f43c9af3ca49498659fb3caa08162504b50ab07
+Subproject commit 2b406259498cd40f68b844d9e410222431f9955c