[libgovirt] Resource: Make possible to add params to action



commit a5793c31a5e82b9bfbf0667d56e78dc1192cfd35
Author: Eduardo Lima (Etrunko) <etrunko redhat com>
Date:   Fri Aug 30 12:52:04 2019 -0300

    Resource: Make possible to add params to action
    
    Some actions on resources require parameters to be set, otherwise
    invoking that action will result in errors. For instance, the isattached
    action for a StorageDomain requires a Host as input:
    
    
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.0/html-single/rest_api_guide/index#services-storage_domain-methods-is_attached
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko redhat com>

 govirt/ovirt-resource.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index 0442724..880d138 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -626,6 +626,7 @@ ovirt_resource_create_rest_call_for_action(OvirtResource *resource,
     rest_proxy_call_set_method(call, "POST");
     rest_proxy_call_set_function(call, function);
     rest_proxy_call_add_param(call, "async", "false");
+    ovirt_resource_add_rest_params(resource, call);
 
     return call;
 }
@@ -948,10 +949,10 @@ void ovirt_resource_add_rest_params(OvirtResource *resource,
     OvirtResourceClass *klass;
 
     g_return_if_fail(OVIRT_IS_RESOURCE(resource));
-    g_return_if_fail(OVIRT_IS_RESOURCE_REST_CALL(call));
+    g_return_if_fail(OVIRT_IS_REST_CALL(call));
 
     klass = OVIRT_RESOURCE_GET_CLASS(resource);
-    if (klass->to_xml != NULL)
+    if (klass->add_rest_params != NULL)
         klass->add_rest_params(resource, call);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]