libvirt: fix setting tx_queue_size when rx_queue_size is not set

Caused by a typo in Ib6d4a2d6b9072db42d11ecdde0950cf7a7781944.

Change-Id: I0e33ffdcad839f685d7e88b55afaedaf2a2f3a00
This commit is contained in:
Oliver Walsh 2018-05-01 20:48:07 +01:00 committed by Eric Fried
parent c15a0139af
commit 7ee4fefa2f
2 changed files with 23 additions and 1 deletions

View File

@ -205,3 +205,25 @@ class DesignerTestCase(test.NoDBTestCase):
self.assertEqual('fake-path', conf.vhostuser_path)
self.assertEqual(512, conf.vhost_rx_queue_size)
self.assertEqual(1024, conf.vhost_tx_queue_size)
def test_set_vif_host_backend_vhostuser_config_tx_queue_size(self):
conf = config.LibvirtConfigGuestInterface()
designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
'fake-path', None, 1024)
self.assertEqual('vhostuser', conf.net_type)
self.assertEqual('unix', conf.vhostuser_type)
self.assertEqual('fake-mode', conf.vhostuser_mode)
self.assertEqual('fake-path', conf.vhostuser_path)
self.assertIsNone(conf.vhost_rx_queue_size)
self.assertEqual(1024, conf.vhost_tx_queue_size)
def test_set_vif_host_backend_vhostuser_config_rx_queue_size(self):
conf = config.LibvirtConfigGuestInterface()
designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
'fake-path', 512, None)
self.assertEqual('vhostuser', conf.net_type)
self.assertEqual('unix', conf.vhostuser_type)
self.assertEqual('fake-mode', conf.vhostuser_mode)
self.assertEqual('fake-path', conf.vhostuser_path)
self.assertEqual(512, conf.vhost_rx_queue_size)
self.assertIsNone(conf.vhost_tx_queue_size)

View File

@ -166,7 +166,7 @@ def set_vif_host_backend_vhostuser_config(conf, mode, path, rx_queue_size,
conf.vhostuser_path = path
if rx_queue_size:
conf.vhost_rx_queue_size = rx_queue_size
if rx_queue_size:
if tx_queue_size:
conf.vhost_tx_queue_size = tx_queue_size