Skip to content

Commit 78516ea

Browse files
mprokopchukCopilot
authored andcommitted
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c64d1fe commit 78516ea

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,9 @@ public ManagementServerHostVO doInTransaction(final TransactionStatus status) {
10481048

10491049
ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
10501050

1051-
// Look for duplicate hostname in the case of kubernetes setup where ip/mac changes but hostname is constant.
1052-
if (mshost == null && StringUtils.isNotBlank(currentHostname)) {
1051+
// Look for duplicate hostname in Kubernetes setups where IP/MAC changes but hostname is constant.
1052+
// Skip the default "localhost" hostname fallback to avoid removing other active nodes when hostname resolution fails.
1053+
if (mshost == null && StringUtils.isNotBlank(currentHostname) && !StringUtils.equalsIgnoreCase(currentHostname, "localhost")) {
10531054
List<ManagementServerHostVO> activeEntries = _mshostDao.findAllByName(currentHostname);
10541055
for (ManagementServerHostVO activeEntry : activeEntries) {
10551056
// Found an active entry with this hostname but different MSID

0 commit comments

Comments
 (0)