Commit 85485bca authored by Tim Rozet's avatar Tim Rozet

Fixes attach/detach functions and minor netenv fix

Tested manually and verified on LF pod1

Change-Id: I882ad9beef003a795585ffb8542aa11aecb67949
Signed-off-by: default avatarTim Rozet <trozet@redhat.com>
parent 8a46a78d
...@@ -591,6 +591,7 @@ function configure_network_environment { ...@@ -591,6 +591,7 @@ function configure_network_environment {
sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: '${public_network_cidr}'' $1 sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: '${public_network_cidr}'' $1
sed -i "/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${public_network_usable_ip_range%%,*}', 'end': '${public_network_usable_ip_range##*,}'}]" $1 sed -i "/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${public_network_usable_ip_range%%,*}', 'end': '${public_network_usable_ip_range##*,}'}]" $1
sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: '${public_network_gateway}'' $1 sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: '${public_network_gateway}'' $1
sed -i '/EC2MetadataIp/c\\ EC2MetadataIp: '${admin_network_provisioner_ip}'' $1
} }
##Copy over the glance images and instack json file ##Copy over the glance images and instack json file
##params: none ##params: none
......
...@@ -353,35 +353,38 @@ function attach_interface_to_ovs { ...@@ -353,35 +353,38 @@ function attach_interface_to_ovs {
# move old config file to .orig # move old config file to .orig
mv -f ${if_file} ${if_file}.orig mv -f ${if_file} ${if_file}.orig
echo "DEVICE=${interface}, echo "DEVICE=${interface}
TYPE=OVSPort, DEVICETYPE=ovs
PEERDNS=no, TYPE=OVSPort
BOOTPROTO=static, PEERDNS=no
NM_CONTROLLED=no, BOOTPROTO=static
ONBOOT=yes, NM_CONTROLLED=no
OVS_BRIDGE=${bridge}, ONBOOT=yes
OVS_BRIDGE=${bridge}
PROMISC=yes" > ${if_file} PROMISC=yes" > ${if_file}
if [ -z ${if_gw} ]; then if [ -z ${if_gw} ]; then
# create bridge cfg # create bridge cfg
echo "DEVICE=${bridge}, echo "DEVICE=${bridge}
IPADDR=${if_ip}, DEVICETYPE=ovs
NETMASK=${if_mask}, IPADDR=${if_ip}
BOOTPROTO=static, NETMASK=${if_mask}
ONBOOT=yes, BOOTPROTO=static
TYPE=OVSBridge, ONBOOT=yes
PROMISC=yes, TYPE=OVSBridge
PROMISC=yes
PEERDNS=no" > ${ovs_file} PEERDNS=no" > ${ovs_file}
else else
echo "DEVICE=${bridge}, echo "DEVICE=${bridge}
IPADDR=${if_ip}, DEVICETYPE=ovs
NETMASK=${if_mask}, IPADDR=${if_ip}
BOOTPROTO=static, NETMASK=${if_mask}
ONBOOT=yes, BOOTPROTO=static
TYPE=OVSBridge, ONBOOT=yes
PROMISC=yes, TYPE=OVSBridge
GATEWAY=${if_gw}, PROMISC=yes
GATEWAY=${if_gw}
PEERDNS=no" > ${ovs_file} PEERDNS=no" > ${ovs_file}
fi fi
...@@ -428,23 +431,23 @@ function detach_interface_from_ovs { ...@@ -428,23 +431,23 @@ function detach_interface_from_ovs {
if [ -z ${if_gw} ]; then if [ -z ${if_gw} ]; then
# create if cfg # create if cfg
echo "DEVICE=${line}, echo "DEVICE=${line}
IPADDR=${if_ip}, IPADDR=${if_ip}
NETMASK=${if_mask}, NETMASK=${if_mask}
BOOTPROTO=static, BOOTPROTO=static
ONBOOT=yes, ONBOOT=yes
TYPE=Ethernet, TYPE=Ethernet
NM_CONTROLLED=no, NM_CONTROLLED=no
PEERDNS=no" > ${net_path}/ifcfg-${line} PEERDNS=no" > ${net_path}/ifcfg-${line}
else else
echo "DEVICE=${line}, echo "DEVICE=${line}
IPADDR=${if_ip}, IPADDR=${if_ip}
NETMASK=${if_mask}, NETMASK=${if_mask}
BOOTPROTO=static, BOOTPROTO=static
ONBOOT=yes, ONBOOT=yes
TYPE=Ethernet, TYPE=Ethernet
NM_CONTROLLED=no, NM_CONTROLLED=no
GATEWAY=${if_gw}, GATEWAY=${if_gw}
PEERDNS=no" > ${net_path}/ifcfg-${line} PEERDNS=no" > ${net_path}/ifcfg-${line}
fi fi
break break
...@@ -455,8 +458,11 @@ PEERDNS=no" > ${net_path}/ifcfg-${line} ...@@ -455,8 +458,11 @@ PEERDNS=no" > ${net_path}/ifcfg-${line}
done <<< "$port_output" done <<< "$port_output"
# now remove the bridge ifcfg file # modify the bridge ifcfg file
rm -f ${net_path}/ifcfg-${bridge} # to remove IP params
sudo sed -i 's/IPADDR=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/NETMASK=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/GATEWAY=.*//' ${net_path}/ifcfg-${bridge}
sudo systemctl restart network sudo systemctl restart network
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment