[libgovirt] Add OvirtResource::add_rest_params
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Add OvirtResource::add_rest_params
- Date: Thu, 26 Jun 2014 23:22:25 +0000 (UTC)
commit b0e2691136d357dfa45aa359f35dc90edca985c7
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu May 22 17:28:15 2014 +0200
Add OvirtResource::add_rest_params
This virtual method (wrapped by ovirt_resource_add_rest_params) is used
by OvirtResourceRestCall to let classes deriving from OvirtResource add
some class-specific arguments to the OvirtResourceRestCall that is going
to be run.
This will be used by OvirtCdrom to append a ";current" to the request it
makes in order to only manage the current cdrom image, not the one which
was set at boot time.
govirt/ovirt-resource-private.h | 4 +++-
govirt/ovirt-resource-rest-call.c | 1 +
govirt/ovirt-resource.c | 15 +++++++++++++++
govirt/ovirt-resource.h | 10 ++++++++--
4 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/govirt/ovirt-resource-private.h b/govirt/ovirt-resource-private.h
index 33e3543..ff4e705 100644
--- a/govirt/ovirt-resource-private.h
+++ b/govirt/ovirt-resource-private.h
@@ -23,7 +23,7 @@
#define __OVIRT_RESOURCE_PRIVATE_H__
#include <ovirt-resource.h>
-#include <ovirt-rest-call.h>
+#include <ovirt-resource-rest-call.h>
G_BEGIN_DECLS
@@ -48,6 +48,8 @@ void ovirt_resource_invoke_action_async(OvirtResource *resource,
gboolean ovirt_resource_action_finish(OvirtResource *resource,
GAsyncResult *result,
GError **err);
+void ovirt_resource_add_rest_params(OvirtResource *resource,
+ RestProxyCall *call);
G_END_DECLS
diff --git a/govirt/ovirt-resource-rest-call.c b/govirt/ovirt-resource-rest-call.c
index 5f82c47..6d3c0fd 100644
--- a/govirt/ovirt-resource-rest-call.c
+++ b/govirt/ovirt-resource-rest-call.c
@@ -138,6 +138,7 @@ static gboolean ovirt_resource_rest_call_class_serialize_params(RestProxyCall *c
*content_len = 0;
}
+ ovirt_resource_add_rest_params(self->priv->resource, self);
params = rest_proxy_call_get_params(call);
if (!rest_params_are_strings(params)) {
g_set_error(error, OVIRT_REST_CALL_ERROR, 0,
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index 3d223f4..0d4d897 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -27,10 +27,12 @@
#include <rest/rest-xml-node.h>
#include <rest/rest-xml-parser.h>
+#define GOVIRT_UNSTABLE_API_ABI
#include "govirt-private.h"
#include "ovirt-error.h"
#include "ovirt-proxy-private.h"
#include "ovirt-resource.h"
+#undef GOVIRT_UNSTABLE_API_ABI
#define OVIRT_RESOURCE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), OVIRT_TYPE_RESOURCE, OvirtResourcePrivate))
@@ -926,3 +928,16 @@ gboolean ovirt_resource_refresh(OvirtResource *resource,
return success;
}
+
+void ovirt_resource_add_rest_params(OvirtResource *resource,
+ RestProxyCall *call)
+{
+ OvirtResourceClass *klass;
+
+ g_return_val_if_fail(OVIRT_IS_RESOURCE(resource), NULL);
+ g_return_if_fail(OVIRT_IS_RESOURCE_REST_CALL(call));
+
+ klass = OVIRT_RESOURCE_GET_CLASS(resource);
+ if (klass->to_xml != NULL)
+ klass->add_rest_params(resource, call);
+}
diff --git a/govirt/ovirt-resource.h b/govirt/ovirt-resource.h
index 23e019c..916af8b 100644
--- a/govirt/ovirt-resource.h
+++ b/govirt/ovirt-resource.h
@@ -25,6 +25,7 @@
#include <gio/gio.h>
#include <glib-object.h>
#include <govirt/ovirt-types.h>
+#include <rest/rest-proxy-call.h>
#include <rest/rest-xml-node.h>
G_BEGIN_DECLS
@@ -57,8 +58,13 @@ struct _OvirtResourceClass
RestXmlNode *node,
GError **error);
char *(*to_xml)(OvirtResource *resource);
-
- gpointer padding[19];
+#ifdef GOVIRT_UNSTABLE_API_ABI
+ void (*add_rest_params)(OvirtResource *resource,
+ RestProxyCall *call);
+#else
+ gpointer padding0;
+#endif
+ gpointer padding[18];
};
GType ovirt_resource_get_type(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]