-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLOUDSTACK-10309 Add option on if to VM HA power-on a OOB-shut-off-VM #2473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -359,6 +359,9 @@ public void setHostAllocators(final List<HostAllocator> hostAllocators) { | |
| Integer.class, "vm.job.report.interval", "60", | ||
| "Interval to send application level pings to make sure the connection is still working", false); | ||
|
|
||
| static final ConfigKey<Boolean> HaVmRestartHostUp = new ConfigKey<Boolean>("Advanced", Boolean.class, "ha.vm.restart.hostup", "true", | ||
| "If an out-of-band stop of a VM is detected and its host is up, then power on the VM", true); | ||
|
|
||
| ScheduledExecutorService _executor = null; | ||
|
|
||
| protected long _nodeId; | ||
|
|
@@ -3708,7 +3711,7 @@ public String getConfigComponentName() { | |
| public ConfigKey<?>[] getConfigKeys() { | ||
| return new ConfigKey<?>[] {ClusterDeltaSyncInterval, StartRetry, VmDestroyForcestop, VmOpCancelInterval, VmOpCleanupInterval, VmOpCleanupWait, | ||
| VmOpLockStateRetry, | ||
| VmOpWaitInterval, ExecuteInSequence, VmJobCheckInterval, VmJobTimeout, VmJobStateReportInterval, VmConfigDriveLabel}; | ||
| VmOpWaitInterval, ExecuteInSequence, VmJobCheckInterval, VmJobTimeout, VmJobStateReportInterval, VmConfigDriveLabel, HaVmRestartHostUp}; | ||
| } | ||
|
|
||
| public List<StoragePoolAllocator> getStoragePoolAllocators() { | ||
|
|
@@ -3853,7 +3856,7 @@ private void handlePowerOffReportWithNoPendingJobsOnVM(final VMInstanceVO vm) { | |
| case Stopped: | ||
| case Migrating: | ||
| s_logger.info("VM " + vm.getInstanceName() + " is at " + vm.getState() + " and we received a power-off report while there is no pending jobs on it"); | ||
| if(vm.isHaEnabled() && vm.getState() == State.Running && vm.getHypervisorType() != HypervisorType.VMware && vm.getHypervisorType() != HypervisorType.Hyperv) { | ||
| if(vm.isHaEnabled() && vm.getState() == State.Running && HaVmRestartHostUp.value() && vm.getHypervisorType() != HypervisorType.VMware && vm.getHypervisorType() != HypervisorType.Hyperv) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Slair1 would you mind extracting these conditions to a method (e.g.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, that sounds like a good idea, i am booked up here for a while, but it sounds like a good idea |
||
| s_logger.info("Detected out-of-band stop of a HA enabled VM " + vm.getInstanceName() + ", will schedule restart"); | ||
| if(!_haMgr.hasPendingHaWork(vm.getId())) { | ||
| _haMgr.scheduleRestart(vm, true); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to see the new ConfigKey be added to the return of getConfigKeys()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, not sure how that got missed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed