Skip to content

Conversation

@NVShawn
Copy link

@NVShawn NVShawn commented Jan 12, 2026

Description

This PR enhances the feature added in #3662 to allow for non-infinite dhcp lease times.

So we do not break current installs, we keep the 'infinite' lease time as default but allow for a config to change the lease times to non-infinite values.

We've had issues with VMs with the lease set to infinite where they never check to see if their IP is still available, so we get IP conflicts. In our environment, with a combination of very short lived and long lived VMs and constrained IP address, we have to rely on IP address re-use and lease timeouts. This change allows us to configure our IP lease timeouts without modifying default behavior.

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

…s components. Updated DhcpEntryCommand to include lease time, modified VmDhcpConfig to handle lease time, and adjusted related scripts and configurations to accommodate this new parameter. This allows for configurable DHCP lease durations, improving flexibility in network management.
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 12, 2026

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@DaanHoogland DaanHoogland added this to the 4.23.0 milestone Jan 13, 2026
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generally good, one remark and also needs testing of course

Comment on lines +354 to +361
DhcpLeaseTimeout(
"Network",
ManagementServer.class,
Integer.class,
"dhcp.lease.timeout",
"0",
"DHCP lease time in seconds for VMs. Use 0 for infinite lease time (default). A non-zero value sets the lease duration in seconds.",
null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this config mechanism is outdated. I think it is most suitable as ConfigKey in AgentManager/AgentManagerImpl. There are some examples there to look at.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or in NetworkOrchestrationService, or some other related service.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizhouapache @NVShawn whether this is Global, Zone or even Domain or Account scope is a design decision to be made. At the moment I do not have an opinion (yet ;) ).

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 5.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.76%. Comparing base (b8813c7) to head (bb72490).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...nt/resource/virtualnetwork/model/VmDhcpConfig.java 0.00% 9 Missing ⚠️
.../com/cloud/agent/api/routing/DhcpEntryCommand.java 0.00% 6 Missing ⚠️
...a/com/cloud/network/router/CommandSetupHelper.java 0.00% 3 Missing ⚠️
...rce/virtualnetwork/facade/DhcpEntryConfigItem.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12410      +/-   ##
============================================
- Coverage     17.76%   17.76%   -0.01%     
  Complexity    15863    15863              
============================================
  Files          5923     5923              
  Lines        530558   530577      +19     
  Branches      64830    64831       +1     
============================================
  Hits          94262    94262              
- Misses       425749   425768      +19     
  Partials      10547    10547              
Flag Coverage Δ
uitests 3.57% <ø> (ø)
unittests 18.85% <5.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants