ofri masad has uploaded a new change for review. Change subject: webadmin: Fix Prevent move to empty quota (#845070) ......................................................................
webadmin: Fix Prevent move to empty quota (#845070) https://bugzilla.redhat.com/845070 This is a fix to an earlier patch (Iab0baf6f583f06197286a976211bada4a0654cb2) The AppError was updated and the quotaId transfered to the backend in case of an unavailable quota was changed to empty id. Change-Id: I5aac7f14c656d3b344e97b50c6282b6a527891f5 Signed-off-by: Ofri Masad <[email protected]> --- M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java 2 files changed, 21 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/7868/1 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 55e3995..52c3a26 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 @@ -1673,6 +1673,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Quota is not valid.") String ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID(); + @DefaultStringValue("Cannot ${action} ${type}. No quota is defined for the selected domain. Assign a quota to the domain or select a different domain.") + String ACTION_TYPE_FAILED_NO_QUOTA_SET_FOR_DOMAIN(); + @DefaultStringValue("Cannot ${action} ${type}. The quota associated with VM ${VmName} is no longer available. This may be a result of an import or snapshot restoring actions. Please reassign a quota to this VM.") String ACTION_TYPE_FAILED_QUOTA_IS_NO_LONGER_AVAILABLE_IN_SYSTEM(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java index c35df4c..aa2ffe9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java @@ -6,7 +6,7 @@ import org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; -import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; +//import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType; import org.ovirt.engine.core.common.businessentities.DiskImage; @@ -27,8 +27,8 @@ import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel; -import org.ovirt.engine.ui.uicommonweb.validation.IValidation; -import org.ovirt.engine.ui.uicommonweb.validation.SelectedQuotaValidation; +//import org.ovirt.engine.ui.uicommonweb.validation.IValidation; +//import org.ovirt.engine.ui.uicommonweb.validation.SelectedQuotaValidation; import org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult; import org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback; @@ -271,6 +271,8 @@ } else { disk.setQuotaId(((Quota) diskModel.getQuota().getSelectedItem()).getId()); } + } else { + disk.setQuotaId(Guid.Empty); } if (iSingleStorageDomain && getDisks().size() == 1) { @@ -336,18 +338,19 @@ } public boolean Validate() { - if (getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED - || getQuotaEnforcementType() == QuotaEnforcementTypeEnum.SOFT_ENFORCEMENT) { - return true; - } - - boolean isValid = true; - for (DiskModel diskModel : getDisks()) { - diskModel.getQuota().ValidateSelectedItem(new IValidation[]{new SelectedQuotaValidation()}); - isValid &= diskModel.getQuota().getIsValid(); - } - - return isValid; + return true; +// if (getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED +// || getQuotaEnforcementType() == QuotaEnforcementTypeEnum.SOFT_ENFORCEMENT) { +// return true; +// } +// +// boolean isValid = true; +// for (DiskModel diskModel : getDisks()) { +// diskModel.getQuota().ValidateSelectedItem(new IValidation[]{new SelectedQuotaValidation()}); +// isValid &= diskModel.getQuota().getIsValid(); +// } +// +// return isValid; } } -- To view, visit http://gerrit.ovirt.org/7868 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5aac7f14c656d3b344e97b50c6282b6a527891f5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
