Create pair of virtual interfaces for baremetal network
Create pair of veth interfaces and plug then to linux bridge, will allow
to connect virtualized nodes to physics via ovs bridges.
Related-Prod: PRODX-3456
Change-Id: Icabdd75bbb5fca4962eb1161a6a518b22ae13d7e
diff --git a/de/heat-templates/fragments/SrvInstancesBM.yaml b/de/heat-templates/fragments/SrvInstancesBM.yaml
index cdf0647..805179c 100644
--- a/de/heat-templates/fragments/SrvInstancesBM.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBM.yaml
@@ -104,8 +104,6 @@
availability_zone: nova
networks:
- network: { get_param: accessible_network }
- # NOTE(ohryhorov): connect to accessible network only as ironic doesn't
- # support multitenancy use-case. Use private_floating_network for IPAM only.
user_data_format: SOFTWARE_CONFIG
user_data: { get_resource: install_config_agent}
metadata: { get_param: metadata }
diff --git a/de/heat-templates/fragments/SrvInstancesBMCeph.yaml b/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
index c097bdf..0d6a330 100644
--- a/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
@@ -42,7 +42,7 @@
type: string
ironic_baremetal_subnet_id:
type: string
- ironic_baremetal_interface:
+ ironic_baremetal_network_cidr:
type: string
functions_override:
type: string
@@ -89,8 +89,8 @@
$storage_frontend_interface: { get_param: storage_frontend_interface }
$storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
$storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
- $ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
$ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
+ $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
inject_files:
type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml b/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
index f034022..b36bfa8 100644
--- a/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
@@ -50,7 +50,7 @@
type: string
ironic_baremetal_subnet_id:
type: string
- ironic_baremetal_interface:
+ ironic_baremetal_network_cidr:
type: string
functions_override:
type: string
@@ -100,8 +100,8 @@
$storage_backend_interface: { get_param: storage_backend_interface }
$storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
$storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
- $ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
$ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
+ $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
inject_files:
type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/fragments/SrvInstancesVMCeph.yaml b/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
index 11538ca..0fe648f 100644
--- a/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
@@ -40,7 +40,7 @@
type: string
ironic_baremetal_subnet_id:
type: string
- ironic_baremetal_interface:
+ ironic_baremetal_network_cidr:
type: string
control_network_cidr:
type: string
@@ -97,8 +97,8 @@
$storage_frontend_interface: { get_param: storage_frontend_interface }
$storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
$storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
- $ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
$ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
+ $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
inject_files:
type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
index 446c75b..ed5bf0d 100644
--- a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
@@ -50,7 +50,7 @@
type: string
ironic_baremetal_subnet_id:
type: string
- ironic_baremetal_interface:
+ ironic_baremetal_network_cidr:
type: string
functions_override:
type: string
@@ -108,8 +108,8 @@
$storage_backend_interface: { get_param: storage_backend_interface }
$storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
$storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
- $ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
$ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
+ $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
inject_files:
type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index 50058f9..82ef911 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -19,8 +19,10 @@
STORAGE_FRONTEND_INTERFACE_IP=$storage_frontend_network_interface_ip
STORAGE_FRONTEND_NETWORK=$storage_frontend_network_cidr
STORAGE_FRONTEND_NETWORK_NETMASK=$(echo ${STORAGE_FRONTEND_NETWORK} | cut -d'/' -f2)
-IRONIC_BAREMETAL_INTERFACE=$ironic_baremetal_interface
+IRONIC_BAREMETAL_NETWORK=$ironic_baremetal_network_cidr
IRONIC_BAREMETAL_INTERFACE_IP=$ironic_baremetal_interface_ip
+IRONIC_BAREMETAL_NETWORK_NETMASK=$(echo ${IRONIC_BAREMETAL_NETWORK} | cut -d'/' -f2)
+IRONIC_BAREMETAL_INTERFACE=$(ip route get ${IRONIC_BAREMETAL_NETWORK%/*} | awk '/^broadcast / {print $4}')
NODE_TYPE=$node_type
UCP_MASTER_HOST=$ucp_master_host
NODE_METADATA='$node_metadata'
@@ -332,12 +334,25 @@
Name=veth-br
EOF
+cat << EOF > /etc/systemd/network/11-veth-bm.netdev
+[NetDev]
+Name=veth-bm
+Kind=veth
+[Peer]
+Name=veth-bm-br
+EOF
+
sed -i 's/.*ethernets:.*/&\n veth-phy: {}/' ${cloud_netplan_cfg}
sed -i 's/.*ethernets:.*/&\n veth-br: {}/' ${cloud_netplan_cfg}
+ sed -i 's/.*ethernets:.*/&\n veth-bm: {}/' ${cloud_netplan_cfg}
+ sed -i 's/.*ethernets:.*/&\n veth-bm-br: {}/' ${cloud_netplan_cfg}
- match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
+ public_address_match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
+ sed -i "$((${public_address_match_ip_line}-1)),$((${public_address_match_ip_line}))d" ${cloud_netplan_cfg}
- sed -i "$((${match_ip_line}-1)),$((${match_ip_line}))d" ${cloud_netplan_cfg}
+ ironic_baremetal_address_match_ip_line=$(grep -nm1 "${IRONIC_BAREMETAL_INTERFACE_IP}/${IRONIC_BAREMETAL_NETWORK_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
+ sed -i "$((${ironic_baremetal_address_match_ip_line}-1)),$((${ironic_baremetal_address_match_ip_line}))d" ${cloud_netplan_cfg}
+
cat << EOF >> ${cloud_netplan_cfg}
bridges:
@@ -348,6 +363,14 @@
- veth-br
addresses:
- ${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}
+ br-baremetal:
+ dhcp4: false
+ interfaces:
+ - ${IRONIC_BAREMETAL_INTERFACE}
+ - veth-bm-br
+ addresses:
+ - ${IRONIC_BAREMETAL_INTERFACE_IP}/${IRONIC_BAREMETAL_NETWORK_NETMASK}
+
EOF
netplan --debug apply
diff --git a/de/heat-templates/top.yaml b/de/heat-templates/top.yaml
index 9b06fca..8a8b388 100644
--- a/de/heat-templates/top.yaml
+++ b/de/heat-templates/top.yaml
@@ -117,9 +117,10 @@
ironic_baremetal_network_gateway:
type: string
default: ''
- ironic_baremetal_interface:
+ ironic_baremetal_network_interface:
type: string
- default: 'ens7'
+ default: 'veth-bm'
+ description: 'The name of interface that should be added to ovs bridge with taps from vbms VMs.'
ucp_metadata:
type: json
default: {"role":"ucp"}
@@ -330,7 +331,7 @@
storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
cmps:
@@ -369,7 +370,7 @@
storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
gtws:
@@ -404,7 +405,7 @@
storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
lmas:
@@ -439,7 +440,7 @@
storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
osds:
@@ -478,7 +479,7 @@
storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
spares: # spares for osds/cmps
@@ -517,7 +518,7 @@
storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
ntws:
@@ -552,7 +553,7 @@
storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
vbmcs:
@@ -587,7 +588,7 @@
storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
ironic_baremetal_network: { get_attr: [ironic_baremetal_network, ironic_baremetal_network_id] }
ironic_baremetal_subnet_id: { get_attr: [ironic_baremetal_network, ironic_baremetal_subnet_id] }
- ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
+ ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
hardware_metadata: { get_param: hardware_metadata}
outputs:
@@ -638,6 +639,8 @@
value: { get_param: ironic_baremetal_network_pool_start }
ironic_baremetal_network_pool_end:
value: { get_param: ironic_baremetal_network_pool_end }
+ ironic_baremetal_network_interface:
+ value: { get_param: ironic_baremetal_network_interface }
tunnel_interface:
value: { get_param: tunnel_interface }
live_migration_interface: