identity: derive stable management server id (msid) from FQDN#13662
Open
poddm wants to merge 1 commit into
Open
identity: derive stable management server id (msid) from FQDN#13662poddm wants to merge 1 commit into
poddm wants to merge 1 commit into
Conversation
By default the management server node id (msid) is derived from the host MAC address. When the MAC address is not stable across restarts the msid changes, orphaning the mshost row and breaking async jobs, HA work (fk_op_ha_work__mgmt_server_id), and router/stats ownership. This adds an opt-in mode that derives the msid from a SHA-256 hash of the node FQDN, which stays stable across restarts. Enable it with the environment variable CLOUDSTACK_MSID_FROM_FQDN=true or the system property cloudstack.msid.from.fqdn=true. On failure to derive the FQDN-based id, ManagementServerNode records the cause and returns an invalid id (0) rather than silently reverting to the unstable MAC-based id, so the system-integrity check fails startup cleanly instead of raising an ExceptionInInitializerError. All node-identity consumers (StatsCollector, ManagementServerImpl, NetworkUsageManagerImpl, VirtualNetworkApplianceManagerImpl, CloudZonesStartupProcessor) now obtain the id from ManagementServerNode.getManagementServerId() so they agree on the same value. Adds ManagementServerNodeTest covering both derivation modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes the management server node id (
msid) stable across restarts by adding an opt-in mode that derives it from the node FQDN instead of the host MAC address.By default,
ManagementServerNodederives themsidfrom the host hardware MAC address (MacAddress.getMacAddress().toLong()). In environments where the MAC address is not stable across restarts (e.g. certain virtualized/containerized hosts), themsidchanges on restart. This orphans themshostrow and breaks any state keyed on the node id — async jobs, HA work (fk_op_ha_work__mgmt_server_id), and router/stats ownership.This change:
CLOUDSTACK_MSID_FROM_FQDN=true(or the system propertycloudstack.msid.from.fqdn=true) is set, themsidis derived from a SHA-256 hash of the node's canonical FQDN, which stays stable across restarts. Default behavior (MAC-based) is unchanged.ManagementServerNoderecords the cause and returns an invalid id (0) rather than silently reverting to the unstable MAC-based id. The invalid id makes the system-integritycheck()fail startup cleanly instead of raising anExceptionInInitializerErrorfrom static initialization.ManagementServerNode.getManagementServerId()so they agree on the same value —StatsCollector,ManagementServerImpl,NetworkUsageManagerImpl,VirtualNetworkApplianceManagerImpl, andCloudZonesStartupProcessor(previously some calledMacAddress.getMacAddress().toLong()directly).mac-address/fqdn:<name>) at startup for observability.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
ManagementServerNodeTestcovering both derivation modes (MAC-based default and FQDN-based opt-in), including the failure path that yields an invalid id.CLOUDSTACK_MSID_FROM_FQDN=true, the derived id is positive, non-zero, and identical across restarts for the same FQDN.ManagementServerNode.getManagementServerId().How did you try to break this feature and the system with this change?
ExceptionInInitializerError.true,1,yes, mixed case, surrounding whitespace) and confirmed unset/false/empty values keep the default MAC-based behavior.0for a valid FQDN.