Merge "Remove get_config_vhostuser"

This commit is contained in:
Zuul 2019-02-15 04:34:23 +00:00 committed by Gerrit Code Review
commit 72273dec5f
3 changed files with 26 additions and 30 deletions

View File

@ -440,7 +440,11 @@ def _nova_to_osvif_vif_vhostuser(vif):
_set_vhostuser_settings(vif, obj)
return obj
else:
raise NotImplementedError()
obj = _get_vif_instance(vif, objects.vif.VIFVHostUser,
plugin="noop",
vif_name=_get_vif_name(vif))
_set_vhostuser_settings(vif, obj)
return obj
# VIF_TYPE_IVS = 'ivs'

View File

@ -802,7 +802,27 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
}
)
self.assertIsNone(os_vif_util.nova_to_osvif_vif(vif))
actual = os_vif_util.nova_to_osvif_vif(vif)
expect = osv_objects.vif.VIFVHostUser(
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
active=False,
address="22:52:25:62:e2:aa",
plugin="noop",
vif_name="nicdc065497-3c",
path='/fake/socket',
mode='client',
has_traffic_filtering=False,
preserve_on_delete=False,
network=osv_objects.network.Network(
id="b82c1929-051e-481d-8110-4669916c7915",
bridge_interface=None,
label="Demo Net",
mtu=None,
subnets=osv_objects.subnet.SubnetList(
objects=[])))
self.assertObjEqual(expect, actual)
def test_nova_to_osvif_vhostuser_fp_ovs_hybrid(self):
vif = model.VIF(

View File

@ -417,34 +417,6 @@ class LibvirtGenericVIFDriver(object):
return conf
def _get_vhostuser_settings(self, vif):
vif_details = vif['details']
mode = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_MODE,
'server')
sock_path = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_SOCKET)
if sock_path is None:
raise exception.VifDetailsMissingVhostuserSockPath(
vif_id=vif['id'])
return mode, sock_path
def get_config_vhostuser(self, instance, vif, image_meta,
inst_type, virt_type, host):
conf = self.get_base_config(instance, vif['address'], image_meta,
inst_type, virt_type, vif['vnic_type'],
host)
# TODO(sahid): We should never configure a driver backend for
# vhostuser interface. Specifically override driver to use
# None. This can be removed when get_base_config will be fixed
# and rewrite to set the correct backend.
conf.driver_name = None
mode, sock_path = self._get_vhostuser_settings(vif)
rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
designer.set_vif_host_backend_vhostuser_config(
conf, mode, sock_path, rx_queue_size, tx_queue_size)
return conf
def _get_virtio_queue_sizes(self, host):
"""Returns rx/tx queue sizes configured or (None, None)