winterhazel commented on code in PR #13182:
URL: https://github.com/apache/cloudstack/pull/13182#discussion_r3334553645
##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -2281,6 +2286,29 @@ private HostVO getNewHost(StartupCommand[]
startupCommands) {
return null;
}
+ protected void validateExistingHostLocationImmutable(final HostVO host,
final boolean newHost,
+ final long dcId, final Long podId, final Long clusterId, final
StartupCommand startup) {
+ if (newHost || host == null || host.getType() != Host.Type.Routing) {
+ return;
+ }
+ final long existingDcId = host.getDataCenterId();
+ final Long existingPodId = host.getPodId();
+ final Long existingClusterId = host.getClusterId();
+ if (existingPodId == null || existingClusterId == null) {
+ return;
+ }
+ if (existingDcId == dcId && Objects.equals(existingPodId, podId) &&
Objects.equals(existingClusterId, clusterId)) {
+ return;
+ }
+ final String identity = host.getUuid() != null ? host.getUuid() :
host.getGuid();
Review Comment:
```suggestion
final String identity = ObjectUtils.defaultIfNull(host.getUuid(),
host.getGuid());
```
##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -2281,6 +2286,29 @@ private HostVO getNewHost(StartupCommand[]
startupCommands) {
return null;
}
+ protected void validateExistingHostLocationImmutable(final HostVO host,
final boolean newHost,
+ final long dcId, final Long podId, final Long clusterId, final
StartupCommand startup) {
+ if (newHost || host == null || host.getType() != Host.Type.Routing) {
+ return;
+ }
+ final long existingDcId = host.getDataCenterId();
+ final Long existingPodId = host.getPodId();
+ final Long existingClusterId = host.getClusterId();
+ if (existingPodId == null || existingClusterId == null) {
+ return;
+ }
+ if (existingDcId == dcId && Objects.equals(existingPodId, podId) &&
Objects.equals(existingClusterId, clusterId)) {
Review Comment:
```suggestion
if (Objects.equals(existingDcId, dcId) &&
Objects.equals(existingPodId, podId) && Objects.equals(existingClusterId,
clusterId)) {
```
--
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]