1 Commits

Author SHA1 Message Date
Kengo Sakai
b9303e6764 Check if flavor.vcpus is more than MAX_TAP_QUEUES
When attempting to instantiate an instance based on an image with
the metadata hw:vif_multiqueue_enabled=true, the code uses
flavor.vcpus as the number of queues on a tap interface.

In kernels prior to 3.0, multiple queues on a tap interface
is not supported[1]. In kernels 3.x, the number of queues
on a tap interface is limited to 8 as MAX_TAP_QUEUES in tun
driver[2]. From 4.0, the number is 256[3]. If flavor.vcpus
is more than MAX_TAP_QUEUES, creating the tap interface
fails.

This commit adds logic to check if flavor.vcpus is more
than MAX_TAP_QUEUES and use MAX_TAP_QUEUES as the number
of queues if so.

[1]https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/tun.c?id=refs/tags/v2.6.32.71#n101
[2]https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/tun.c?id=refs/tags/v3.18.35#n118
[3]https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/tun.c?id=refs/tags/v4.1.26#n128

Change-Id: I2aa24e3cf550ff69909a2b4bc8be90641dbe3d69
Closes-Bug: #1570631
2016-06-24 21:46:10 +09:00