aboutsummaryrefslogtreecommitdiffstats
path: root/mcp
diff options
context:
space:
mode:
authorMichael Polenchuk <mpolenchuk@mirantis.com>2018-06-25 21:42:26 +0400
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-06-27 15:10:22 +0200
commitc0161169de2a8e149818c277d19f00fe95d3b1fc (patch)
tree156f9c5e6ab438e87ee11ae3d62673ae0a91e6d2 /mcp
parent56a5525a3ceafd6cbdeee239dc17c6e0a1a94f69 (diff)
[ha] Add fabric to maas admin subnet
Change-Id: Ida4cf736dfe60886384e7e180d3e43faf811bd58 Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com> (cherry picked from commit 75cbbc689bd9428384f4828f970981da52e92a04)
Diffstat (limited to 'mcp')
-rw-r--r--mcp/patches/0006-maas-module-Add-VLAN-DHCP-enable-support.patch89
-rw-r--r--mcp/patches/patches.list1
-rw-r--r--mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas_pdf.yml.j213
3 files changed, 8 insertions, 95 deletions
diff --git a/mcp/patches/0006-maas-module-Add-VLAN-DHCP-enable-support.patch b/mcp/patches/0006-maas-module-Add-VLAN-DHCP-enable-support.patch
deleted file mode 100644
index d2f531168..000000000
--- a/mcp/patches/0006-maas-module-Add-VLAN-DHCP-enable-support.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-: 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, 19 Aug 2017 02:03:01 +0200
-Subject: [PATCH] maas: module: Add VLAN DHCP enable support
-
-MaaS custom py module does not support VLAN configuration.
-This should be implemented by adding a dedicated class for VLAN.
-However, we are only interested in updating an existign VLAN to
-enable DHCP on an existing IP range (set up via subnet configuration),
-so extend existing subnet handling to include basic VLAN update.
-
-NOTE: Design-wise, this is hacky, and its only purpose is to allow
-setting 'dhcp_on=True' for an existing VLAN.
-
-Example reclass model usage:
-maas:
- region:
- subnets:
- 192.168.11.0/24:
- # ...
- vlans:
- untagged:
- vid: 0
- dhcp_on: true
- primary_rack: mas01
-
-Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
----
-
-diff --git a/_modules/maas.py b/_modules/maas.py
-index d3227ca..8a2243d 100644
---- a/_modules/maas.py
-+++ b/_modules/maas.py
-@@ -204,6 +204,7 @@
- 'gateway_ip': subnet['gateway_ip'],
- }
- self._iprange = subnet['iprange']
-+ self._vlans = subnet['vlans']
- return data
-
- def update(self, new, old):
-@@ -214,6 +215,7 @@
- response = super(Subnet, self).send(data)
- res_json = json.loads(response)
- self._process_iprange(res_json['id'])
-+ self._process_dhcp_vlans_update(data)
- return response
-
- def _get_fabric_from_cidr(self, cidr):
-@@ -248,6 +250,32 @@
- else:
- self._maas.post(u'api/2.0/ipranges/', None, **data)
-
-+ def _process_dhcp_vlans_update(self, subnet_data):
-+ fabric_vlans = json.loads(self._maas.get(u'api/2.0/fabrics/{0}/vlans/'
-+ .format(subnet_data['fabric'])).read())
-+ LOG.warn('all fabric %s vlans %s', subnet_data['fabric'], fabric_vlans)
-+ for vlan_name, vlan_data in self._vlans.iteritems():
-+ update = False
-+ old_data = None
-+ for fabric_vlan in fabric_vlans:
-+ if fabric_vlan['vid'] == vlan_data['vid']:
-+ update = True
-+ old_data = fabric_vlan
-+ break
-+ data = {
-+ 'mtu': str(vlan_data.get('mtu', 1500)),
-+ 'dhcp_on': str(vlan_data.get('dhcp_on')),
-+ 'primary_rack': str(vlan_data.get('primary_rack')),
-+ 'secondary_rack': str(vlan_data.get('secondary_rack', ''))
-+ }
-+ if update:
-+ LOG.warn('UPDATING %s %s', data, old_data)
-+ self._maas.put(u'api/2.0/fabrics/{0}/vlans/{1}/'
-+ .format(subnet_data['fabric'], old_data['vid']),
-+ **data)
-+ else:
-+ LOG.warn('MISSING vlan %s, not doing anything', data)
-+
-
- class DHCPSnippet(MaasObject):
- def __init__(self):
diff --git a/mcp/patches/patches.list b/mcp/patches/patches.list
index fbc671f31..bd57ecdb0 100644
--- a/mcp/patches/patches.list
+++ b/mcp/patches/patches.list
@@ -7,7 +7,6 @@
##############################################################################
/usr/share/salt-formulas/env: 0002-maas-region-skip-credentials-update.patch
/usr/share/salt-formulas/env: 0003-maas-region-force-artifact-download.patch
-/usr/share/salt-formulas/env: 0006-maas-module-Add-VLAN-DHCP-enable-support.patch
/usr/share/salt-formulas/env: 0007-network.interface-Fix-ifup-OVS-port-with-route.patch
/usr/share/salt-formulas/env: 0008-Handle-extra-environment-variables.patch
/usr/share/salt-formulas/env: 0010-maas-region-allow-timeout-override.patch
diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas_pdf.yml.j2 b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas_pdf.yml.j2
index 1838590e9..7d338dd02 100644
--- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas_pdf.yml.j2
+++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas_pdf.yml.j2
@@ -22,15 +22,18 @@ parameters:
name: {{ net_admin }}
cidr: {{ net_admin }}
gateway_ip: ${_param:single_address}
+ fabric: fabric-2
iprange:
start: ${_param:opnfv_infra_maas_pxe_start_address}
end: ${_param:opnfv_infra_maas_pxe_end_address}
type: dynamic
- vlans:
- untagged:
- vid: 0
- dhcp_on: true
- primary_rack: ${_param:infra_maas_node01_hostname}
+ fabrics:
+ fabric-2:
+ description: "Fabric Admin"
+ vlan:
+ 0:
+ description: "VLAN 0"
+ dhcp: true
# Space-separated list of dpkg architectures to be supported by MaaS
opnfv_arches:{%- for arch in cluster_arch %} {{ arch | dpkg_arch }}{%- endfor %}
sshprefs: