You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support to enable/disable VM High Availability manager and related alerts (apache#10118)
- Adds new config 'vm.ha.enabled' with Zone scope, to enable/disable VM High Availability manager. This is enable by default (for backward compatibilty).
When enabled, the VM HA WorkItems (for VM Stop, Restart, Migration, Destroy) can be created and the scheduled items are executed.
When disabled, new VM HA WorkItems are not allowed and the scheduled items are retried until max retries configured at 'vm.ha.migration.max.retries' (executed in case HA is re-enabled during retry attempts), and then purged after 'time.between.failures' by the cleanup thread that runs regularly at 'time.between.cleanup'.
- Adds new config 'vm.ha.alerts.enabled' with Zone scope, to enable/disable alerts for the VM HA operations. This is enabled by default.
"Enable/Disable VM High Availability manager, it is enabled by default."
128
+
+ " When enabled, the VM HA WorkItems (for VM Stop, Restart, Migration, Destroy) can be created and the scheduled items are executed; and"
129
+
+ " When disabled, new VM HA WorkItems are not allowed and the scheduled items are retried until max retries configured at 'vm.ha.migration.max.retries'"
130
+
+ " (executed in case HA is re-enabled during retry attempts), and then purged after 'time.between.failures' by the cleanup thread that runs"
131
+
+ " regularly at 'time.between.cleanup'", true, Zone);
if (!VmHaEnabled.valueIn(host.getDataCenterId())) {
284
+
Stringmessage = String.format("Unable to schedule restart for VMs on host %s (%d), VM high availability manager is disabled.", host.getName(), host.getId());
285
+
if (logger.isDebugEnabled()) {
286
+
logger.debug(message);
287
+
}
288
+
sendHostAlert(host, message);
289
+
return;
290
+
}
291
+
263
292
logger.warn("Scheduling restart for VMs on host " + host.getId() + "-" + host.getName());
assert (type == WorkType.CheckStop || type == WorkType.ForceStop || type == WorkType.Stop);
319
348
320
349
if (_haDao.hasBeenScheduled(vm.getId(), type)) {
321
350
logger.info("There's already a job scheduled to stop " + vm);
322
-
return;
351
+
returnfalse;
352
+
}
353
+
354
+
if (!VmHaEnabled.valueIn(vm.getDataCenterId())) {
355
+
Stringmessage = String.format("Unable to schedule stop for the VM %s (%d) on host %d, VM high availability manager is disabled.", vm.getName(), vm.getId(), hostId);
logger.info("Scheduled migration work of VM " + vm.getUuid() + " from host " + _hostDao.findById(vm.getHostId()) + " with HAWork " + work);
346
-
wakeupWorkers();
381
+
if (vm.getHostId() == null) {
382
+
returnfalse;
383
+
}
384
+
385
+
if (!VmHaEnabled.valueIn(vm.getDataCenterId())) {
386
+
Stringmessage = String.format("Unable to schedule migration for the VM %s (%d) on host %d, VM high availability manager is disabled.", vm.getName(), vm.getId(), vm.getHostId());
Stringmessage = String.format("Unable to schedule destroy for the VM %s (%d) on host %d, VM high availability manager is disabled.", vm.getName(), vm.getId(), hostId);
if (vm != null && !VmHaEnabled.valueIn(vm.getDataCenterId())) {
966
+
if (logger.isDebugEnabled()) {
967
+
logger.debug(String.format("VM high availability manager is disabled, rescheduling the HA work %s, for the VM %s (id) to retry later in case VM high availability manager is enabled on retry attempt", work, vm.getName(), vm.getId()));
if (CollectionUtils.isNotEmpty(vms) && !HighAvailabilityManagerImpl.VmHaEnabled.valueIn(host.getDataCenterId())) {
1369
+
thrownewCloudRuntimeException(String.format("Cannot perform maintain for the host %s (%d) as there are running VMs on it and VM high availability manager is disabled", host.getName(), hostId));
0 commit comments