2021-08-16 11:44:52 |
Andrey Bubyr |
description |
Bulk port creation does not honor binding:vnic_type field. It implicitly uses
binding:vnic_type: normal
Example of bulk creation API call:
curl -v --location --request POST 'https://<neutron_url>/v2.0/ports' --header 'Content-Type: application/json' --header 'X-Auth-Token: <redacted>' --data-raw '{
"ports" : [ {
"name" : "port1",
"admin_state_up" : true,
"network_id" : "c2a3464a-dbea-40c9-b421-9313e33992be",
"binding:vnic_type" : "direct"
}, {
"name" : "port2",
"admin_state_up" : true,
"network_id" : "27dd162f-e8ac-4b21-84f4-e4dff6836fa0",
"binding:vnic_type" : "macvtap"
}]
}'
At the same time vnic_type is honored in 'single port' of this API, f.e. with payload like
"port" : {
"name" : "port_single",
"admin_state_up" : true,
"network_id" : "c2a3464a-dbea-40c9-b421-9313e33992be",
"binding:vnic_type" : "direct"
}
}'
Seems that binding:vnic_type from port parameters is not passed thru inside create_port_bulk() function. I've found a workaround. The following line should be added after
https://review.opendev.org/plugins/gitiles/openstack/neutron/+/refs/heads/master/neutron/plugins/ml2/plugin.py#1594:
port_dict[portbindings.VNIC_TYPE] = pdata.get(
portbindings.VNIC_TYPE) |
Bulk port creation does not honor binding:vnic_type field. It implicitly uses
binding:vnic_type: normal
Example of bulk creation API call:
curl -v --location --request POST 'https://<neutron_url>/v2.0/ports' --header 'Content-Type: application/json' --header 'X-Auth-Token: <redacted>' --data-raw '{
"ports" : [ {
"name" : "port1",
"admin_state_up" : true,
"network_id" : "c2a3464a-dbea-40c9-b421-9313e33992be",
"binding:vnic_type" : "direct"
}, {
"name" : "port2",
"admin_state_up" : true,
"network_id" : "27dd162f-e8ac-4b21-84f4-e4dff6836fa0",
"binding:vnic_type" : "macvtap"
}]
}'
At the same time vnic_type is honored in 'single port' mode of this API, f.e. with payload like
"port" : {
"name" : "port_single",
"admin_state_up" : true,
"network_id" : "c2a3464a-dbea-40c9-b421-9313e33992be",
"binding:vnic_type" : "direct"
}
}'
Seems that binding:vnic_type from port parameters is not passed thru inside create_port_bulk() function. I've found a workaround. The following line should be added after
https://review.opendev.org/plugins/gitiles/openstack/neutron/+/refs/heads/master/neutron/plugins/ml2/plugin.py#1594:
port_dict[portbindings.VNIC_TYPE] = pdata.get(
portbindings.VNIC_TYPE) |
|