Skip to content

Commit

Permalink
Allow for creation of multiqueue taps
Browse files Browse the repository at this point in the history
We need this for virtion multiqueue support with the kernel vRouter. Tap
created by nova and then passed in to the libvirt has to be multiqueue enabled.

Change-Id: I7170bf7c181b038bb3d70a3b86c87ee254d10efc
Partial-Bug: #1573067
  • Loading branch information
majkijin committed Jun 8, 2016
1 parent 71e759c commit 37d991b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 7 additions & 3 deletions nova/network/linux_net.py
Expand Up @@ -1400,12 +1400,16 @@ def delete_ivs_vif_port(dev):
run_as_root=True)


def create_tap_dev(dev, mac_address=None):
def create_tap_dev(dev, mac_address=None, multiqueue=False):
if not device_exists(dev):
try:
# First, try with 'ip'
utils.execute('ip', 'tuntap', 'add', dev, 'mode', 'tap',
run_as_root=True, check_exit_code=[0, 2, 254])
if multiqueue:
cmd = ('ip', 'tuntap', 'add', dev, 'mode', 'tap',
'multi_queue')
else:
cmd = ('ip', 'tuntap', 'add', dev, 'mode', 'tap')
utils.execute(*cmd, run_as_root=True, check_exit_code=[0, 2, 254])
except processutils.ProcessExecutionError:
# Second option: tunctl
utils.execute('tunctl', '-b', '-t', dev, run_as_root=True)
Expand Down
13 changes: 12 additions & 1 deletion nova/virt/libvirt/vif.py
Expand Up @@ -727,9 +727,20 @@ def plug_vrouter(self, instance, vif):
Bind the vif to a Contrail virtual port.
"""
def multiqueue_enabled(instance):
metadata = instance['system_metadata']
mq = metadata.get('image_hw_vif_multiqueue_enabled')
vcpus = 0 if 'vcpus' not in instance else instance['vcpus']

if mq and mq.lower() == 'true' and vcpus > 1:
return True
else:
return False

dev = self.get_vif_devname(vif)
try:
linux_net.create_tap_dev(dev)
linux_net.create_tap_dev(dev,
multiqueue=multiqueue_enabled(instance))
self._vrouter_port_add(instance, vif)
except processutils.ProcessExecutionError:
LOG.exception(_LE("Failed while plugging vif"), instance=instance)
Expand Down

0 comments on commit 37d991b

Please sign in to comment.