Maor Lipchuk has uploaded a new change for review. Change subject: core: VM configuration should not be validated in Export Domain ......................................................................
core: VM configuration should not be validated in Export Domain Validating a VM if its disks exists in the Export Domain should be only for a VM in Export Domain since a VM from configuration is already being validated for disks existence in ImportVmFromConfiguration. Change-Id: Iffde1e02cfa9c1c104f1f7057fb4218c44da599b Bug-Url: https://bugzilla.redhat.com/1231849 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmFromConfigurationCommand.java 2 files changed, 18 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/42395/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java index 29195437..f354c0f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java @@ -232,13 +232,8 @@ if (validator.isDomainExistAndActive().isValid() && getSourceDomain().getStorageDomainType() != StorageDomainType.ImportExport) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } - VM vm = getVmFromExportDomain(getParameters().getVmId()); - if (vm == null) { + if (!validateAndSetVmFromExportDomain()) return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND_ON_EXPORT_DOMAIN); - } - // At this point we should work with the VM that was read from - // the OVF because the VM from the parameters may lack images - setVmFromExportDomain(vm); } if (!validateImages(domainsMap)) { @@ -248,6 +243,17 @@ return true; } + protected boolean validateAndSetVmFromExportDomain() { + VM vm = getVmFromExportDomain(getParameters().getVmId()); + if (vm == null) { + return false; + } + // At this point we should work with the VM that was read from + // the OVF because the VM from the parameters may lack images + setVmFromExportDomain(vm); + return true; + } + protected boolean validateImages(Map<Guid, StorageDomain> domainsMap) { List<String> canDoActionMessages = getReturnValue().getCanDoActionMessages(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmFromConfigurationCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmFromConfigurationCommand.java index 764db0b..70cba34 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmFromConfigurationCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmFromConfigurationCommand.java @@ -168,6 +168,12 @@ } @Override + protected boolean validateAndSetVmFromExportDomain() { + // We have the VM configuration so there is no need to get it from the export domain. + return true; + } + + @Override protected Guid getSourceDomainId(DiskImage image) { return image.getStorageIds().get(0); } -- To view, visit https://gerrit.ovirt.org/42395 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iffde1e02cfa9c1c104f1f7057fb4218c44da599b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches