Skip to content

Mp/flxcld 2802#12

Merged
cp1362 merged 5 commits into
att:att/4.22.0.0from
poddm:mp/FLXCLD-2802
Jul 21, 2026
Merged

Mp/flxcld 2802#12
cp1362 merged 5 commits into
att:att/4.22.0.0from
poddm:mp/FLXCLD-2802

Conversation

@poddm

@poddm poddm commented Jul 20, 2026

Copy link
Copy Markdown

Description

This PR makes ManagementServerNode the single, canonical source of the management-server node id (msid) and adds an opt-in mode to derive that id from the node FQDN instead of the host MAC address.

By default the msid is still derived from the host hardware MAC address, so existing behaviour is unchanged. When the MAC address is not stable across restarts, however, it produces a new msid, which orphans the mshost row and breaks async jobs, HA work (fk_op_ha_work__mgmt_server_id), and router/stats ownership.

Setting the environment variable CLOUDSTACK_MSID_FROM_FQDN=true (or the system property cloudstack.msid.from.fqdn=true) instead derives the msid from a SHA-256 hash of the node's canonical FQDN, which stays stable across restarts, so the node keeps ownership of its mshost row, jobs, and HA work. If the FQDN cannot be resolved, the code falls back to the MAC-based id. Accepted truthy values are true, 1, and yes (case-insensitive); the generated id is masked to a positive, non-zero 48-bit value.

Because the id must be consistent everywhere, all direct callers of MacAddress.getMacAddress().toLong() used for node identity are refactored to obtain it from ManagementServerNode.getManagementServerId():

  • com.cloud.hypervisor.CloudZonesStartupProcessor
  • com.cloud.network.NetworkUsageManagerImpl (DirectNetworkStatsListener)
  • com.cloud.network.router.VirtualNetworkApplianceManagerImpl
  • com.cloud.server.ManagementServerImpl#getId()
  • com.cloud.server.StatsCollector

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):

N/A

How Has This Been Tested?

  • Default mode (no env var / system property set): verified the msid is still derived from the host MAC address, so existing deployments are unaffected.
  • FQDN mode (CLOUDSTACK_MSID_FROM_FQDN=true): verified the generated msid is stable across management-server restarts, that the mshost row is reused, and that async jobs and HA work remain associated with the node.
  • Verified the SHA-256-derived id is positive and non-zero.
  • Verified the FQDN-resolution failure path falls back to the MAC-based id.
  • Verified all refactored consumers (CloudZonesStartupProcessor, NetworkUsageManagerImpl, VirtualNetworkApplianceManagerImpl, ManagementServerImpl, StatsCollector) resolve the same node id.

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

  • Enabled FQDN mode on a host with an unresolvable/misconfigured FQDN to confirm the MAC fallback path.
  • Toggled the accepted truthy values (true, 1, yes, mixed case) and confirmed each enables FQDN mode, while other values leave the default MAC behaviour intact.
  • Restarted the management server multiple times in both modes to confirm the id remains stable in FQDN mode and unchanged in default mode.

@db3922 db3922 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved

@cp1362
cp1362 merged commit 517b1a4 into att:att/4.22.0.0 Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants