Juan Hernandez has uploaded a new change for review.

Change subject: restapi: Add action to refresh host capabilities
......................................................................

restapi: Add action to refresh host capabilities

Currently the only way to refresh the host capabilities is to add the
"force" matrix parameter to the GET request of the host. This is mixing
resource retrevial and actions, which isn't good, and isn't supported by
the Python SDK. This patch adds a new "refreshcapabilities" action. The
existing "force" parameter is preserved for backwards compatibility, but
will be likely removed in the future.

Change-Id: I4ce36ac7f615b3c1b8a5b460ee1c1a482d6240fa
Bug-Url: https://bugzilla.redhat.com/1197788
Signed-off-by: Juan Hernandez <[email protected]>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
3 files changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/38287/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostResource.java
index 202da35..31e090e 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostResource.java
@@ -80,6 +80,11 @@
 
     @POST
     @Actionable
+    @Path("refreshcapabilities")
+    public Response refreshCapabilities(Action action);
+
+    @POST
+    @Actionable
     @Path("forceselectspm")
     public Response forceSelectSPM(Action action);
 
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index 36236a3..420db0a 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -2819,7 +2819,12 @@
       parameterType: null
       signatures: []
     urlparams:
-      force: {context: matrix, type: 'xs:boolean', value: true|false, 
required: false}
+      force: # This is deprecated, use the "refreshcapabilities" action instead
+        context: matrix
+        type: 'xs:boolean'
+        value: true|false
+        required: false
+        deprecated: true
     headers:
       Filter: {value: true|false, required: false}
       All-Content: {value: true|false, required: false}
@@ -3059,6 +3064,19 @@
     headers:
       Content-Type: {value: application/xml|json, required: true}
       Correlation-Id: {value: 'any string', required: false}
+- name: /hosts/{host:id}/refreshcapabilities|rel=refreshcapabilities
+  description: refresh the capabilities of the host
+  request:
+    body:
+      parameterType: Action
+      signatures:
+      - mandatoryArguments: {}
+        optionalArguments: {action.async: 'xs:boolean', 
action.grace_period.expiry: 'xs:long'}
+        description: refresh the capabilities of the host
+    urlparams: {}
+    headers:
+      Content-Type: {value: application/xml|json, required: true}
+      Correlation-Id: {value: 'any string', required: false}
 - name: /hosts/{host:id}/katelloerrata|rel=get
   description: get the list of errata available for the host
   request:
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
index 2a2b7b8..ee40496 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
@@ -85,6 +85,8 @@
 
     @Override
     public Host get() {
+        // This logic shouldn't be part of the "get" method as it is an 
action. It will be replaced by
+        // the "refreshcapabilities" action and removed in the future.
         if (isForce()) {
             performAction(VdcActionType.RefreshHostCapabilities,
                     new VdsActionParameters(guid));
@@ -436,6 +438,11 @@
     }
 
     @Override
+    public Response refreshCapabilities(Action action) {
+        return doAction(VdcActionType.RefreshHostCapabilities, new 
VdsActionParameters(guid), action);
+    }
+
+    @Override
     public HostNumaNodesResource getHostNumaNodesResource() {
         return inject(new BackendHostNumaNodesResource(id));
     }


-- 
To view, visit https://gerrit.ovirt.org/38287
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ce36ac7f615b3c1b8a5b460ee1c1a482d6240fa
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to