diff options
| author | Brad Hall <brad@nicira.com> | 2011-10-27 17:45:23 -0700 |
|---|---|---|
| committer | Brad Hall <brad@nicira.com> | 2011-11-03 13:49:48 -0700 |
| commit | e4c74596bfaf1cee1a6f8cbb0d97aa067d9a4317 (patch) | |
| tree | 5f23966bd93afada726b07ded61a2bfd72772876 | |
| parent | 67a1c257f9e4be774da5acf2c1b703d196e0a2cf (diff) | |
| download | nova-e4c74596bfaf1cee1a6f8cbb0d97aa067d9a4317.tar.gz nova-e4c74596bfaf1cee1a6f8cbb0d97aa067d9a4317.tar.xz nova-e4c74596bfaf1cee1a6f8cbb0d97aa067d9a4317.zip | |
Fix for launchpad bug #882568
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).
Change-Id: I9e22010e4c7dd2671267de6d0e7a7bc9ae76a854
| -rw-r--r-- | nova/virt/libvirt/vif.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 077c32474..96cf2e77d 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -107,8 +107,17 @@ class LibvirtOpenVswitchDriver(VIFDriver): 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, |
