Daniel Erez has uploaded a new change for review. Change subject: core: SnapshotStatus - remove BROKEN status ......................................................................
core: SnapshotStatus - remove BROKEN status Remove BROKEN SnapshotStatus as it is not used anymore: * Remove from SnapshotStatus enum. * Remove SnapshotsValidator -> snapshotNotBroken validation. * Remove ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN VdcBllMessage. Change-Id: I509e278d2d37fb32a7737bf21111f1bfc7b5019b Bug-Url: https://bugzilla.redhat.com/1056935 Signed-off-by: Daniel Erez <de...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidator.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidatorTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 10 files changed, 3 insertions(+), 40 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/27612/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java index bf99076..8652795 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java @@ -107,9 +107,8 @@ protected boolean canDoAction() { SnapshotsValidator snapshotsValidator = createSnapshotsValidator(); - // If snapshot does not exist or is broken, there is not point in checking any of the VM related checks + // If snapshot does not exist, there is not point in checking any of the VM related checks if (!validate(snapshotsValidator.snapshotExists(getSnapshot())) - || !validate(snapshotsValidator.snapshotNotBroken(getSnapshot())) || !validate(snapshotsValidator.vmNotDuringSnapshot(getSnapshot().getVmId()))) { return false; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java index 0c7da9a..0f0612c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java @@ -255,8 +255,7 @@ if (!validate(vmValidator.vmDown()) || !validate(snapshotsValidator.snapshotExists(getVmId(), getParameters().getDstSnapshotId())) || !validate(snapshotsValidator.vmNotDuringSnapshot(getVmId())) - || !validate(snapshotsValidator.vmNotInPreview(getVmId())) - || !validate(snapshotsValidator.snapshotNotBroken(snapshot))) { + || !validate(snapshotsValidator.vmNotInPreview(getVmId()))) { return false; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidator.java index 0f96d94..6ca5247 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidator.java @@ -59,18 +59,6 @@ } /** - * Check that the given snapshot is not broken, and if it is then return the corresponding error. - * - * @param snapshot - * The snapshot to check. - * @return Is snapshot broken or not. - */ - public ValidationResult snapshotNotBroken(Snapshot snapshot) { - return SnapshotStatus.BROKEN == snapshot.getStatus() ? - new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN) : ValidationResult.VALID; - } - - /** * Check if the given snapshot id exists for the given VM in the DB. * * @param vmId diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidatorTest.java index fcbcd6b..a56a0f7 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/snapshots/SnapshotsValidatorTest.java @@ -104,19 +104,6 @@ validateValidResult(validator.snapshotExists(snapshot)); } - @Test - public void snapshotNotBrokenReturnsInvalidResult() throws Exception { - snapshot.setStatus(SnapshotStatus.BROKEN); - - validateInvalidResult(validator.snapshotNotBroken(snapshot), - VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN); - } - - @Test - public void snapshotNotBrokenReturnsValidResult() throws Exception { - validateValidResult(validator.snapshotNotBroken(snapshot)); - } - /** * Validate that the given result is valid. * diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java index cfc0550..6c6c430 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java @@ -265,10 +265,7 @@ public enum SnapshotStatus { OK, LOCKED, - IN_PREVIEW, - - /** The snapshot is broken, and can only be deleted. */ - BROKEN + IN_PREVIEW } public static enum SnapshotType { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 8f25e23..46e2a4e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -152,7 +152,6 @@ ACTION_TYPE_FAILED_VM_SNAPSHOT_TYPE_NOT_ALLOWED(ErrorType.CONFLICT), ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID(ErrorType.DATA_CORRUPTION), ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION(ErrorType.BAD_PARAMETERS), - ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN(ErrorType.DATA_CORRUPTION), ACTION_TYPE_FAILED_IMAGE_REPOSITORY_NOT_FOUND(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_VM_IS_RUNNING(ErrorType.CONFLICT), ACTION_TYPE_FAILED_VM_IS_BEING_CLONED(ErrorType.CONFLICT), diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index ff16a20..ec0150c 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -19,7 +19,6 @@ ACTION_TYPE_FAILED_VM_SNAPSHOT_TYPE_NOT_ALLOWED=Cannot ${action} ${type}. The Snapshot type is ${snapshotType} while the operation is supported for Snapshots of the following type(s): ${supportedSnapshotTypes}. ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID=Cannot ${action} ${type}. The snapshot configuration is corrupted (snapshot ID is empty). Please contact the system administrator. ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION=Cannot ${action} ${type}. The snapshot ${SnapshotName} of VM ${VmName} has no configuration available. Please choose a snapshot with configuration available. -ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN=Cannot ${action} ${type}. The snapshot is broken, and no further work can be done on it. Please remove this snapshot from the VM. ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM=Cannot ${action} ${type}. This VM is not managed by the engine. ACTION_TYPE_FAILED_MIN_MEMORY_CANNOT_EXCEED_MEMORY_SIZE=Cannot ${action} ${type}. Physical Memory Guaranteed cannot exceed Memory Size. IMAGE_REPOSITORY_NOT_FOUND=Storage Domain cannot be accessed.\n\ diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index 8fa0e81..ce5af5e 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -67,9 +67,6 @@ @DefaultStringValue("Cannot ${action} ${type}. The snapshot ${SnapshotName} of VM ${VmName} has no configuration available. Please choose a snapshot with configuration available.") String ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION(); - @DefaultStringValue("Cannot ${action} ${type}. The snapshot is broken, and no further work can be done on it. Please remove this snapshot from the VM.") - String ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN(); - @DefaultStringValue("Cannot ${action} ${type}. This VM is not managed by the engine.") String ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 6735ee2..902c9d2 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -19,7 +19,6 @@ ACTION_TYPE_FAILED_VM_SNAPSHOT_TYPE_NOT_ALLOWED=Cannot ${action} ${type}. The Snapshot type is ${snapshotType} while the operation is supported for Snapshots of the following type(s): ${supportedSnapshotTypes}. ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID=Cannot ${action} ${type}. The snapshot configuration is corrupted (snapshot ID is empty). Please contact the system administrator. ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION=Cannot ${action} ${type}. The snapshot ${SnapshotName} of VM ${VmName} has no configuration available. Please choose a snapshot with configuration available. -ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN=Cannot ${action} ${type}. The snapshot is broken, and no further work can be done on it. Please remove this snapshot from the VM. ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM=Cannot ${action} ${type}. This VM is not managed by the engine. ACTION_TYPE_FAILED_MIN_MEMORY_CANNOT_EXCEED_MEMORY_SIZE=Cannot ${action} ${type}. Physical Memory Guaranteed cannot exceed Memory Size. IMAGE_REPOSITORY_NOT_FOUND=Storage Domain cannot be accessed.\n\ diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 11672ae..0fbbab1 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -19,7 +19,6 @@ ACTION_TYPE_FAILED_VM_SNAPSHOT_TYPE_NOT_ALLOWED=Cannot ${action} ${type}. The Snapshot type is ${snapshotType} while the operation is supported for Snapshots of the following type(s): ${supportedSnapshotTypes}. ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID=Cannot ${action} ${type}. The snapshot configuration is corrupted (snapshot ID is empty). Please contact the system administrator. ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION=Cannot ${action} ${type}. The snapshot ${SnapshotName} of VM ${VmName} has no configuration available. Please choose a snapshot with configuration available. -ACTION_TYPE_FAILED_VM_SNAPSHOT_IS_BROKEN=Cannot ${action} ${type}. The snapshot is broken, and no further work can be done on it. Please remove this snapshot from the VM. ACTION_TYPE_FAILED_CANNOT_RUN_ACTION_ON_NON_MANAGED_VM=Cannot ${action} ${type}. This VM is not managed by the engine. ACTION_TYPE_FAILED_MIN_MEMORY_CANNOT_EXCEED_MEMORY_SIZE=Cannot ${action} ${type}. Physical Memory Guaranteed cannot exceed Memory Size. IMAGE_REPOSITORY_NOT_FOUND=Storage Domain cannot be accessed.\n\ -- To view, visit http://gerrit.ovirt.org/27612 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I509e278d2d37fb32a7737bf21111f1bfc7b5019b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <de...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches