Gilad Chaplik has uploaded a new change for review. Change subject: engine: fix import flow for cpu profile ......................................................................
engine: fix import flow for cpu profile Handles import more than once as well. Change-Id: Ice68c57b56208413df6a021650e3b996de14cef5 Bug-Url: https://bugzilla.redhat.com/1118349 Signed-off-by: Gilad Chaplik <[email protected]> --- 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/ImportVmTemplateCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MoveOrCopyParameters.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java 5 files changed, 23 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/33456/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 b4e5752..a186245 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 @@ -1323,6 +1323,7 @@ protected boolean setAndValidateCpuProfile() { getVm().getStaticData().setVdsGroupId(getVdsGroupId()); + getVm().getStaticData().setCpuProfileId(getParameters().getCpuProfileId()); return validate(CpuProfileHelper.setAndValidateCpuProfile(getVm().getStaticData(), getVdsGroup().getcompatibility_version())); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java index f299fb7..e7e0a23 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java @@ -566,6 +566,7 @@ protected boolean setAndValidateCpuProfile() { getVmTemplate().setVdsGroupId(getVdsGroupId()); + getVmTemplate().setCpuProfileId(getParameters().getCpuProfileId()); return validate(CpuProfileHelper.setAndValidateCpuProfile(getVmTemplate(), getVdsGroup().getcompatibility_version())); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MoveOrCopyParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MoveOrCopyParameters.java index 5d26dac..a6c3697 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MoveOrCopyParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MoveOrCopyParameters.java @@ -11,6 +11,7 @@ private Map<Guid, Guid> imageToDestinationDomainMap; private boolean importAsNewEntity; private boolean imagesExistOnTargetStorageDomain; + private Guid cpuProfileId; public MoveOrCopyParameters(Guid containerId, Guid storageDomainId) { super(storageDomainId); @@ -86,4 +87,12 @@ public void setImagesExistOnTargetStorageDomain(boolean imagesExistOnTargetStorageDomain) { this.imagesExistOnTargetStorageDomain = imagesExistOnTargetStorageDomain; } + + public Guid getCpuProfileId() { + return cpuProfileId; + } + + public void setCpuProfileId(Guid cpuProfileId) { + this.cpuProfileId = cpuProfileId; + } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java index 87b085c..180ba3e 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java @@ -19,6 +19,7 @@ import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VmTemplate; +import org.ovirt.engine.core.common.businessentities.profiles.CpuProfile; import org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; @@ -204,6 +205,11 @@ importVmTemplateParameters.setQuotaId(((Quota) importModel.getClusterQuota().getSelectedItem()).getId()); } + CpuProfile cpuProfile = importModel.getCpuProfiles().getSelectedItem(); + if (cpuProfile != null) { + importVmTemplateParameters.setCpuProfileId(cpuProfile.getId()); + } + Map<Guid, Guid> map = new HashMap<Guid, Guid>(); for (DiskImage disk : template.getDiskList()) { map.put(disk.getId(), importModel.getDiskImportData(disk.getId()).getSelectedStorageDomain().getId()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java index 3efbfd3..f741226 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java @@ -24,6 +24,7 @@ import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VM; +import org.ovirt.engine.core.common.businessentities.profiles.CpuProfile; import org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; @@ -439,6 +440,11 @@ prm.setQuotaId(((Quota) importModel.getClusterQuota().getSelectedItem()).getId()); } + CpuProfile cpuProfile = importModel.getCpuProfiles().getSelectedItem(); + if (cpuProfile != null) { + prm.setCpuProfileId(cpuProfile.getId()); + } + prm.setForceOverride(true); prm.setCopyCollapse((Boolean) ((ImportVmData) item).getCollapseSnapshots().getEntity()); -- To view, visit http://gerrit.ovirt.org/33456 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice68c57b56208413df6a021650e3b996de14cef5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
