diff --git a/nova/network/os_vif_util.py b/nova/network/os_vif_util.py index 2ed3f7fadc5a..dfdf8e9d09d4 100644 --- a/nova/network/os_vif_util.py +++ b/nova/network/os_vif_util.py @@ -284,8 +284,10 @@ def _nova_to_osvif_vif_vhostuser(vif): if vif['details'].get(model.VIF_DETAILS_VHOSTUSER_OVS_PLUG, False): profile = objects.vif.VIFPortProfileOpenVSwitch( interface_id=vif.get('ovs_interfaceid') or vif['id']) + vif_name = ('vhu' + vif['id'])[:model.NIC_NAME_LEN] obj = _get_vif_instance(vif, objects.vif.VIFVHostUser, - port_profile=profile, plugin="ovs") + port_profile=profile, plugin="ovs", + vif_name=vif_name) if vif["network"]["bridge"] is not None: obj.bridge_name = vif["network"]["bridge"] obj.mode = vif['details'].get( diff --git a/nova/tests/unit/network/test_os_vif_util.py b/nova/tests/unit/network/test_os_vif_util.py index a4ccb47e772c..45068b028b9c 100644 --- a/nova/tests/unit/network/test_os_vif_util.py +++ b/nova/tests/unit/network/test_os_vif_util.py @@ -572,6 +572,7 @@ class OSVIFUtilTestCase(test.NoDBTestCase): plugin="ovs", port_profile=osv_objects.vif.VIFPortProfileOpenVSwitch( interface_id="dc065497-3c8d-4f44-8fb4-e1d33c16a536"), + vif_name="vhudc065497-3c", path='/fake/socket', mode='client', has_traffic_filtering=True,