Arik Hadas has uploaded a new change for review. Change subject: engine: Correct migration related events ......................................................................
engine: Correct migration related events The misleading events: "Migration of VM xp_desktop from Host knight failed. Error: Migration succeeded" "VM oo is down. Exit message: Migration succeeded" are no longer printed when the migration process succeeds Change-Id: I0b92611b423ee3f2336816873505566c41a17b0b Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=836780 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java 1 file changed, 26 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/9199/1 diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index d0f0dc8..f5cebaa 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -1130,19 +1130,12 @@ } private void HandleVmOnDown(VM cacheVm, VmDynamic vmDynamic, VmStatistics vmStatistics) { - // Get the exit status and message: VmExitStatus exitStatus = vmDynamic.getExitStatus(); - String exitMessage = vmDynamic.getExitMessage(); - - // Generate an error or information event according to the exit status: - AuditLogType type = exitStatus == VmExitStatus.Normal ? AuditLogType.VM_DOWN : AuditLogType.VM_DOWN_ERROR; - AuditLogableBase logable = new AuditLogableBase(_vds.getId(), vmStatistics.getId()); - if (exitMessage != null) { - logable.AddCustomValue("ExitMessage", "Exit message: " + exitMessage); - } - auditLog(logable, type); if (exitStatus != VmExitStatus.Normal) { + + auditVmOnDownEvent(exitStatus, vmDynamic.getExitMessage(), vmStatistics.getId()); + /** * Vm failed to run - try to rerun it on other Vds */ @@ -1161,11 +1154,29 @@ AddVmDynamicToList(vmDynamic); } } else { + // if went down normally during migration process (either on source or on destination) + // don't generate an event + if (cacheVm != null) { + auditVmOnDownEvent(exitStatus, vmDynamic.getExitMessage(), vmStatistics.getId()); + } + /** * Vm moved safely to down status. May be migration - just remove it from Async Running command. */ ResourceManager.getInstance().RemoveAsyncRunningVm(vmDynamic.getId()); } + } + + /** + * Generate an error or information event according to the exit status of a VM in status 'down' + */ + private void auditVmOnDownEvent(VmExitStatus exitStatus, String exitMessage, Guid vmStatisticsId) { + AuditLogType type = exitStatus == VmExitStatus.Normal ? AuditLogType.VM_DOWN : AuditLogType.VM_DOWN_ERROR; + AuditLogableBase logable = new AuditLogableBase(_vds.getId(), vmStatisticsId); + if (exitMessage != null) { + logable.AddCustomValue("ExitMessage", "Exit message: " + exitMessage); + } + auditLog(logable, type); } private void AfterSuspendTreatment(VmDynamic vm) { @@ -1182,7 +1193,10 @@ AuditLogableBase logable = new AuditLogableBase(_vds.getId(), curVm.getId()); switch (curVm.getstatus()) { case MigratingFrom: { - if (vmDynamic != null && vmDynamic.getExitStatus() != VmExitStatus.Normal && curVm.getmigrating_to_vds() != null) { + // if a VM that was a source host in migration process is now down with normal + // exit status that's OK, otherwise.. + if (vmDynamic != null && vmDynamic.getExitStatus() != VmExitStatus.Normal) { + if (curVm.getmigrating_to_vds() != null) { DestroyVmVDSCommand<DestroyVmVDSCommandParameters> destroyCmd = new DestroyVmVDSCommand<DestroyVmVDSCommandParameters> (new DestroyVmVDSCommandParameters(new Guid(curVm.getmigrating_to_vds().toString()), @@ -1210,6 +1224,7 @@ ResourceManager.getInstance().RemoveAsyncRunningVm(vmDynamic.getId()); } break; + } case PoweredDown: { logable.AddCustomValue("VmStatus", "PoweredDown"); type = AuditLogType.VM_DOWN; -- To view, visit http://gerrit.ovirt.org/9199 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0b92611b423ee3f2336816873505566c41a17b0b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches