def _update_port_binding(self, port_res): port_res[portbindings.VNIC_TYPE] = portbindings.VNIC_NORMAL if cfg.CONF.df.vif_type == portbindings.VIF_TYPE_VHOST_USER: port_res[portbindings.VIF_DETAILS].update({ portbindings.VHOST_USER_SOCKET: df_utils.get_vhu_sockpath(cfg.CONF.df.vhost_sock_dir, port_res['id']) })
def test_vhu_sock_path(self): fake_sock_dir = '/tmp' fake_port_id = '7d411f48-ecc7-45e0-9ece-3b5bdb54fcef' path = utils.get_vhu_sockpath(fake_sock_dir, fake_port_id) self.assertEqual('/tmp/vhu7d411f48-ec', path)