Gilad Chaplik has uploaded a new change for review. Change subject: restapi: impossible to delete scheduling policy ......................................................................
restapi: impossible to delete scheduling policy Change-Id: I36b14ca91aaa0aa862b42fd598b9831f6a7b3893 Bug-Url: https://bugzilla.redhat.com/1114926 Signed-off-by: Gilad Chaplik <[email protected]> --- M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/SchedulingPoliciesResource.java M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSchedulingPoliciesResource.java 2 files changed, 20 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/29513/1 diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/SchedulingPoliciesResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/SchedulingPoliciesResource.java index 5888f9d..b9456da 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/SchedulingPoliciesResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/SchedulingPoliciesResource.java @@ -1,6 +1,7 @@ package org.ovirt.engine.api.resource; import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -25,6 +26,10 @@ @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML}) public Response add(SchedulingPolicy schedulingPolicy); + @DELETE + @Path("{id}") + public Response remove(@PathParam("id") String id); + @Path("{id}") public SchedulingPolicyResource getSchedulingPolicySubResource(@PathParam("id") String id); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSchedulingPoliciesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSchedulingPoliciesResource.java index ad16da1..444b36f 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSchedulingPoliciesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSchedulingPoliciesResource.java @@ -21,6 +21,10 @@ static final String[] SUB_COLLECTIONS = { "filters", "weights", "balances", "clusters" }; + private final QueryIdResolver<Guid> queryIdResolver = + new QueryIdResolver<Guid>(VdcQueryType.GetClusterPolicyById, + IdQueryParameters.class); + public BackendSchedulingPoliciesResource() { super(SchedulingPolicy.class, ClusterPolicy.class, SUB_COLLECTIONS); } @@ -36,8 +40,7 @@ public Response add(SchedulingPolicy schedulingPolicy) { validateParameters(schedulingPolicy, "name"); return performCreate(VdcActionType.AddClusterPolicy, new ClusterPolicyCRUDParameters(null, - map(schedulingPolicy)), new QueryIdResolver<Guid>(VdcQueryType.GetClusterPolicyById, - IdQueryParameters.class)); + map(schedulingPolicy)), queryIdResolver); } @Override @@ -48,7 +51,16 @@ @Override protected Response performRemove(String id) { - return performAction(VdcActionType.RemoveClusterPolicy, new ClusterPolicyCRUDParameters(asGuid(id), null)); + Response performAction = null; + try { + + performAction = + performAction(VdcActionType.RemoveClusterPolicy, new ClusterPolicyCRUDParameters(asGuid(id), + queryIdResolver.lookupEntity(asGuid(id)))); + } catch (BackendFailureException e) { + e.printStackTrace(); + } + return performAction; } @Override -- To view, visit http://gerrit.ovirt.org/29513 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I36b14ca91aaa0aa862b42fd598b9831f6a7b3893 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
