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, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/36054/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 db0bd21..66f95c8 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 @@ -10,6 +10,7 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; +import org.apache.commons.lang.ObjectUtils; import org.ovirt.engine.api.common.util.DetailHelper; import org.ovirt.engine.api.model.Action; import org.ovirt.engine.api.model.Certificate; @@ -114,6 +115,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/36054 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib2cdac29a9cfbe1d6b5fb5ccdb1be68c0f98c038 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches