Roy Golan has uploaded a new change for review. Change subject: core: cancel migration better error handling ......................................................................
core: cancel migration better error handling Cancelling migration could fail because the VM already migrated to the destination host or the VM might crash on the src host. those conditions results error return 1, "Virtual machine does not exist" from the host which is confusing. Instead the user is guided to try again and try to track the VM events logs. Change-Id: I546cf86c1c3eeb062b9558d3c82e25035c82efbb Bug-Url: https://bugzilla.redhat.com/878778 Signed-off-by: Roy Golan <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CancelMigrateVDSCommand.java 3 files changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/25/11225/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java index 58adad3..52cdf52 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java @@ -386,6 +386,10 @@ // Gluster errors NO_UP_SERVER_FOUND(7000), // error to indicate backend does not recognize the session + + // migration cancel failed, VM doesn't exist + MIGRATION_CANCEL_ERROR_NO_VM(5100), + SESSION_ERROR(9999), ; private int intValue; diff --git a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties index 50d66a7..5769e38 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties @@ -343,6 +343,7 @@ NO_ACTIVE_ISO_DOMAIN_IN_DATA_CENTER=There is no active ISO Domain in Data Center. MIGRATION_DEST_INVALID_HOSTNAME=Migration destination has an invalid hostname MIGRATION_CANCEL_ERROR=Migration not in progress +MIGRATION_CANCEL_ERROR_NO_VM=Cancel migration has failed. Please try again in a few moments and track the VM's event log for details. DB=Database error. DB_NO_SUCH_VM=Could not find VM in Database. MAC_POOL_NO_MACS_LEFT=No available MAC addresses left in the MAC Address Pool. diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CancelMigrateVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CancelMigrateVDSCommand.java index 0811df9..4dfd19e 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CancelMigrateVDSCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CancelMigrateVDSCommand.java @@ -1,5 +1,7 @@ package org.ovirt.engine.core.vdsbroker.vdsbroker; +import org.ovirt.engine.core.common.errors.VDSError; +import org.ovirt.engine.core.common.errors.VdcBllErrors; import org.ovirt.engine.core.common.vdscommands.VdsAndVmIDVDSParametersBase; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.vdsbroker.ResourceManager; @@ -16,4 +18,22 @@ ProceedProxyReturnValue(); ResourceManager.getInstance().RemoveAsyncRunningVm(vmId); } + + /** + * overrode to improve error handling when cancel migration failed because the VM doesn't exist on the target host.<BR> + * may happen when migration already ended. + */ + @Override + protected void ProceedProxyReturnValue() { + VdcBllErrors returnStatus = GetReturnValueFromStatus(getReturnStatus()); + switch (returnStatus) { + case noVM: + VDSExceptionBase outEx = createDefaultConcreteException(getReturnStatus().mMessage); + InitializeVdsError(returnStatus); + outEx.setVdsError(new VDSError(VdcBllErrors.MIGRATION_CANCEL_ERROR_NO_VM, getReturnStatus().mMessage)); + throw outEx; + default: + super.ProceedProxyReturnValue(); + } + } } -- To view, visit http://gerrit.ovirt.org/11225 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I546cf86c1c3eeb062b9558d3c82e25035c82efbb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
