Commit 94c2ed34 authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: fail when a routed nic has no ip



This shouldn't happen, but if it does it's better to fail at this level,
rather than create a broken NIC script, which is hard to debug.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b30e35c6
......@@ -183,6 +183,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
script.write(" # Connect the interface to the bridge\n")
script.write(" /usr/sbin/brctl addif $BRIDGE $INTERFACE\n")
elif nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_ROUTED:
if not nic.ip:
raise errors.HypervisorError("nic/%d is routed, but has no ip." % seq)
script.write(" # Route traffic targeted at the IP to the interface\n")
if nic.nicparams[constants.NIC_LINK]:
script.write(" while /sbin/ip rule del dev $INTERFACE; do :; done\n")
......
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