Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2276701

Summary: Nova metadata service doesn't process ipless ports properly
Product: Red Hat OpenStack Reporter: Alex Stupnikov <astupnik>
Component: openstack-novaAssignee: OSP DFG:Compute <osp-dfg-compute>
Status: CLOSED MIGRATED QA Contact: OSP DFG:Compute <osp-dfg-compute>
Severity: medium Docs Contact:
Priority: medium    
Version: 17.1 (Wallaby)CC: alifshit, dasmith, eglynn, jhakimra, kchamart, sbauza, sgordon, smooney, vromanso
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-18 02:22:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Stupnikov 2024-04-23 19:04:53 UTC
Description of problem:
After bug #2081254 was fixed in RHOSP 17.1 it is possible to attach ports without IP addresses to VMs. Feature itself works as expected, but Nova doesn't create consistent network_data.json for this scenario: ipless ports are not added to 'links' list.

The reason is that network_info for ipless ports contains empty list of subnets:
{"id": "24e7183c-6e96-44cb-be67-b76f93dc8a6b", "address": "fa:16:3e:3a:a6:fa", "network": {"id": "720efe1b-e34c-4cc4-b9f8-6f186f6e0443", "bridge": "br-int", "label": "internal-2", "subnets": [], "meta": {"injected": false, "tenant_id": "3ff81dd8d02b450cb7b0da6197c33a93", "mtu": 1442, "physical_network": null, "tunneled": true}}, "type": "ovs", "details": {"port_filter": true, "connectivity": "l2"}, "devname": "tap24e7183c-6e", "ovs_interfaceid": "24e7183c-6e96-44cb-be67-b76f93dc8a6b", "qbh_params": null, "qbg_params": null, "active": true, "vnic_type": "normal", "profile": {}, "preserve_on_delete": true, "delegate_create": true, "meta": {}}

As a result, netutils library skips adding such VIFs to 'links' list (empty 'subnets' -> VIF is skipped): https://github.com/openstack/nova/blob/e2ef2240b1e732b359d29457cc12abc7554fa286/nova/virt/netutils.py#L189

This is inconsistent: 'links' list contains information about L2 connection and doesn't require IP address/subnet.

Version-Release number of selected component (if applicable):
RHOSP 17.1

How reproducible:

$ openstack port create --disable-port-security --no-security-group --network external-net --fixed-ip "subnet=external-sub" port1
$ openstack port create --disable-port-security --no-security-group --network testnet --no-fixed-ip  port2
$ openstack server create --image  testimage --flavor m1.nano --port port1 --port port2 testvm1

Inside test VM:
# mount -o ro /dev/sr0 /mnt
# cat /mnt/openstack/2020-10-14/network_data.json
{"links": [{"id": "tapf3cf30db-a9", "vif_id": "f3cf30db-a9e9-40e0-9c25-d2209497256c", "type": "ovs", "mtu": null, "ethernet_mac_address": "fa:16:3e:ae:b1:40"}], "networks": [{"id": "network0", "type": "ipv4_dhcp", "link": "tapf3cf30db-a9", "network_id": "ae20fa95-cbe7-4fec-a173-dba3a2b19513"}], "services": []}

Actual results:
'links' list doesn't contain ipless ports

Expected results:
'links' list contains ipless ports