[baremetal] MaaS: Fix DHCP dynamic reserved range 35/49235/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sat, 16 Dec 2017 20:11:26 +0000 (21:11 +0100)
committerMichael Polenchuk <mpolenchuk@mirantis.com>
Tue, 19 Dec 2017 07:36:27 +0000 (07:36 +0000)
- patch MaaS to default to `DHCP` instead of `AUTO` for physical
  PXE interfaces (all IPs will be handed out by MaaS DHCP *inside* the
  defined dynamic DHCP IP range);

JIRA: FUEL-316

Change-Id: I81fad333e77f7c8508cd2b2b267c7b39c130e3e1
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(partially cherry picked from commit 215a37d5)

mcp/patches/0011-maas-region-interface-default-mode-DHCP.patch [new file with mode: 0644]
mcp/patches/patches.list

diff --git a/mcp/patches/0011-maas-region-interface-default-mode-DHCP.patch b/mcp/patches/0011-maas-region-interface-default-mode-DHCP.patch
new file mode 100644 (file)
index 0000000..d161a95
--- /dev/null
@@ -0,0 +1,44 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2017 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, 18 Dec 2017 02:03:01 +0200
+Subject: [PATCH] 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.
+
+JIRA: FUEL-316
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+
+diff --git a/maas/region.sls b/maas/region.sls
+--- a/maas/region.sls
++++ b/maas/region.sls
+@@ -39,6 +39,16 @@
+     - 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:
index a54fadc..f2549d7 100644 (file)
@@ -14,4 +14,5 @@
 /usr/share/salt-formulas/env: 0008-Handle-file_recv-option.patch
 /usr/share/salt-formulas/env: 0010-maas-region-allow-timeout-override.patch
 /usr/share/salt-formulas/reclass: 0011-service.horizon.server.cluster-Default-to-v2-API.patch
+/usr/share/salt-formulas/env: 0011-maas-region-interface-default-mode-DHCP.patch
 /usr/share/salt-formulas/env: 0012-linux.storage.lvm-Disable-filter.patch