Change in ovirt-engine[master]: core: Extract SD validations from ImagesHandler

amureini at redhat.com amureini at redhat.com
Fri Apr 19 17:46:59 UTC 2013


Allon Mureinik has submitted this change and it was merged.

Change subject: core: Extract SD validations from ImagesHandler
......................................................................


core: Extract SD validations from ImagesHandler

Extracted the logic to perform validations on Storage Domains from
ImagesHandler.PerformImagesChecks, and made the relevant commands use it
directly.

In order to do this, a new type of validator was introduced,
MultipleStorageDomainsValidator, which aggregates validations from
individual StorageDomainValidators in a fast-fail pattern. This is done
for performance reasons, so there is no need to load all the storage
domains from the database preemptively.

This refactoring removes three parameters from PerformImagesChecks:
* checkStorageDomain and diskSpaceCheck - are now done directly by
  MultipleStorageDomainsValidator.
* storageDomainId - is used by the previous two checks, and by the image
  existence check. However, it is always equal to the storage domain id
  member of the DiskImage, so it is redundant as an additional
  parameter.

The changes in the commands are as follows:
* The parameters detailed above were removed from the
  ImagesHandler.PerformImagesCheck calls.
* Wherever appropriate, a direct call to StorageDomainValidator or
  MultipleStorageDomainsValidator was added.

Change-Id: I4cfc895dceed4de520476ed5e3fa9c1c7cfd78f4
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveVmCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.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/VmPoolCommandBase.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java
A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/MultipleStorageDomainsValidator.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RestoreAllSnapshotCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java
A backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/MultipleStorageDomainsValidatorTest.java
19 files changed, 356 insertions(+), 123 deletions(-)

Approvals:
  Allon Mureinik: Verified; Looks good to me, approved


--
To view, visit http://gerrit.ovirt.org/12249
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4cfc895dceed4de520476ed5e3fa9c1c7cfd78f4
Gerrit-PatchSet: 11
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Alissa Bonas <abonas at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Liron Ar <laravot at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Michael Kublin <mkublin at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Vered Volansky <vvolansk at redhat.com>



More information about the Engine-commits mailing list