2015-07-21 33 views
2

我想更新已经创建的端口的vif_model。我在CLI中使用以下命令:Openstack Neutron:如何使用update_port()api更新端口vif模型

neutron port-update --binding:vif_model=avp <port_id> 

如何使用python apis的中子实现相同。 我想使用update_port()api。但不确定参数。

>>> from neutronclient.neutron import client 
>>> neutron = client.Client('2.0', endpoint_url=neutron_endpoint, token=tok) 
>>> help(neutron.update_port) 

,给出以下提示:

的功能帮助with_params模块neutronclient.v2_0.client:

with_params(* ARGS,** kwargs)

+0

这是一个有效的命令行吗?仔细查看[API参考](http://developer.openstack.org/api-ref-networking-v2-ext.html#port_binding-ext),我发现支持'binding:vnic_type','binding:host_id',和'binding:profile',但没有任何用于'binding:vif_model'。 – larsks

+0

我正在使用Windriver Openstack Havana发布。这是windriver的端口,因为它们支持加速虚拟端口(avp) –

回答

1

我看着在Nova源代码中,通常使用update_port调用的例子,看起来你会这样称呼它:

client.update_port('1fe691a6-f3a0-4586-b126-9fabb11e962a', 
        {'port': 
        {'binding:vif_type': 'avp'}})