When you create a port via OS::Nova::Server, if you only specify a network ID then the extra properties you pass in the template are ignored as per the code below:
heat/engine/resources/openstack/nova/server.py:
handle_create()
\_ _build_nics()
\_ if there's a port in the template then that's used
|_ if there's a subnet in the template then _create_internal_port() is called and the extra props are passed to Neutron
|_ if only a network ID is passed in the template then the port extra properties ni the template (if any) are ignored and the defaults are passed.
When you create a port via OS::Nova::Server, if you only specify a network ID then the extra properties you pass in the template are ignored as per the code below:
heat/engine/ resources/ openstack/ nova/server. py:
handle_create() internal_ port() is called and the extra props are passed to Neutron
\_ _build_nics()
\_ if there's a port in the template then that's used
|_ if there's a subnet in the template then _create_
|_ if only a network ID is passed in the template then the port extra properties ni the template (if any) are ignored and the defaults are passed.
Reproducer:
-----------
heat_template_ version: 2021-04-16
resources:
server_test:
port_ extra_propertie s:
binding: vnic_type: direct
type: OS::Nova::Server
properties:
name: server_test
config_drive: true
flavor: m1.small
image: "focal"
networks:
- network: test_net
Here is the request body for the API call sent from Heat to Neutron for the above template the network_id is there but not the extra property passed:
/var/log/ neutron/ neutron- server. log:2024- 10-30 12:10:38.439 246121 DEBUG neutron.api.v2.base [req-5ea6e086- cf63-4441- a19a-e785fbcea5 dc 3e23d2d4716f972 bd4eff30931e2a7 97fa5b0e355ef4d 5b05bee2212e156 b40a e964739be53f40d 0b3862aad6cff87 32 - 198a7a588d7c4ed b880789e342ec3d 03 198a7a588d7c4ed b880789e342ec3d 03] Request body: {'port': {'device_id': '6bdf1f2b- fc39-4c56- bde6-beffd08ff0 e6', 'network_id': '78637385- b2cc-41ae- 8d5c-0ed94ccd12 df', 'admin_state_up': True, 'tenant_id': 'e964739be53f40 d0b3862aad6cff8 732'}} prepare_ request_ body /usr/lib/ python3/ dist-packages/ neutron/ api/v2/ base.py: 730