Public bug reported:

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)

** Affects: neutron
     Importance: Undecided
         Status: New

** Description changed:

- Bulk port creation does not honor binding:vnic_type field. It implicitly uses 
+ 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"
-   }]
+   "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"
-   }
+ 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)
+                 port_dict[portbindings.VNIC_TYPE] = pdata.get(
+                     portbindings.VNIC_TYPE)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1940074

Title:
  Neutron port bulk creation procedure ignores binding:vnic_type
  parameter

Status in neutron:
  New

Bug 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' 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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1940074/+subscriptions


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to