p/fuel: Re-parametrize Openstack public net 01/39901/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 22 Aug 2017 19:01:34 +0000 (21:01 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 22 Aug 2017 19:04:21 +0000 (21:04 +0200)
Instead of passing public net via local_env, deduce its range
based on compute external IPs.

Change-Id: Ib736921c1d0f4002ea33677e7d794fd3e22001ba
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
patches/opnfv-fuel/0000-states-network-parametrize-Openstack-public-net.patch [new file with mode: 0644]
patches/opnfv-fuel/0005-network-public-Use-arm-virtual2-POD-config.patch
patches/opnfv-fuel/0007-states-network-parametrize-openstack-public-net.patch [deleted file]

diff --git a/patches/opnfv-fuel/0000-states-network-parametrize-Openstack-public-net.patch b/patches/opnfv-fuel/0000-states-network-parametrize-Openstack-public-net.patch
new file mode 100644 (file)
index 0000000..4d776bc
--- /dev/null
@@ -0,0 +1,45 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Thu, 17 Aug 2017 18:54:16 +0200
+Subject: [PATCH] states/network: parametrize Openstack public net
+
+Determine public network based on public IPs of compute nodes.
+
+Change-Id: I5a6b29a0458b0b839f8fdb3e32616a41d7a621f7
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ mcp/config/states/networks | 28 +++++++++++++++++++++++++---
+ 1 file changed, 25 insertions(+), 3 deletions(-)
+
+diff --git a/mcp/config/states/networks b/mcp/config/states/networks
+index 205e0a9..6f294ce 100755
+--- a/mcp/config/states/networks
++++ b/mcp/config/states/networks
+@@ -1,3 +1,25 @@
+-salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume service list"
+-salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --external --default --provider-network-type flat --provider-physical-network physnet1 floating_net"
+-salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet"
++#!/bin/bash
++
++# Determine public network based on external IPs from compute node
++# NOTE: mask currently hardcoded to /24
++PUBLIC_NET=$(salt --out yaml 'cmp*' pillar.get _param:external_address | \
++  awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
++
++[ -n "${PUBLIC_NET}" ] || PUBLIC_NET=$(salt --out yaml 'cmp*' \
++  pillar.get _param:openstack_compute_node01_external_address | \
++  awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
++
++[ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24"
++
++salt 'ctl01*' cmd.run ". /root/keystonercv3; \
++  openstack compute service list; \
++  openstack network agent list; \
++  openstack stack list; \
++  openstack volume service list"
++salt 'ctl01*' cmd.run ". /root/keystonercv3; \
++  openstack network create --external --default --provider-network-type flat \
++    --provider-physical-network physnet1 floating_net"
++salt 'ctl01*' cmd.run ". /root/keystonercv3; \
++  openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \
++    --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \
++    --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"
index 7d91ac6..fb678ce 100644 (file)
@@ -26,7 +26,7 @@ range for the public network to not include that address.
 
 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
 ---
- mcp/config/states/networks                                          | 2 +-
+ mcp/config/states/networks                                          | 6 +++---
  mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml  | 6 +++---
  .../classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml        | 2 +-
  .../classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml     | 6 +++---
@@ -34,17 +34,30 @@ Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
  mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml  | 6 +++---
  .../classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml        | 2 +-
  mcp/scripts/net_public.xml                                          | 2 +-
- 8 files changed, 14 insertions(+), 14 deletions(-)
+ 8 files changed, 16 insertions(+), 16 deletions(-)
 
 diff --git a/mcp/config/states/networks b/mcp/config/states/networks
-index 205e0a9..df4c0bb 100755
+index 6f294ce..fced1eb 100755
 --- a/mcp/config/states/networks
 +++ b/mcp/config/states/networks
-@@ -1,3 +1,3 @@
- salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume service list"
- salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --external --default --provider-network-type flat --provider-physical-network physnet1 floating_net"
--salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet"
-+salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.0.9.254 --no-dhcp --allocation-pool start=10.0.9.130,end=10.0.9.200 --network floating_net --subnet-range 10.0.9.0/24 floating_subnet"
+@@ -9,7 +9,7 @@ PUBLIC_NET=$(salt --out yaml 'cmp*' pillar.get _param:external_address | \
+   pillar.get _param:openstack_compute_node01_external_address | \
+   awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
+
+-[ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24"
++[ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.0.9.0/24"
+
+ salt 'ctl01*' cmd.run ". /root/keystonercv3; \
+   openstack compute service list; \
+@@ -20,6 +20,6 @@ salt 'ctl01*' cmd.run ". /root/keystonercv3; \
+   openstack network create --external --default --provider-network-type flat \
+     --provider-physical-network physnet1 floating_net"
+ salt 'ctl01*' cmd.run ". /root/keystonercv3; \
+-  openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \
+-    --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \
++  openstack subnet create --gateway ${PUBLIC_NET%.*}.254 --no-dhcp \
++    --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.200 \
+     --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"
 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml
 index 57c6cec..f519e22 100644
 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml
diff --git a/patches/opnfv-fuel/0007-states-network-parametrize-openstack-public-net.patch b/patches/opnfv-fuel/0007-states-network-parametrize-openstack-public-net.patch
deleted file mode 100644 (file)
index 63abf6c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-Date: Thu, 17 Aug 2017 18:54:16 +0200
-Subject: [PATCH] states/network: parametrize openstack public net
-
-Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
----
- mcp/config/states/networks | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/mcp/config/states/networks b/mcp/config/states/networks
-index df4c0bb..88111e5 100755
---- a/mcp/config/states/networks
-+++ b/mcp/config/states/networks
-@@ -1,3 +1,6 @@
-+#!/bin/bash
-+OPENSTACK_PUBLIC_NET=${OPENSTACK_PUBLIC_NET:-10.0.9.0/24}
-+
- salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume service list"
- salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --external --default --provider-network-type flat --provider-physical-network physnet1 floating_net"
--salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.0.9.254 --no-dhcp --allocation-pool start=10.0.9.130,end=10.0.9.200 --network floating_net --subnet-range 10.0.9.0/24 floating_subnet"
-+salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway ${OPENSTACK_PUBLIC_NET%.*}.254 --no-dhcp --allocation-pool start=${OPENSTACK_PUBLIC_NET%.*}.130,end=${OPENSTACK_PUBLIC_NET%.*}.200 --network floating_net --subnet-range ${OPENSTACK_PUBLIC_NET} floating_subnet"