Gilad Chaplik has uploaded a new change for review. Change subject: restapi: wrong cpu_profile on change template cluster ......................................................................
restapi: wrong cpu_profile on change template cluster When creating VM from template and selecting a cluster that the template doens't reside on, causes wrong cpu_profile error. Fix resets cpu profile when vm's cluster and template's cluster are not equal. Change-Id: Ib2cdac29a9cfbe1d6b5fb5ccdb1be68c0f98c038 Bug-Url: https://bugzilla.redhat.com/1172207 Signed-off-by: Gilad Chaplik <gchap...@redhat.com> --- M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/36696/1 diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java index d0c9be2..64b1c67 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java @@ -117,6 +117,12 @@ VmTemplate templateEntity = lookupTemplate(templateId); VmStatic builtFromTemplate = getMapper(VmTemplate.class, VmStatic.class).map(templateEntity, null); + // if VM is based on a template, and going to be on another cluster then template, clear the cpu_profile + // since the template cpu_profile doesn't match cluster. + if (!vm.isSetCpuProfile() && vm.isSetCluster() + && !ObjectUtils.equals(templateEntity.getVdsGroupId(), vm.getCluster().getId())) { + builtFromTemplate.setCpuProfileId(null); + } VmStatic builtFromInstanceType = null; org.ovirt.engine.core.common.businessentities.InstanceType instanceTypeEntity = null; -- To view, visit http://gerrit.ovirt.org/36696 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib2cdac29a9cfbe1d6b5fb5ccdb1be68c0f98c038 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches