aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/patches/salt-formula-maas
diff options
context:
space:
mode:
Diffstat (limited to 'mcp/patches/salt-formula-maas')
-rw-r--r--mcp/patches/salt-formula-maas/0001-maas-region-skip-credentials-update.patch40
-rw-r--r--mcp/patches/salt-formula-maas/0002-maas-region-allow-timeout-override.patch85
-rw-r--r--mcp/patches/salt-formula-maas/0003-Extend-wait_for-maas.py-wait_for_-attempts-arg.patch268
-rw-r--r--mcp/patches/salt-formula-maas/0004-curtin-Tune-default-salt-minion-config.patch43
-rw-r--r--mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch95
-rw-r--r--mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch231
-rw-r--r--mcp/patches/salt-formula-maas/0007-region-s-syncdb-migrate-for-MaaS-2.4-compatibility.patch30
7 files changed, 792 insertions, 0 deletions
diff --git a/mcp/patches/salt-formula-maas/0001-maas-region-skip-credentials-update.patch b/mcp/patches/salt-formula-maas/0001-maas-region-skip-credentials-update.patch
new file mode 100644
index 000000000..eb607cf81
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0001-maas-region-skip-credentials-update.patch
@@ -0,0 +1,40 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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, 5 Aug 2017 02:03:01 +0200
+Subject: [PATCH] maas: region: skip credentials update
+
+Password update for maas psql database breaks ulterior acesses
+to maas-region syncdb.
+For now, limit regiond.conf changes to maas_url, and skip
+updating credentials.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ maas/region.sls | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/maas/region.sls b/maas/region.sls
+index 066490c..de5054a 100644
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -6,10 +6,9 @@ maas_region_packages:
+ - names: {{ region.pkgs }}
+
+ /etc/maas/regiond.conf:
+- file.managed:
+- - source: salt://maas/files/regiond.conf
+- - template: jinja
+- - group: maas
++ file.replace:
++ - pattern: ^maas_url.*$
++ - repl: "maas_url: http://{{ region.bind.host }}:5240/MAAS"
+ - require:
+ - pkg: maas_region_packages
+
diff --git a/mcp/patches/salt-formula-maas/0002-maas-region-allow-timeout-override.patch b/mcp/patches/salt-formula-maas/0002-maas-region-allow-timeout-override.patch
new file mode 100644
index 000000000..3d8deff60
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0002-maas-region-allow-timeout-override.patch
@@ -0,0 +1,85 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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, 23 Sep 2017 02:03:01 +0200
+Subject: [PATCH] maas: region: allow timeout override
+
+Two changes are squashed into a single patch so we can test for
+reverse-applying the cummulative diff.
+
+1. Poor implementation that allows overiding comissioning/deploying
+timeouts, which are hardcoded in MaaS source code.
+
+Add the following reclass _param:
+- opnfv_maas_timeout_comissioning;
+- opnfv_maas_timeout_deploying;
+
+The defaults are now 10/15 minutes (MaaS defaults to 20/40 min).
+
+2. maas: region: interface: default mode DHCP
+
+Switch MaaS interface mode default from AUTO to DHCP.
+This way, MaaS will not statically assign IPs *outside* the dynamic
+reserved range, but instead DHCP will assign them *inside* the range.
+
+One alternative would be to handle this via API calls, for each
+node's PXE physical interface, but that overcomplicates things.
+
+3. MaaS blocksize: For some reason the python library behind tftp forces ip
+blocksize to be 1008. We can force it to be 1464 and gain some performance due
+to MTU beeing 1500 (i.e. allow bigger packets).
+
+JIRA: FUEL-316
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ maas/region.sls | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/maas/region.sls b/maas/region.sls
+index de5054a..4a7f6cc 100644
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -38,6 +38,36 @@ restore_maas_database_{{ region.database.name }}:
+
+ {%- endif %}
+
++maas_timeout_commissioning:
++ file.replace:
++ - name: "/usr/lib/python3/dist-packages/maasserver/node_status.py"
++ - pattern: '^(\s+NODE_STATUS.COMMISSIONING:)\s+\d+,$'
++ - repl: \1 {{ salt['pillar.get']('_param:opnfv_maas_timeout_comissioning', '20') }},
++ - require:
++ - pkg: maas_region_packages
++ - require_in:
++ - service: maas_region_services
++
++maas_timeout_deploying:
++ file.replace:
++ - name: "/usr/lib/python3/dist-packages/maasserver/node_status.py"
++ - pattern: '^(\s+NODE_STATUS.DEPLOYING:)\s+\d+,$'
++ - repl: \1 {{ salt['pillar.get']('_param:opnfv_maas_timeout_deploying', '40') }},
++ - require:
++ - pkg: maas_region_packages
++ - require_in:
++ - service: maas_region_services
++
++maas_interface_default_mode_dhcp:
++ file.replace:
++ - name: "/usr/lib/python3/dist-packages/maasserver/models/node.py"
++ - pattern: '^(\s+INTERFACE_LINK_TYPE)\.AUTO'
++ - repl: \1.DHCP
++ - require:
++ - pkg: maas_region_packages
++ - require_in:
++ - service: maas_region_services
++
+ {%- if region.get('enable_iframe', False) %}
+
+ /etc/apache2/conf-enabled/maas-http.conf:
diff --git a/mcp/patches/salt-formula-maas/0003-Extend-wait_for-maas.py-wait_for_-attempts-arg.patch b/mcp/patches/salt-formula-maas/0003-Extend-wait_for-maas.py-wait_for_-attempts-arg.patch
new file mode 100644
index 000000000..efd7cc2fd
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0003-Extend-wait_for-maas.py-wait_for_-attempts-arg.patch
@@ -0,0 +1,268 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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: Sun, 23 Sep 2018 03:57:27 +0200
+Subject: [PATCH] Extend wait_for maas.py, wait_for_* attempts arg
+
+1. maas.py: Extend wait_for states with timeout param
+
+Extend the wait_for states with a timeout parameter.
+The timeout value is taken from reclass pillar data if
+defined. Oterwise, the states use the default value.
+Based on Ting's PR [1], slightly refactored.
+
+2. maas.py: Extend `req_status` support to multiple values
+
+Previously, req_status could be one of the MaaS status strings, e.g.
+'Ready'. Extend matching to '|'-separated statuses (e.g.
+'Ready|Deployed') to allow idempotency in MaaS machine commissioning
+and deployment cycles.
+
+Also provide a `maas.machines.wait_for_ready_or_deployed` sls.
+
+3. maas.py: wait_for_*: Add attempts arg
+
+Introduce a new parameter that allows a maximum number of automatic
+recovery attempts for the common failures w/ machine operations.
+If not present in pillar data, it defaults to 0 (OFF).
+
+Common error states, possible cause and automatic recovery pattern:
+* New
+ - usually indicates issues with BMC connectivity (no network route,
+ but on rare occassions it happens due to MaaS API being flaky);
+ - fix: delete the machine, (re)process machine definitions;
+* Failed commissioning
+ - various causes, usually a simple retry works;
+ - fix: delete the machine, (re)process machine definitions;
+* Failed testing
+ - incompatible hardware, missing drivers etc.
+ - usually consistent and board-specific;
+ - fix: override failed testing
+* Allocated
+ - on rare ocassions nodes get stuck in this state instead 'Deploy';
+ - fix: mark-broken, mark-fixed, if it failed at least once before
+ perform a fio test (fixes another unrelated spurious issue with
+ encrypted disks from previous deployments), (re)deploy machines;
+* Failed deployment
+ - various causes, usually a simple retry works;
+ - fix: same as for nodes stuck in 'Allocated';
+
+[1] https://github.com/salt-formulas/salt-formula-maas/pull/34
+
+Change-Id: Ifb7dd9f8fcfbbed557e47d8fdffb1f963604fb15
+Signed-off-by: ting wu <ting.wu@enea.com>
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ README.rst | 9 +++-
+ _modules/maas.py | 52 +++++++++++++++++---
+ maas/machines/wait_for_deployed.sls | 2 +
+ maas/machines/wait_for_ready.sls | 3 ++
+ maas/machines/wait_for_ready_or_deployed.sls | 15 ++++++
+ maas/map.jinja | 4 ++
+ tests/pillar/maas_region.sls | 4 ++
+ 7 files changed, 81 insertions(+), 8 deletions(-)
+ create mode 100644 maas/machines/wait_for_ready_or_deployed.sls
+
+diff --git a/README.rst b/README.rst
+index 20da43e..78d8aef 100644
+--- a/README.rst
++++ b/README.rst
+@@ -622,12 +622,16 @@ Wait for status of selected machine's:
+ machines:
+ - kvm01
+ - kvm02
+- timeout: 1200 # in seconds
++ timeout: {{ region.timeout.ready }}
++ attempts: {{ region.timeout.attempts }}
+ req_status: "Ready"
+ - require:
+ - cmd: maas_login_admin
+ ...
+
++The timeout setting is taken from the reclass pillar data.
++If the pillar data is not defined, it will use the default value.
++
+ If module run w/\o any extra paremeters,
+ ``wait_for_machines_ready`` will wait for defined in salt
+ machines. In this case, it is usefull to skip some machines:
+@@ -642,7 +646,8 @@ machines. In this case, it is usefull to skip some machines:
+ module.run:
+ - name: maas.wait_for_machine_status
+ - kwargs:
+- timeout: 1200 # in seconds
++ timeout: {{ region.timeout.deployed }}
++ attempts: {{ region.timeout.attempts }}
+ req_status: "Deployed"
+ ignore_machines:
+ - kvm01 # in case it's broken or whatever
+diff --git a/_modules/maas.py b/_modules/maas.py
+index c02f104..bb70576 100644
+--- a/_modules/maas.py
++++ b/_modules/maas.py
+@@ -670,7 +670,7 @@ class DeployMachines(MaasObject):
+ if machine['status'] == self.DEPLOYED:
+ return
+ if machine['status'] != self.READY:
+- raise Exception('Not in ready state')
++ return
+ data = {
+ 'system_id': machine['system_id'],
+ }
+@@ -921,6 +921,7 @@ class MachinesStatus(MaasObject):
+ req_status: string; Polling status
+ machines: list; machine names
+ ignore_machines: list; machine names
++ attempts: max number of automatic hard retries
+ :ret: True
+ Exception - if something fail/timeout reached
+ """
+@@ -929,6 +930,8 @@ class MachinesStatus(MaasObject):
+ req_status = kwargs.get("req_status", "Ready")
+ to_discover = kwargs.get("machines", None)
+ ignore_machines = kwargs.get("ignore_machines", None)
++ attempts = kwargs.get("attempts", 0)
++ failed_attempts = {}
+ if not to_discover:
+ try:
+ to_discover = __salt__['config.get']('maas')['region'][
+@@ -943,11 +946,46 @@ class MachinesStatus(MaasObject):
+ while len(total) <= len(to_discover):
+ for m in to_discover:
+ for discovered in MachinesStatus.execute()['machines']:
+- if m == discovered['hostname'] and \
+- discovered['status'].lower() == req_status.lower():
+- if m in total:
++ if m == discovered['hostname'] and m in total:
++ req_status_list = req_status.lower().split('|')
++ if discovered['status'].lower() in req_status_list:
+ total.remove(m)
+-
++ elif attempts > 0 and (m not in failed_attempts or
++ failed_attempts[m] < attempts):
++ status = discovered['status']
++ sid = discovered['system_id']
++ cls._maas = _create_maas_client()
++ if status in ['Failed commissioning', 'New']:
++ LOG.info('Machine {0} deleted'.format(sid))
++ cls._maas.delete(u'api/2.0/machines/{0}/'
++ .format(sid))
++ Machine().process()
++ elif status in ['Failed testing']:
++ data = {}
++ LOG.info('Machine {0} overriden'.format(sid))
++ action = 'override_failed_testing'
++ cls._maas.post(u'api/2.0/machines/{0}/'
++ .format(sid), action, **data)
++ elif status in ['Failed deployment', 'Allocated']:
++ data = {}
++ LOG.info('Machine {0} mark broken'.format(sid))
++ cls._maas.post(u'api/2.0/machines/{0}/'
++ .format(sid), 'mark_broken', **data)
++ time.sleep(poll_time)
++ LOG.info('Machine {0} mark fixed'.format(sid))
++ cls._maas.post(u'api/2.0/machines/{0}/'
++ .format(sid), 'mark_fixed', **data)
++ if m in failed_attempts and failed_attempts[m]:
++ LOG.info('Machine {0} fio test'.format(sid))
++ data['testing_scripts'] = 'fio'
++ cls._maas.post(u'api/2.0/machines/{0}/'
++ .format(sid), 'commission', **data)
++ DeployMachines().process()
++ else:
++ continue
++ if m not in failed_attempts:
++ failed_attempts[m] = 0
++ failed_attempts[m] = failed_attempts[m] + 1
+ if len(total) <= 0:
+ LOG.debug(
+ "Machines:{} are:{}".format(to_discover, req_status))
+@@ -959,7 +997,9 @@ class MachinesStatus(MaasObject):
+ "Waiting status:{} "
+ "for machines:{}"
+ "\nsleep for:{}s "
+- "Timeout:{}s".format(req_status, total, poll_time, timeout))
++ "Timeout:{}s ({}s left)"
++ .format(req_status, total, poll_time, timeout,
++ timeout - (time.time() - started_at)))
+ time.sleep(poll_time)
+
+
+diff --git a/maas/machines/wait_for_deployed.sls b/maas/machines/wait_for_deployed.sls
+index ebeedac..a646fdb 100644
+--- a/maas/machines/wait_for_deployed.sls
++++ b/maas/machines/wait_for_deployed.sls
+@@ -9,5 +9,7 @@ wait_for_machines_deployed:
+ - name: maas.wait_for_machine_status
+ - kwargs:
+ req_status: "Deployed"
++ timeout: {{ region.timeout.deployed }}
++ attempts: {{ region.timeout.attempts }}
+ - require:
+ - cmd: maas_login_admin
+diff --git a/maas/machines/wait_for_ready.sls b/maas/machines/wait_for_ready.sls
+index c5d3c28..d8a2963 100644
+--- a/maas/machines/wait_for_ready.sls
++++ b/maas/machines/wait_for_ready.sls
+@@ -7,5 +7,8 @@ maas_login_admin:
+ wait_for_machines_ready:
+ module.run:
+ - name: maas.wait_for_machine_status
++ - kwargs:
++ timeout: {{ region.timeout.ready }}
++ attempts: {{ region.timeout.attempts }}
+ - require:
+ - cmd: maas_login_admin
+diff --git a/maas/machines/wait_for_ready_or_deployed.sls b/maas/machines/wait_for_ready_or_deployed.sls
+new file mode 100644
+index 0000000..db3dcc4
+--- /dev/null
++++ b/maas/machines/wait_for_ready_or_deployed.sls
+@@ -0,0 +1,15 @@
++{%- from "maas/map.jinja" import region with context %}
++
++maas_login_admin:
++ cmd.run:
++ - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
++
++wait_for_machines_ready_or_deployed:
++ module.run:
++ - name: maas.wait_for_machine_status
++ - kwargs:
++ req_status: "Ready|Deployed"
++ timeout: {{ region.timeout.ready }}
++ attempts: {{ region.timeout.attempts }}
++ - require:
++ - cmd: maas_login_admin
+diff --git a/maas/map.jinja b/maas/map.jinja
+index 0671435..1e6ac07 100644
+--- a/maas/map.jinja
++++ b/maas/map.jinja
+@@ -22,6 +22,10 @@ Debian:
+ bind:
+ host: 0.0.0.0
+ port: 80
++ timeout:
++ ready: 1200
++ deployed: 7200
++ attempts: 0
+ {%- endload %}
+
+ {%- set region = salt['grains.filter_by'](region_defaults, merge=salt['pillar.get']('maas:region', {})) %}
+diff --git a/tests/pillar/maas_region.sls b/tests/pillar/maas_region.sls
+index d3325eb..d710216 100644
+--- a/tests/pillar/maas_region.sls
++++ b/tests/pillar/maas_region.sls
+@@ -34,3 +34,7 @@ maas:
+ password: password
+ username: maas
+ salt_master_ip: 127.0.0.1
++ timeout:
++ deployed: 900
++ ready: 900
++ attempts: 2
diff --git a/mcp/patches/salt-formula-maas/0004-curtin-Tune-default-salt-minion-config.patch b/mcp/patches/salt-formula-maas/0004-curtin-Tune-default-salt-minion-config.patch
new file mode 100644
index 000000000..978f4ecb6
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0004-curtin-Tune-default-salt-minion-config.patch
@@ -0,0 +1,43 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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: Mon, 5 Nov 2018 16:47:13 +0100
+Subject: [PATCH] curtin: Tune default salt-minion config
+
+* Sync AArch64 configuration with the changes introduced by commit
+ c6a12de on amd64
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ maas/files/curtin_userdata_arm64_generic_xenial | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/maas/files/curtin_userdata_arm64_generic_xenial b/maas/files/curtin_userdata_arm64_generic_xenial
+index af9a047..1b2e401 100644
+--- a/maas/files/curtin_userdata_arm64_generic_xenial
++++ b/maas/files/curtin_userdata_arm64_generic_xenial
+@@ -32,8 +32,16 @@ late_commands:
+ apt_03_update: ["curtin", "in-target", "--", "apt-get", "update"]
+ salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion", "python-futures"]
+ salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
+- salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion"]
+- salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }}' >> /etc/salt/minion"]
++ salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion.d/minion.conf"]
++ salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }}' >> /etc/salt/minion.d/minion.conf"]
++ salt_05_max_event_size: ["curtin", "in-target", "--", "sh", "-c", "echo 'max_event_size: 100000000' >> /etc/salt/minion.d/minion.conf"]
++ salt_06_acceptance_wait_time_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time_max: 60' >> /etc/salt/minion.d/minion.conf"]
++ salt_07_acceptance_wait_time: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time: 10' >> /etc/salt/minion.d/minion.conf"]
++ salt_08_random_reauth_delay: ["curtin", "in-target", "--", "sh", "-c", "echo 'random_reauth_delay: 270' >> /etc/salt/minion.d/minion.conf"]
++ salt_09_recon_default: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_default: 1000' >> /etc/salt/minion.d/minion.conf"]
++ salt_10_recon_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_max: 60000' >> /etc/salt/minion.d/minion.conf"]
++ salt_11_recon_randomize: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_randomize: True' >> /etc/salt/minion.d/minion.conf"]
++ salt_12_auth_timeout: ["curtin", "in-target", "--", "sh", "-c", "echo 'auth_timeout: 60' >> /etc/salt/minion.d/minion.conf"]
+ {% raw %}
+ {{if third_party_drivers and driver}}
+ driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
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..09d21d022
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0005-Implement-tags-support.patch
@@ -0,0 +1,95 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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 bb70576..0cda8dd 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):
+@@ -1065,5 +1087,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 %}
diff --git a/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch b/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch
new file mode 100644
index 000000000..c69507b20
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0006-curtin-Add-Bionic-support.patch
@@ -0,0 +1,231 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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: Wed, 16 Oct 2019 15:02:39 +0200
+Subject: [PATCH] curtin: Add Bionic support
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ .../curtin_userdata_amd64_generic_bionic | 84 +++++++++++++++++++
+ .../curtin_userdata_arm64_generic_bionic | 79 +++++++++++++++++
+ maas/region.sls | 24 ++++++
+ 3 files changed, 187 insertions(+)
+ create mode 100644 maas/files/curtin_userdata_amd64_generic_bionic
+ create mode 100644 maas/files/curtin_userdata_arm64_generic_bionic
+
+diff --git a/maas/files/curtin_userdata_amd64_generic_bionic b/maas/files/curtin_userdata_amd64_generic_bionic
+new file mode 100644
+index 0000000..11af3cf
+--- /dev/null
++++ b/maas/files/curtin_userdata_amd64_generic_bionic
+@@ -0,0 +1,84 @@
++{%- from "maas/map.jinja" import cluster with context %}
++{%- raw %}
++#cloud-config
++debconf_selections:
++ maas: |
++ {{for line in str(curtin_preseed).splitlines()}}
++ {{line}}
++ {{endfor}}
++early_commands:
++ thin_tools_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install thin-provisioning-tools"]
++{{if third_party_drivers and driver}}
++ {{py: key_string = ''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}
++ driver_00_get_key: /bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg
++ driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
++ driver_02_add: ["add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
++ driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver['package']}}"]
++ driver_04_load: ["sh", "-c", "depmod && modprobe {{driver['module']}}"]
++{{endif}}
++late_commands:
++ maas: [wget, '--no-proxy', {{node_disable_pxe_url|escape.json}}, '--post-data', {{node_disable_pxe_data|escape.json}}, '-O', '/dev/null']
++{% endraw %}
++
++{%- if cluster.get('saltstack_repo_key', False) %}
++ {% set salt_repo_key = salt['hashutil.base64_b64encode'](cluster.saltstack_repo_key) %}
++ apt_00_set_gpg: ["curtin", "in-target", "--", "sh", "-c", "echo '{{salt_repo_key}}' | base64 -d | apt-key add -"]
++{%- endif %}
++{% if cluster.saltstack_repo_bionic.startswith('deb') %}
++ {%- set saltstack_repo = cluster.saltstack_repo_bionic -%}
++{%- else %}
++ {%- set saltstack_repo = 'deb [arch=amd64] ' + cluster.saltstack_repo_bionic -%}
++{%- endif %}
++
++ apt_01_set_repo: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ saltstack_repo }}' >> /etc/apt/sources.list.d/mcp_saltstack.list"]
++ apt_03_update: ["curtin", "in-target", "--", "apt-get", "update"]
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:bionic:extra_pkgs:enabled')|default(false) %}
++ {% for pkg in pillar.maas.cluster.curtin_vars.amd64.bionic.extra_pkgs.pkgs -%}
++ apt_04_install_pkgs_{{ loop.index }}: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pkg }}"]
++ {% endfor %}
++{%- endif %}
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:bionic:kernel_package:enabled')|default(false) %}
++ apt_05_kernel_old_absent: ["curtin", "in-target", "--", "sh", "-c", "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' '*linux-modules-extra-*[0-9]*' 'linux-generic' 'linux-image-generic' 'linux-headers-generic' 2>/dev/null | grep -E '^ii' | awk '{print $2}' | grep -v '{{ pillar.maas.cluster.curtin_vars.amd64.bionic.kernel_package.value.split('-')[2:-1] | join('-') }}' | xargs dpkg --purge --force-depends"]
++{%- endif %}
++ salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion", "ifupdown", "cloud-init", "dnsmasq"]
++ salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
++ salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion.d/minion.conf"]
++ salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }}' >> /etc/salt/minion.d/minion.conf"]
++ salt_05_max_event_size: ["curtin", "in-target", "--", "sh", "-c", "echo 'max_event_size: 100000000' >> /etc/salt/minion.d/minion.conf"]
++ salt_06_acceptance_wait_time_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time_max: 60' >> /etc/salt/minion.d/minion.conf"]
++ salt_07_acceptance_wait_time: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time: 10' >> /etc/salt/minion.d/minion.conf"]
++ salt_08_random_reauth_delay: ["curtin", "in-target", "--", "sh", "-c", "echo 'random_reauth_delay: 270' >> /etc/salt/minion.d/minion.conf"]
++ salt_09_recon_default: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_default: 1000' >> /etc/salt/minion.d/minion.conf"]
++ salt_10_recon_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_max: 60000' >> /etc/salt/minion.d/minion.conf"]
++ salt_11_recon_randomize: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_randomize: True' >> /etc/salt/minion.d/minion.conf"]
++ salt_12_auth_timeout: ["curtin", "in-target", "--", "sh", "-c", "echo 'auth_timeout: 60' >> /etc/salt/minion.d/minion.conf"]
++
++ salt_20_bionic_nplan_stop: ["curtin", "in-target", "--", "systemctl", "stop", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_21_bionic_nplan_disable: ["curtin", "in-target", "--", "systemctl", "disable", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_22_bionic_nplan_mask: ["curtin", "in-target", "--", "systemctl", "mask", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_23_bionic_nplan_purge: ["curtin", "in-target", "--", "apt", "--assume-yes", "purge", "nplan", "netplan.io"]
++ salt_24_bionic_interfaces: ["curtin", "in-target", "--", "sh", "-c", "echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces"]
++ salt_25_bionic_networking_unmask: ["curtin", "in-target", "--", "systemctl", "unmask", "networking.service"]
++ salt_26_bionic_networking_enable: ["curtin", "in-target", "--", "systemctl", "enable", "networking.service"]
++ salt_27_bionic_networking_start: ["curtin", "in-target", "--", "systemctl", "start", "networking.service"]
++
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:bionic:kernel_package:enabled')|default(false) %}
++kernel:
++ package: {{ pillar.maas.cluster.curtin_vars.amd64.bionic.kernel_package.value }}
++{%- endif %}
++
++{% raw %}
++{{if third_party_drivers and driver}}
++ driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
++ driver_02_key_add: ["curtin", "in-target", "--", "apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
++ driver_03_add: ["curtin", "in-target", "--", "add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
++ driver_04_update_install: ["curtin", "in-target", "--", "apt-get", "update", "--quiet"]
++ driver_05_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{driver['package']}}"]
++ driver_06_depmod: ["curtin", "in-target", "--", "depmod"]
++ driver_07_update_initramfs: ["curtin", "in-target", "--", "update-initramfs", "-u"]
++{{endif}}
++{% endraw %}
++
++{#
++# vim: ft=jinja
++#}
+diff --git a/maas/files/curtin_userdata_arm64_generic_bionic b/maas/files/curtin_userdata_arm64_generic_bionic
+new file mode 100644
+index 0000000..006d8c2
+--- /dev/null
++++ b/maas/files/curtin_userdata_arm64_generic_bionic
+@@ -0,0 +1,79 @@
++{%- from "maas/map.jinja" import cluster with context %}
++{% raw %}
++#cloud-config
++debconf_selections:
++ maas: |
++ {{for line in str(curtin_preseed).splitlines()}}
++ {{line}}
++ {{endfor}}
++early_commands:
++ thin_tools_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install thin-provisioning-tools"]
++{{if third_party_drivers and driver}}
++ {{py: key_string = ''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}
++ driver_00_get_key: /bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg
++ driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
++ driver_02_add: ["add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
++ driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver['package']}}"]
++ driver_04_load: ["sh", "-c", "depmod && modprobe {{driver['module']}}"]
++{{endif}}
++late_commands:
++ maas: [wget, '--no-proxy', {{node_disable_pxe_url|escape.json}}, '--post-data', {{node_disable_pxe_data|escape.json}}, '-O', '/dev/null']
++{% endraw %}
++{%- if cluster.get('saltstack_repo_key', False) %}
++ {% set salt_repo_key = salt['hashutil.base64_b64encode'](cluster.saltstack_repo_key) %}
++ apt_00_set_gpg: ["curtin", "in-target", "--", "sh", "-c", "echo '{{salt_repo_key}}' | base64 -d | apt-key add -"]
++{%- endif %}
++{% if cluster.saltstack_repo_bionic.startswith('deb') %}
++ {%- set saltstack_repo = cluster.saltstack_repo_bionic -%}
++{%- else %}
++ {%- set saltstack_repo = 'deb [arch=amd64] ' + cluster.saltstack_repo_bionic -%}
++{%- endif %}
++{#- NOTE: Re-use amd64 repos on arm64 since most packages are arch independent #}
++ apt_01_set_repo: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ saltstack_repo }}' >> /etc/apt/sources.list.d/mcp_saltstack.list"]
++ apt_03_update: ["curtin", "in-target", "--", "apt-get", "update"]
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:extra_pkgs:enabled')|default(false) %}
++ {% for pkg in pillar.maas.cluster.curtin_vars.arm64.bionic.extra_pkgs.pkgs -%}
++ apt_04_install_pkgs_{{ loop.index }}: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pkg }}"]
++ {% endfor %}
++{%- endif %}
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:kernel_package:enabled')|default(false) %}
++ apt_05_kernel_old_absent: ["curtin", "in-target", "--", "sh", "-c", "dpkg -l '*linux-generic-*[0-9]*' '*linux-image-*[0-9]*' '*linux-headers-*[0-9]*' '*linux-image-extra-*[0-9]*' '*linux-modules-extra-*[0-9]*' 'linux-generic' 'linux-image-generic' 'linux-headers-generic' 2>/dev/null | grep -E '^ii' | awk '{print $2}' | grep -v '{{ pillar.maas.cluster.curtin_vars.arm64.bionic.kernel_package.value.split('-')[2:-1] | join('-') }}' | xargs dpkg --purge --force-depends"]
++{%- endif %}
++ salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion", "python-futures", "ifupdown", "cloud-init", "dnsmasq"]
++ salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
++ salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion.d/minion.conf"]
++ salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }}' >> /etc/salt/minion.d/minion.conf"]
++ salt_05_max_event_size: ["curtin", "in-target", "--", "sh", "-c", "echo 'max_event_size: 100000000' >> /etc/salt/minion.d/minion.conf"]
++ salt_06_acceptance_wait_time_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time_max: 60' >> /etc/salt/minion.d/minion.conf"]
++ salt_07_acceptance_wait_time: ["curtin", "in-target", "--", "sh", "-c", "echo 'acceptance_wait_time: 10' >> /etc/salt/minion.d/minion.conf"]
++ salt_08_random_reauth_delay: ["curtin", "in-target", "--", "sh", "-c", "echo 'random_reauth_delay: 270' >> /etc/salt/minion.d/minion.conf"]
++ salt_09_recon_default: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_default: 1000' >> /etc/salt/minion.d/minion.conf"]
++ salt_10_recon_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_max: 60000' >> /etc/salt/minion.d/minion.conf"]
++ salt_11_recon_randomize: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_randomize: True' >> /etc/salt/minion.d/minion.conf"]
++ salt_12_auth_timeout: ["curtin", "in-target", "--", "sh", "-c", "echo 'auth_timeout: 60' >> /etc/salt/minion.d/minion.conf"]
++
++ salt_20_bionic_nplan_stop: ["curtin", "in-target", "--", "systemctl", "stop", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_21_bionic_nplan_disable: ["curtin", "in-target", "--", "systemctl", "disable", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_22_bionic_nplan_mask: ["curtin", "in-target", "--", "systemctl", "mask", "systemd-networkd.socket", "systemd-networkd", "networkd-dispatcher", "systemd-networkd-wait-online", "systemd-resolved"]
++ salt_23_bionic_nplan_purge: ["curtin", "in-target", "--", "apt", "--assume-yes", "purge", "nplan", "netplan.io"]
++ salt_24_bionic_interfaces: ["curtin", "in-target", "--", "sh", "-c", "echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces"]
++ salt_25_bionic_networking_unmask: ["curtin", "in-target", "--", "systemctl", "unmask", "networking.service"]
++ salt_26_bionic_networking_enable: ["curtin", "in-target", "--", "systemctl", "enable", "networking.service"]
++ salt_27_bionic_networking_start: ["curtin", "in-target", "--", "systemctl", "start", "networking.service"]
++
++{%- if salt['pillar.get']('maas:cluster:curtin_vars:arm64:bionic:kernel_package:enabled')|default(false) %}
++kernel:
++ package: {{ pillar.maas.cluster.curtin_vars.arm64.bionic.kernel_package.value }}
++{%- endif %}
++
++{% raw %}
++{{if third_party_drivers and driver}}
++ driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
++ driver_02_key_add: ["curtin", "in-target", "--", "apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
++ driver_03_add: ["curtin", "in-target", "--", "add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
++ driver_04_update_install: ["curtin", "in-target", "--", "apt-get", "update", "--quiet"]
++ driver_05_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{driver['package']}}"]
++ driver_06_depmod: ["curtin", "in-target", "--", "depmod"]
++ driver_07_update_initramfs: ["curtin", "in-target", "--", "update-initramfs", "-u"]
++{{endif}}
++{% endraw %}
+diff --git a/maas/region.sls b/maas/region.sls
+index 52fb952..ca876ee 100644
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -138,6 +138,30 @@ maas_apache_headers:
+ - require:
+ - pkg: maas_region_packages
+
++/etc/maas/preseeds/curtin_userdata_amd64_generic_bionic:
++ file.managed:
++ - source: salt://maas/files/curtin_userdata_amd64_generic_bionic
++ - template: jinja
++ - user: root
++ - group: root
++ - mode: 644
++ - context:
++ salt_master_ip: {{ region.salt_master_ip }}
++ - require:
++ - pkg: maas_region_packages
++
++/etc/maas/preseeds/curtin_userdata_arm64_generic_bionic:
++ file.managed:
++ - source: salt://maas/files/curtin_userdata_arm64_generic_bionic
++ - template: jinja
++ - user: root
++ - group: root
++ - mode: 644
++ - context:
++ salt_master_ip: {{ region.salt_master_ip }}
++ - require:
++ - pkg: maas_region_packages
++
+ Configure /root/.pgpass for MAAS:
+ file.managed:
+ - name: /root/.pgpass
diff --git a/mcp/patches/salt-formula-maas/0007-region-s-syncdb-migrate-for-MaaS-2.4-compatibility.patch b/mcp/patches/salt-formula-maas/0007-region-s-syncdb-migrate-for-MaaS-2.4-compatibility.patch
new file mode 100644
index 000000000..f0a70ffc4
--- /dev/null
+++ b/mcp/patches/salt-formula-maas/0007-region-s-syncdb-migrate-for-MaaS-2.4-compatibility.patch
@@ -0,0 +1,30 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 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: Mon, 27 Jan 2020 17:10:04 +0100
+Subject: [PATCH] region: s/syncdb/migrate/ for MaaS 2.4 compatibility
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ maas/region.sls | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/maas/region.sls b/maas/region.sls
+index ca876ee..31e9906 100644
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -186,7 +186,7 @@ maas_region_services:
+ maas_region_syncdb:
+ cmd.run:
+ - names:
+- - maas-region syncdb --noinput
++ - maas-region migrate --noinput
+ - require:
+ - file: /etc/maas/regiond.conf
+ {%- if grains['saltversioninfo'][0] >= 2017 and grains['saltversioninfo'][1] >= 7 %}