Merge "Fix 1vcpu error with multiqueue and vif_type=tap"
This commit is contained in:
commit
8d9785b965
|
@ -392,6 +392,10 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||||
uuid='f0000000-0000-0000-0000-000000000001',
|
uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
project_id=723)
|
project_id=723)
|
||||||
|
|
||||||
|
flavor_1vcpu = objects.Flavor(vcpus=1, memory=512, root_gb=1)
|
||||||
|
|
||||||
|
flavor_2vcpu = objects.Flavor(vcpus=2, memory=512, root_gb=1)
|
||||||
|
|
||||||
bandwidth = {
|
bandwidth = {
|
||||||
'quota:vif_inbound_peak': '200',
|
'quota:vif_inbound_peak': '200',
|
||||||
'quota:vif_outbound_peak': '20',
|
'quota:vif_outbound_peak': '20',
|
||||||
|
@ -1066,32 +1070,50 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||||
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
||||||
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
||||||
@mock.patch('nova.privsep.linux_net.create_tap_dev')
|
@mock.patch('nova.privsep.linux_net.create_tap_dev')
|
||||||
def test_plug_tap_kvm_virtio(self, mock_create_tap_dev, mock_set_mtu,
|
def test_plug_tap_kvm_virtio(
|
||||||
mock_device_exists):
|
self, mock_create_tap_dev, mock_set_mtu, mock_device_exists):
|
||||||
|
|
||||||
d1 = vif.LibvirtGenericVIFDriver()
|
d1 = vif.LibvirtGenericVIFDriver()
|
||||||
ins = objects.Instance(
|
ins = objects.Instance(
|
||||||
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
image_ref=uuids.image_ref,
|
image_ref=uuids.image_ref, flavor=self.flavor_2vcpu,
|
||||||
project_id=723, system_metadata={}
|
project_id=723, system_metadata={}
|
||||||
)
|
)
|
||||||
d1.plug(ins, self.vif_tap)
|
d1.plug(ins, self.vif_tap)
|
||||||
mock_create_tap_dev.assert_called_once_with('tap-xxx-yyy-zzz', None,
|
mock_create_tap_dev.assert_called_once_with(
|
||||||
multiqueue=False)
|
'tap-xxx-yyy-zzz', None, multiqueue=False)
|
||||||
|
|
||||||
mock_create_tap_dev.reset_mock()
|
mock_create_tap_dev.reset_mock()
|
||||||
|
|
||||||
d2 = vif.LibvirtGenericVIFDriver()
|
d2 = vif.LibvirtGenericVIFDriver()
|
||||||
mq_ins = objects.Instance(
|
mq_ins = objects.Instance(
|
||||||
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
image_ref=uuids.image_ref,
|
image_ref=uuids.image_ref, flavor=self.flavor_2vcpu,
|
||||||
project_id=723, system_metadata={
|
project_id=723, system_metadata={
|
||||||
'image_hw_vif_multiqueue_enabled': 'True'
|
'image_hw_vif_multiqueue_enabled': 'True'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
d2.plug(mq_ins, self.vif_tap)
|
d2.plug(mq_ins, self.vif_tap)
|
||||||
mock_create_tap_dev.assert_called_once_with('tap-xxx-yyy-zzz', None,
|
mock_create_tap_dev.assert_called_once_with(
|
||||||
multiqueue=True)
|
'tap-xxx-yyy-zzz', None, multiqueue=True)
|
||||||
|
|
||||||
|
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
||||||
|
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
||||||
|
@mock.patch('nova.privsep.linux_net.create_tap_dev')
|
||||||
|
def test_plug_tap_mq_ignored_1vcpu(
|
||||||
|
self, mock_create_tap_dev, mock_set_mtu, mock_device_exists):
|
||||||
|
|
||||||
|
d1 = vif.LibvirtGenericVIFDriver()
|
||||||
|
mq_ins = objects.Instance(
|
||||||
|
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
|
image_ref=uuids.image_ref, flavor=self.flavor_1vcpu,
|
||||||
|
project_id=723, system_metadata={
|
||||||
|
'image_hw_vif_multiqueue_enabled': 'True',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
d1.plug(mq_ins, self.vif_tap)
|
||||||
|
mock_create_tap_dev.assert_called_once_with(
|
||||||
|
'tap-xxx-yyy-zzz', None, multiqueue=False)
|
||||||
|
|
||||||
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
||||||
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
||||||
|
@ -1106,15 +1128,14 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||||
d1 = vif.LibvirtGenericVIFDriver()
|
d1 = vif.LibvirtGenericVIFDriver()
|
||||||
ins = objects.Instance(
|
ins = objects.Instance(
|
||||||
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
image_ref=uuids.image_ref,
|
image_ref=uuids.image_ref, flavor=self.flavor_2vcpu,
|
||||||
project_id=723, system_metadata={
|
project_id=723, system_metadata={
|
||||||
'image_hw_vif_multiqueue_enabled': 'True'
|
'image_hw_vif_multiqueue_enabled': 'True'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
d1.plug(ins, self.vif_tap)
|
d1.plug(ins, self.vif_tap)
|
||||||
mock_create_tap_dev.assert_called_once_with('tap-xxx-yyy-zzz',
|
mock_create_tap_dev.assert_called_once_with(
|
||||||
None,
|
'tap-xxx-yyy-zzz', None, multiqueue=False)
|
||||||
multiqueue=False)
|
|
||||||
|
|
||||||
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
@mock.patch('nova.privsep.linux_net.device_exists', return_value=True)
|
||||||
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
@mock.patch('nova.privsep.linux_net.set_device_mtu')
|
||||||
|
@ -1125,16 +1146,15 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||||
d1 = vif.LibvirtGenericVIFDriver()
|
d1 = vif.LibvirtGenericVIFDriver()
|
||||||
ins = objects.Instance(
|
ins = objects.Instance(
|
||||||
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
id=1, uuid='f0000000-0000-0000-0000-000000000001',
|
||||||
image_ref=uuids.image_ref,
|
image_ref=uuids.image_ref, flavor=self.flavor_2vcpu,
|
||||||
project_id=723, system_metadata={
|
project_id=723, system_metadata={
|
||||||
'image_hw_vif_multiqueue_enabled': 'True',
|
'image_hw_vif_multiqueue_enabled': 'True',
|
||||||
'image_hw_vif_model': 'e1000',
|
'image_hw_vif_model': 'e1000',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
d1.plug(ins, self.vif_tap)
|
d1.plug(ins, self.vif_tap)
|
||||||
mock_create_tap_dev.assert_called_once_with('tap-xxx-yyy-zzz',
|
mock_create_tap_dev.assert_called_once_with(
|
||||||
None,
|
'tap-xxx-yyy-zzz', None, multiqueue=False)
|
||||||
multiqueue=False)
|
|
||||||
|
|
||||||
def test_unplug_tap(self):
|
def test_unplug_tap(self):
|
||||||
d = vif.LibvirtGenericVIFDriver()
|
d = vif.LibvirtGenericVIFDriver()
|
||||||
|
|
|
@ -692,7 +692,8 @@ class LibvirtGenericVIFDriver(object):
|
||||||
vif_model = self.get_vif_model(image_meta=image_meta)
|
vif_model = self.get_vif_model(image_meta=image_meta)
|
||||||
# TODO(ganso): explore whether multiqueue works for other vif models
|
# TODO(ganso): explore whether multiqueue works for other vif models
|
||||||
# that go through this code path.
|
# that go through this code path.
|
||||||
multiqueue = (self._requests_multiqueue(image_meta) and
|
multiqueue = (instance.get_flavor().vcpus > 1 and
|
||||||
|
self._requests_multiqueue(image_meta) and
|
||||||
vif_model == network_model.VIF_MODEL_VIRTIO)
|
vif_model == network_model.VIF_MODEL_VIRTIO)
|
||||||
nova.privsep.linux_net.create_tap_dev(dev, mac, multiqueue=multiqueue)
|
nova.privsep.linux_net.create_tap_dev(dev, mac, multiqueue=multiqueue)
|
||||||
network = vif.get('network')
|
network = vif.get('network')
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Addressed an issue that prevented instances with 1 vcpu using multiqueue
|
||||||
|
feature from being created successfully when their vif_type is TAP.
|
Loading…
Reference in New Issue