Skip to content

Commit

Permalink
Fix for launchpad bug #882568
Browse files Browse the repository at this point in the history
Use tunctl to create the tap device if we are on a system where the ip command
is too old (and doesn't have support for tuntap).

(cherry picked from commit e4c7459)

Change-Id: I9e22010e4c7dd2671267de6d0e7a7bc9ae76a854
  • Loading branch information
Brad Hall authored and markmc committed Nov 16, 2011
1 parent fb898d6 commit 95b5610
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nova/virt/libvirt/vif.py
Expand Up @@ -107,8 +107,17 @@ def plug(self, instance, network, mapping):
iface_id = mapping['vif_uuid']
dev = self.get_dev_name(iface_id)
if not linux_net._device_exists(dev):
utils.execute('ip', 'tuntap', 'add', dev, 'mode', 'tap',
# Older version of the command 'ip' from the iproute2 package
# don't have support for the tuntap option (lp:882568). If it
# turns out we're on an old version we work around this by using
# tunctl.
try:
# First, try with 'ip'
utils.execute('ip', 'tuntap', 'add', dev, 'mode', 'tap',
run_as_root=True)
except exception.ProcessExecutionError:
# Second option: tunctl
utils.execute('tunctl', '-b', '-t', dev, run_as_root=True)
utils.execute('ip', 'link', 'set', dev, 'up', run_as_root=True)
utils.execute('ovs-vsctl', '--', '--may-exist', 'add-port',
FLAGS.libvirt_ovs_bridge, dev,
Expand Down

0 comments on commit 95b5610

Please sign in to comment.