Libor Spevak has uploaded a new change for review. Change subject: core: Update VM status if host is not available ......................................................................
core: Update VM status if host is not available The VM status is set to Unknown if the host is marked as non-responsive (after timeout). The status icon in the WebAdmin change reflects the Unknown status. When the host is available again (Up status), the change from Unknown status to real status is logged into the audit log (VM status restored). Change-Id: If569de776dfb9c97589603040e7a7f620409c361 Bug-Url: https://bugzilla.redhat.com/921521 Signed-off-by: Libor Spevak <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java 6 files changed, 36 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/13706/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java index cc135ec..27769e7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java @@ -316,12 +316,13 @@ VM_MIGRATION_DONE(63), VM_MIGRATION_ABORT(64), VM_MIGRATION_FAILED(65), + VM_FAILURE(66), VM_MIGRATION_START_SYSTEM_INITIATED(67), VM_MIGRATION_FAILED_FROM_TO(120), VM_MIGRATION_TRYING_RERUN(128), VM_CANCEL_MIGRATION(161), VM_CANCEL_MIGRATION_FAILED(162), - VM_FAILURE(66), + VM_STATUS_RESTORED(163), VM_MIGRATION_FAILED_DURING_MOVE_TO_MAINTENANCE(140), VM_SET_TO_UNKNOWN_STATUS(142), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java index 4636211..2287735 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java @@ -40,6 +40,7 @@ AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.VM_MIGRATION_START); AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.VM_MIGRATION_FAILED); AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.VM_NOT_RESPONDING); + AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.VM_STATUS_RESTORED); AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.HA_VM_RESTART_FAILED); AddEventNotificationEntry(EventNotificationEntity.Vm, AuditLogType.HA_VM_FAILED); // IRS diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java index c820e33..a47b5ec 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java @@ -441,6 +441,7 @@ severities.put(AuditLogType.TEMPLATE_IMPORT_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.VM_IMPORT_INFO, AuditLogSeverity.NORMAL); severities.put(AuditLogType.VM_NOT_RESPONDING, AuditLogSeverity.WARNING); + severities.put(AuditLogType.VM_STATUS_RESTORED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.VM_MIGRATION_TRYING_RERUN, AuditLogSeverity.WARNING); severities.put(AuditLogType.VM_PAUSED_ENOSPC, AuditLogSeverity.ERROR); severities.put(AuditLogType.VM_PAUSED_ERROR, AuditLogSeverity.ERROR); diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties index f997356..5a42ec8 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -208,6 +208,7 @@ VM_MIGRATION_TRYING_RERUN=Migration failed${DueToMigrationError}. Trying to migrate to another Host (VM: ${VmName}, Source: ${VdsName}, Destination: ${VdsDestination}). VM_CANCEL_MIGRATION=Migration cancelled (VM: ${VmName}, Source: ${VdsName}, User: ${UserName}). VM_CANCEL_MIGRATION_FAILED=Failed to cancel migration for VM: ${VmName} +VM_STATUS_RESTORED=VM ${VmName} status was restored to ${VmStatus}. VDS_SLOW_STORAGE_RESPONSE_TIME=Slow storage response time on Host ${VdsName}. IRS_HOSTED_ON_VDS=Storage Pool Manager runs on Host ${VdsName} (Address: ${ServerIp}). USER_ATTACH_VM_POOL_TO_AD_GROUP=Group ${AdGroupName} was attached to VM Pool ${VmPoolName} by ${UserName}. diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java index 5f0e602..9f672ee 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -18,6 +19,8 @@ import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSDomainsData; import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.core.common.businessentities.VM; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VdsDynamic; import org.ovirt.engine.core.common.businessentities.VdsStatistics; import org.ovirt.engine.core.common.businessentities.VmDynamic; @@ -26,6 +29,7 @@ import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters; +import org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; import org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase; @@ -623,6 +627,9 @@ AuditLogableBase logable = new AuditLogableBase(vds.getId()); AuditLogDirector.log(logable, AuditLogType.VDS_FAILURE); ResourceManager.getInstance().getEventListener().vdsNotResponding(vds); + + // update VMs states running on the host to unknown + moveVMsToUnknown(); } return true; } @@ -688,4 +695,17 @@ return vdsMonitor; } + private void moveVMsToUnknown() { + final List<VM> vmList = DbFacade.getInstance().getVmDao().getAllRunningForVds(getVdsId()); + for (VM vm : vmList) { + ResourceManager.getInstance().runVdsCommand( + VDSCommandType.SetVmStatus, + new SetVmStatusVDSCommandParameters(vm.getId(), VMStatus.Unknown)); + // log VM transition to unknown status + final AuditLogableBase logable = new AuditLogableBase(); + logable.setVmId(vm.getId()); + AuditLogDirector.log(logable, AuditLogType.VM_SET_TO_UNKNOWN_STATUS); + } + } + } 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 62e1959..393889d 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 @@ -1507,6 +1507,10 @@ vmToUpdate.getId(), vmToUpdate.getStatus().name(), runningVm.getStatus().name()); + + if (vmToUpdate.getStatus() == VMStatus.Unknown) { + logVmStatusTransionFromUnknown(vmToUpdate, runningVm); + } } } @@ -1884,4 +1888,11 @@ return DbFacade.getInstance(); } + private static void logVmStatusTransionFromUnknown(VM vmToUpdate, VmDynamic runningVm) { + final AuditLogableBase auditLogable = new AuditLogableBase(); + auditLogable.setVmId(vmToUpdate.getId()); + auditLogable.addCustomValue("VmStatus", runningVm.getStatus().toString()); + AuditLogDirector.log(auditLogable, AuditLogType.VM_STATUS_RESTORED); + } + } -- To view, visit http://gerrit.ovirt.org/13706 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If569de776dfb9c97589603040e7a7f620409c361 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Libor Spevak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
