[libgovirt] Add ovirt_cdrom_update()



commit 7e46554581282fa9a7d9dbb4b5b8ceb1eda263f5
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Aug 30 18:13:49 2013 +0200

    Add ovirt_cdrom_update()
    
    This needs to be different from ovirt_resource_update as there are
    2 different modes, one for updates while the VM is running, one
    for updates when it's not running.

 govirt/govirt.sym    |    1 +
 govirt/ovirt-cdrom.c |   26 ++++++++++++++++++++++++++
 govirt/ovirt-cdrom.h |    3 +++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
index 9b1867e..536494e 100644
--- a/govirt/govirt.sym
+++ b/govirt/govirt.sym
@@ -56,6 +56,7 @@ GOVIRT_0.2.1 {
         ovirt_api_get_storage_domains;
 
         ovirt_cdrom_get_type;
+        ovirt_cdrom_update;
 
         ovirt_collection_fetch;
         ovirt_collection_fetch_async;
diff --git a/govirt/ovirt-cdrom.c b/govirt/ovirt-cdrom.c
index 3239966..91de068 100644
--- a/govirt/ovirt-cdrom.c
+++ b/govirt/ovirt-cdrom.c
@@ -22,6 +22,9 @@
 
 #include <config.h>
 #include "ovirt-cdrom.h"
+#include "ovirt-proxy.h"
+#include "ovirt-resource-private.h"
+#include "ovirt-resource-rest-call.h"
 
 #define OVIRT_CDROM_GET_PRIVATE(obj)                         \
         (G_TYPE_INSTANCE_GET_PRIVATE((obj), OVIRT_TYPE_CDROM, OvirtCdromPrivate))
@@ -177,3 +180,26 @@ static void ovirt_cdrom_init(OvirtCdrom *cdrom)
 {
     cdrom->priv = OVIRT_CDROM_GET_PRIVATE(cdrom);
 }
+
+
+gboolean ovirt_cdrom_update(OvirtCdrom *cdrom,
+                            gboolean current,
+                            OvirtProxy *proxy,
+                            GError **error)
+{
+    OvirtRestCall *call;
+    gboolean success;
+
+    call = OVIRT_REST_CALL(ovirt_resource_rest_call_new(REST_PROXY(proxy),
+                                                        OVIRT_RESOURCE(cdrom)));
+    rest_proxy_call_set_method(REST_PROXY_CALL(call), "PUT");
+
+    if (current) {
+        rest_proxy_call_add_param(REST_PROXY_CALL(call), "current", NULL);
+    }
+    success = ovirt_resource_rest_call_sync(call, error);
+
+    g_object_unref(G_OBJECT(call));
+
+    return success;
+}
diff --git a/govirt/ovirt-cdrom.h b/govirt/ovirt-cdrom.h
index 604426e..606744f 100644
--- a/govirt/ovirt-cdrom.h
+++ b/govirt/ovirt-cdrom.h
@@ -58,6 +58,9 @@ struct _OvirtCdromClass
 
 GType ovirt_cdrom_get_type(void);
 
+gboolean ovirt_cdrom_update(OvirtCdrom *cdrom, gboolean current,
+                            OvirtProxy *proxy, GError **error);
+
 G_END_DECLS
 
 #endif /* __OVIRT_CDROM_H__ */


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