** Description changed: 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. - - + \_ 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. + Reproducer: ----------- heat_template_version: 2021-04-16 - + resources: - - server_test: - type: OS::Nova::Server - properties: - name: server_test - config_drive: true - flavor: m1.small - image: "focal" - networks: - - network: test_net - port_extra_properties: - binding:vnic_type: direct - 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-e785fbcea5dc 3e23d2d4716f972bd4eff30931e2a797fa5b0e355ef4d5b05bee2212e156b40a e964739be53f40d0b3862aad6cff8732 - 198a7a588d7c4edb880789e342ec3d03 198a7a588d7c4edb880789e342ec3d03] Request body: {'port': {'device_id': '6bdf1f2b-fc39-4c56-bde6-beffd08ff0e6', 'network_id': '78637385-b2cc-41ae-8d5c-0ed94ccd12df', 'admin_state_up': True, 'tenant_id': 'e964739be53f40d0b3862aad6cff8732'}} prepare_request_body /usr/lib/python3/dist-packages/neutron/api/v2/base.py:730 + server_test: + type: OS::Nova::Server + properties: + name: server_test + config_drive: true + flavor: m1.small + image: "focal" + networks: + - network: test_net + port_extra_properties: + binding:vnic_type: direct + + 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-e785fbcea5dc + 3e23d2d4716f972bd4eff30931e2a797fa5b0e355ef4d5b05bee2212e156b40a + e964739be53f40d0b3862aad6cff8732 - 198a7a588d7c4edb880789e342ec3d03 + 198a7a588d7c4edb880789e342ec3d03] Request body: {'port': {'device_id': + '6bdf1f2b-fc39-4c56-bde6-beffd08ff0e6', 'network_id': + '78637385-b2cc-41ae-8d5c-0ed94ccd12df', 'admin_state_up': True, + 'tenant_id': 'e964739be53f40d0b3862aad6cff8732'}} prepare_request_body + /usr/lib/python3/dist-packages/neutron/api/v2/base.py:730 + + I believe we should be calling _create_internal_port() when only a + network ID is passed in the templates, as we already do when a subnet is + passed. The rationale is that either way we're creating a port so I see + no reason why we should not follow the same path.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2085966 Title: Port extra properties ignored when a port is created via OS::Nova::Server To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/heat/+bug/2085966/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs