[
https://issues.apache.org/jira/browse/CLOUDSTACK-9323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15215929#comment-15215929
]
ASF GitHub Bot commented on CLOUDSTACK-9323:
--------------------------------------------
Github user alexandrelimassantana commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1454#discussion_r57714466
--- Diff: server/src/com/cloud/resource/ResourceManagerImpl.java ---
@@ -2112,11 +2112,13 @@ private boolean doCancelMaintenance(final long
hostId) {
/* TODO: move to listener */
_haMgr.cancelScheduledMigrations(host);
+
+ boolean vms_migrating = false;
final List<VMInstanceVO> vms = _haMgr.findTakenMigrationWork();
for (final VMInstanceVO vm : vms) {
if (vm != null && vm.getHostId() != null && vm.getHostId() ==
hostId) {
s_logger.info("Unable to cancel migration because the vm
is being migrated: " + vm);
--- End diff --
Can you turn the if on line 2119 to a method call like _isVmMigrating(vm,
hostId)_? Or even _vm.isMigrating(hostId)_
I think that it will improve the readability of this segment you are
working. Also... is there a need to check all VMs ? Once you find one that is
migrating do you still need to keep checking if they are migrating? If there is
not a need, try changing the loop for a while, or issuing a break.
> Cancelling host maintenance results in ""Internal error cancelling
> maintenance.”
> --------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-9323
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9323
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Abhinandan Prateek
> Assignee: Abhinandan Prateek
> Fix For: Future
>
>
> When we try to cancel the host from maintenance, all the hosts are
> complaining ""Internal error cancelling maintenance.” but successfully
> enabling the host back.
> In both scenarios like host is in up or disconnected state.
> This causes problem when we programmatically cancel maintenance….
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)