DaanHoogland commented on code in PR #14551:
URL: https://github.com/apache/cloudstack/pull/14551#discussion_r4482365200
##########
framework/cluster/src/main/java/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java:
##########
@@ -267,11 +263,27 @@ public List<ManagementServerHostVO>
listBy(ManagementServerHost.State... states)
return listBy(sc);
}
+ // The saved ID stops future ID changes but leaves old records behind
+ // This method handles duplicate records that already exist
+ // Old Down records must not make agents skip an address that also has an
Up record
Review Comment:
should this be added to a javadoc block?
##########
server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java:
##########
@@ -367,7 +364,8 @@ public class VirtualNetworkApplianceManagerImpl extends
ManagerBase implements V
private int _routerExtraPublicNics = 2;
private int _usageAggregationRange = 1440;
private String _usageTimeZone = "GMT";
- private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
+ // Use the saved ID to find the routers this server is in charge of
Review Comment:
```suggestion
```
this comment should rather go in the javadoc for the method the id is
actually used in.
##########
server/src/main/java/com/cloud/network/NetworkUsageManagerImpl.java:
##########
@@ -251,7 +252,8 @@ protected class DirectNetworkStatsListener implements
Listener {
private int _interval;
- private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
+ // Use the saved ID to check which traffic monitors this server is in
charge of
Review Comment:
```suggestion
```
##########
server/src/main/java/com/cloud/server/ManagementServerImpl.java:
##########
@@ -1205,9 +1197,10 @@ public DetailVO findDetail(final long hostId, final
String name) {
return _detailsDao.findDetail(hostId, name);
}
+ // Return the persistent server ID shared by the other CloudStack
components
Review Comment:
```suggestion
/**
* Return the persistent server ID shared by the other CloudStack
components
*/
```
##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -391,7 +390,8 @@ public String toString() {
private ScheduledExecutorService _diskStatsUpdateExecutor;
private int _usageAggregationRange = 1440;
private String _usageTimeZone = "GMT";
- private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
+ // Use the saved ID to check which stats jobs this server should do
Review Comment:
```suggestion
```
##########
utils/src/main/java/org/apache/cloudstack/utils/identity/ManagementServerId.java:
##########
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.utils.identity;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
+import java.util.function.LongSupplier;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.net.MacAddress;
+
+// Keeps the management server ID the same across restarts
Review Comment:
```suggestion
/**
* Keeps the management server ID the same across restarts
*/
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]