Merge "libvirt: fix setting tx_queue_size when rx_queue_size is not set"

This commit is contained in:
Zuul 2018-05-02 02:54:47 +00:00 committed by Gerrit Code Review
commit 338a3df403
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