Skip to content

configdrive: don't write empty network_data.json for non-ConfigDrive DHCP/DNS providers - #14020

Open
weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-fix-configdrive-network-data
Open

configdrive: don't write empty network_data.json for non-ConfigDrive DHCP/DNS providers#14020
weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-fix-configdrive-network-data

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

ConfigDriveBuilder.writeNetworkData() unconditionally wrote network_data.json, even when needForGeneratingNetworkData() determined no NIC has the ConfigDrive NSP assigned as its Dhcp/Dns provider (e.g. networks using a VirtualRouter or a NetworkExtensionElement-based provider instead). Writing an empty-but-present file makes cloud-init's DataSourceConfigDrive believe explicit (empty) network config was supplied, which suppresses its default per-NIC DHCP auto-configuration and leaves the guest NIC administratively down with no DHCP request ever sent.

Skip writing the file entirely in that case, so cloud-init falls back to its default behavior of bringing up and DHCP-configuring all available NICs.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

…DHCP/DNS providers

ConfigDriveBuilder.writeNetworkData() unconditionally wrote network_data.json,
even when needForGeneratingNetworkData() determined no NIC has the ConfigDrive
NSP assigned as its Dhcp/Dns provider (e.g. networks using a VirtualRouter or
a NetworkExtensionElement-based provider instead). Writing an empty-but-present
file makes cloud-init's DataSourceConfigDrive believe explicit (empty) network
config was supplied, which suppresses its default per-NIC DHCP auto-configuration
and leaves the guest NIC administratively down with no DHCP request ever sent.

Skip writing the file entirely in that case, so cloud-init falls back to its
default behavior of bringing up and DHCP-configuring all available NICs.
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@weizhouapache weizhouapache added this to the 4.22.2 milestone Sep 1, 2026
@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.79%. Comparing base (7ea1dca) to head (a4fe5f5).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14020      +/-   ##
============================================
- Coverage     17.79%   17.79%   -0.01%     
- Complexity    15995    15996       +1     
============================================
  Files          5928     5928              
  Lines        534306   534306              
  Branches      65383    65382       -1     
============================================
- Hits          95069    95067       -2     
- Misses       428467   428469       +2     
  Partials      10770    10770              
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 18.87% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19041

@DaanHoogland DaanHoogland moved this from Backlog to conflict/waiting in CloudStack Testing Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: conflict/waiting

Development

Successfully merging this pull request may close these issues.

3 participants