summaryrefslogtreecommitdiff
path: root/devstack/tools/ironic
diff options
context:
space:
mode:
authorVasyl Saienko <vsaienko@mirantis.com>2017-10-09 13:14:41 +0300
committerVasyl Saienko <vsaienko@mirantis.com>2017-10-10 11:33:25 +0000
commitf357c76cd508ac53844141602c4ba0127b63a7de (patch)
treefbf16b6b55999ef9dca0246d1e766700877f4cfd /devstack/tools/ironic
parentb8a38d973182539c6945abf6e17265c6ef40fb63 (diff)
downloadironic-f357c76cd508ac53844141602c4ba0127b63a7de.tar.gz
[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
Diffstat (limited to 'devstack/tools/ironic')
-rwxr-xr-xdevstack/tools/ironic/scripts/create-node.sh15
-rw-r--r--devstack/tools/ironic/templates/vm.xml4
2 files changed, 12 insertions, 7 deletions
diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh
index 55b25ceb7..9c1144a5d 100755
--- a/devstack/tools/ironic/scripts/create-node.sh
+++ b/devstack/tools/ironic/scripts/create-node.sh
@@ -94,10 +94,15 @@ INTERFACE_COUNT=${INTERFACE_COUNT:-1}
for int in $(seq 1 $INTERFACE_COUNT); do
tapif=tap-${NAME}i${int}
- sudo ip tuntap add dev $tapif mode tap
- sudo ip link set $tapif mtu $INTERFACE_MTU
- sudo ip link set $tapif up
- sudo ovs-vsctl add-port $BRIDGE $tapif
+ ovsif=ovs-${NAME}i${int}
+ # NOTE(vsaienko) use veth pair here to ensure that interface
+ # exists in OVS even when VM is powered off.
+ 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
if ! virsh list --all | grep -q $NAME; then
@@ -126,5 +131,5 @@ if ! virsh list --all | grep -q $NAME; then
fi
# 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"
diff --git a/devstack/tools/ironic/templates/vm.xml b/devstack/tools/ironic/templates/vm.xml
index 3fc1380ec..dc6093e0b 100644
--- a/devstack/tools/ironic/templates/vm.xml
+++ b/devstack/tools/ironic/templates/vm.xml
@@ -45,8 +45,8 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
{% for n in range(1, interface_count+1) %}
- <interface type='ethernet'>
- <target dev='{{ "tap-" + name + "i" + n|string }}'/>
+ <interface type='direct'>
+ <source dev='{{ "tap-" + name + "i" + n|string }}'/>
<model type='{{ nicdriver }}'/>
<address type='pci' domain='0x0000' bus='0x01' slot='{{ "0x0" + n|string }}' function='0x0'/>
</interface>