[Devstack] Replace tap with veth
This patch replace tap interfaces by veth pairs which ensures that port is always present in ovs even when VM is powered off. Closes-Bug: #1722158 Change-Id: I04ff6a97bebf15636a794b51f748c62eda627d36
This commit is contained in:
parent
b8a38d9731
commit
f357c76cd5
@ -2120,7 +2120,7 @@ function cleanup_baremetal_basic_ops {
|
|||||||
|
|
||||||
# Cleanup node bridge/interfaces
|
# Cleanup node bridge/interfaces
|
||||||
for i in $(seq 1 $IRONIC_VM_INTERFACE_COUNT); do
|
for i in $(seq 1 $IRONIC_VM_INTERFACE_COUNT); do
|
||||||
sudo ip tuntap del dev tap-${vm_name}i${i} mode tap
|
sudo ip link del dev tap-${vm_name}i${i}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -94,10 +94,15 @@ INTERFACE_COUNT=${INTERFACE_COUNT:-1}
|
|||||||
|
|
||||||
for int in $(seq 1 $INTERFACE_COUNT); do
|
for int in $(seq 1 $INTERFACE_COUNT); do
|
||||||
tapif=tap-${NAME}i${int}
|
tapif=tap-${NAME}i${int}
|
||||||
sudo ip tuntap add dev $tapif mode tap
|
ovsif=ovs-${NAME}i${int}
|
||||||
sudo ip link set $tapif mtu $INTERFACE_MTU
|
# NOTE(vsaienko) use veth pair here to ensure that interface
|
||||||
sudo ip link set $tapif up
|
# exists in OVS even when VM is powered off.
|
||||||
sudo ovs-vsctl add-port $BRIDGE $tapif
|
sudo ip link add dev $tapif type veth peer name $ovsif
|
||||||
|
for l in $tapif $ovsif; do
|
||||||
|
sudo ip link set dev $l up
|
||||||
|
sudo ip link set $l mtu $INTERFACE_MTU
|
||||||
|
done
|
||||||
|
sudo ovs-vsctl add-port $BRIDGE $ovsif
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! virsh list --all | grep -q $NAME; then
|
if ! virsh list --all | grep -q $NAME; then
|
||||||
@ -126,5 +131,5 @@ if ! virsh list --all | grep -q $NAME; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# echo mac in format mac1,ovs-node-0i1;mac2,ovs-node-0i2;...;macN,ovs-node0iN
|
# echo mac in format mac1,ovs-node-0i1;mac2,ovs-node-0i2;...;macN,ovs-node0iN
|
||||||
VM_MAC=$(echo -n $(virsh domiflist $NAME |awk '/tap-/{print $5","$1}')|tr ' ' ';')
|
VM_MAC=$(echo -n $(virsh domiflist $NAME |awk '/tap-/{print $5","$3}')|tr ' ' ';' |sed s/tap-/ovs-/g)
|
||||||
echo -n "$VM_MAC $VBMC_PORT $PDU_OUTLET"
|
echo -n "$VM_MAC $VBMC_PORT $PDU_OUTLET"
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
</controller>
|
</controller>
|
||||||
{% for n in range(1, interface_count+1) %}
|
{% for n in range(1, interface_count+1) %}
|
||||||
<interface type='ethernet'>
|
<interface type='direct'>
|
||||||
<target dev='{{ "tap-" + name + "i" + n|string }}'/>
|
<source dev='{{ "tap-" + name + "i" + n|string }}'/>
|
||||||
<model type='{{ nicdriver }}'/>
|
<model type='{{ nicdriver }}'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x01' slot='{{ "0x0" + n|string }}' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x01' slot='{{ "0x0" + n|string }}' function='0x0'/>
|
||||||
</interface>
|
</interface>
|
||||||
|
Loading…
Reference in New Issue
Block a user