From f19e6e8f4c50f3c2198f8871dde44334ed636eff Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 29 Dec 2018 23:54:32 +0100 Subject: [MaaS] Implement aarch64 tags for kernel_opts 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 --- .../0005-Implement-tags-support.patch | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch (limited to 'mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch') 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 index 000000000..77d8ff789 --- /dev/null +++ b/mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch @@ -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 +Date: Sat, 29 Dec 2018 23:09:01 +0100 +Subject: [PATCH] Implement 'tags' support + +Signed-off-by: Alexandru Avadanii +--- + 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 %} -- cgit 1.2.3-korg