java/com.sap.sailing.landscape.common/src/com/sap/sailing/landscape/common/SharedLandscapeConstants.java
... ...
@@ -126,8 +126,12 @@ public interface SharedLandscapeConstants {
126 126
127 127
String ARCHIVE_SERVER_APPLICATION_REPLICA_SET_NAME = "ARCHIVE";
128 128
129
- String ARCHIVE_SERVER_NEW_CANDIDATE_INSTANCE_NAME = "SL Archive (New Candidate)";
129
+ String ARCHIVE_SERVER_INSTANCE_NAME = "SL Archive";
130 130
131
+ String ARCHIVE_SERVER_NEW_CANDIDATE_INSTANCE_NAME = ARCHIVE_SERVER_INSTANCE_NAME+" (New Candidate)";
132
+
133
+ String ARCHIVE_SERVER_FAILOVER_INSTANCE_NAME = ARCHIVE_SERVER_INSTANCE_NAME+" (Failover)";
134
+
131 135
String ARCHIVE_CANDIDATE_SUBDOMAIN = "archive-candidate";
132 136
133 137
/**
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/impl/ArchiveCandidateMonitoringBackgroundTask.java
... ...
@@ -291,6 +291,6 @@ public class ArchiveCandidateMonitoringBackgroundTask implements Runnable {
291 291
private void notifyProcessOwnerCandidateIsReadyForSpotChecksAndRotation() throws MailException, InterruptedException, ExecutionException {
292 292
landscapeService.sendMailToUser(currentUser, "NewArchiveCandidateReadyForSpotChecksAndRotationSubject",
293 293
"NewArchiveCandidateReadyForSpotChecksAndRotationBody", replicaSet.getName(), candidateHostname,
294
- replicaSet.getHostname(), Util.joinStrings("\n", Util.map(checks, Check::getName)));
294
+ replicaSet.getHostname(), " - "+Util.joinStrings("\n - ", Util.map(checks, Check::getName)));
295 295
}
296 296
}
java/com.sap.sailing.landscape/src/com/sap/sailing/landscape/impl/LandscapeServiceImpl.java
... ...
@@ -359,14 +359,21 @@ public class LandscapeServiceImpl implements LandscapeService {
359 359
+ archiveAndFailoverIPs.getA() + ". Turning production into failover and candidate into production.");
360 360
reverseProxyCluster.setArchiveAndFailoverIPs(candidate.getHost().getPrivateAddress().getHostAddress(),
361 361
archiveAndFailoverIPs.getA(), Optional.ofNullable(optionalKeyName), privateKeyEncryptionPassphrase);
362
- final SailingAnalyticsHost<String> oldFailover = getLandscape().getHostByPrivateDnsNameOrIpAddress(region,
363
- archiveAndFailoverIPs.getB(), new SailingAnalyticsHostSupplier<>());
364
- logger.info("Terminating old failover host " + oldFailover.getInstanceId() + " with internal IP "
365
- + oldFailover.getPrivateAddress());
366
- oldFailover.setTerminationProtection(false);
367
- oldFailover.terminate();
362
+ final SailingAnalyticsHost<String> oldProductionArchive = getLandscape().getHostByPrivateDnsNameOrIpAddress(region, archiveAndFailoverIPs.getA(), new SailingAnalyticsHostSupplier<>());
363
+ getLandscape().setInstanceName(oldProductionArchive, SharedLandscapeConstants.ARCHIVE_SERVER_FAILOVER_INSTANCE_NAME);
364
+ getLandscape().setInstanceName(candidate.getHost(), SharedLandscapeConstants.ARCHIVE_SERVER_INSTANCE_NAME);
368 365
logger.info("Removing reverse proxy rule for archive candidate with hostname "+ candidateHostname);
369 366
reverseProxyCluster.removeRedirect(candidateHostname, Optional.ofNullable(optionalKeyName), privateKeyEncryptionPassphrase);
367
+ try {
368
+ final SailingAnalyticsHost<String> oldFailover = getLandscape().getHostByPrivateDnsNameOrIpAddress(region,
369
+ archiveAndFailoverIPs.getB(), new SailingAnalyticsHostSupplier<>());
370
+ logger.info("Terminating old failover host " + oldFailover.getInstanceId() + " with internal IP "
371
+ + oldFailover.getPrivateAddress());
372
+ oldFailover.setTerminationProtection(false);
373
+ oldFailover.terminate();
374
+ } catch (Exception e) {
375
+ logger.warning("Issue trying to clean up old failover instance: "+e.getMessage());
376
+ }
370 377
sendMailAboutNewArchiveServerLive(archiveReplicaSet);
371 378
}
372 379
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/AwsLandscape.java
... ...
@@ -892,4 +892,6 @@ public interface AwsLandscape<ShardingKey> extends Landscape<ShardingKey> {
892 892
* Removes hosts from an IP-based target group.
893 893
*/
894 894
void removeIpTargetFromTargetGroup(TargetGroup<ShardingKey> targetGroup, Iterable<AwsInstance<ShardingKey>> hosts);
895
+
896
+ void setInstanceName(AwsInstance<ShardingKey> host, String newInstanceName);
895 897
}
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/ReverseProxy.java
... ...
@@ -133,5 +133,6 @@ public interface ReverseProxy<ShardingKey, MetricsT extends ApplicationProcessMe
133 133
*/
134 134
Pair<String, String> getArchiveAndFailoverIPs(Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase) throws Exception;
135 135
136
- void setArchiveAndFailoverIPs(String hostAddress, String b, Optional<String> ofNullable, byte[] privateKeyEncryptionPassphrase) throws Exception;
136
+ void setArchiveAndFailoverIPs(String productionArchiveServerInternalIPAddress, String failoverArchiveServerInternalIPAddress,
137
+ Optional<String> ofNullable, byte[] privateKeyEncryptionPassphrase) throws Exception;
137 138
}
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/ApacheReverseProxyCluster.java
... ...
@@ -261,11 +261,11 @@ public class ApacheReverseProxyCluster<ShardingKey, MetricsT extends Application
261 261
}
262 262
263 263
@Override
264
- public void setArchiveAndFailoverIPs(String hostAddress, String b, Optional<String> optionalKeyName,
265
- byte[] privateKeyEncryptionPassphrase) throws Exception {
264
+ public void setArchiveAndFailoverIPs(String productionArchiveServerInternalIPAddress, String failoverArchiveServerInternalIPAddress,
265
+ Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase) throws Exception {
266 266
if (getReverseProxies().iterator().hasNext()) {
267 267
final ApacheReverseProxy<ShardingKey, MetricsT, ProcessT> proxy = getReverseProxies().iterator().next();
268
- proxy.getArchiveAndFailoverIPs(optionalKeyName, privateKeyEncryptionPassphrase);
268
+ proxy.setArchiveAndFailoverIPs(productionArchiveServerInternalIPAddress, failoverArchiveServerInternalIPAddress, optionalKeyName, privateKeyEncryptionPassphrase);
269 269
}
270 270
}
271 271
}
java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/AwsLandscapeImpl.java
... ...
@@ -1077,6 +1077,13 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
1077 1077
}
1078 1078
1079 1079
@Override
1080
+ public void setInstanceName(AwsInstance<ShardingKey> host, String newInstanceName) {
1081
+ logger.info("Setting Name tag for instance "+host+" to "+newInstanceName);
1082
+ getEc2Client(getRegion(host.getAvailabilityZone().getRegion()))
1083
+ .createTags(b -> b.tags(Tag.builder().key("Name").value(newInstanceName).build()));
1084
+ }
1085
+
1086
+ @Override
1080 1087
public void terminate(AwsInstance<ShardingKey> host) {
1081 1088
logger.info("Terminating instance "+host);
1082 1089
getEc2Client(getRegion(host.getAvailabilityZone().getRegion())).terminateInstances(