[libgovirt] Add support for oVirt API v4



commit ce32e550048d437cc69e033cb92cec7dfea62a63
Author: Eduardo Lima (Etrunko) <etrunko redhat com>
Date:   Mon Jan 20 19:16:49 2020 -0300

    Add support for oVirt API v4
    
    v3 has been deprecated for a while now, and support will be completely
    removed in RHV 4.4.
    
    Tested against main use cases with remote-viewer:
    
     - Connecting to oVirt using ovirt:// URI.
     - Connecting to oVirt with console.vv file.
     - Listing and changing CD ROMs.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1399750
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko redhat com>

 govirt/ovirt-proxy.c          | 1 -
 govirt/ovirt-resource.c       | 7 -------
 govirt/ovirt-storage-domain.c | 2 +-
 govirt/ovirt-vm.c             | 2 +-
 4 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 5a7b69c..e2d2e5c 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -860,7 +860,6 @@ static void ovirt_proxy_constructed(GObject *gobject)
     /* FIXME: to set or not to set ?? */
     ovirt_proxy_add_header(OVIRT_PROXY(gobject), "All-Content", "true");
     ovirt_proxy_add_header(OVIRT_PROXY(gobject), "Prefer", "persistent-auth");
-    ovirt_proxy_add_header(OVIRT_PROXY(gobject), "Version", "3");
 
     /* Chain up to the parent class */
     if (G_OBJECT_CLASS(ovirt_proxy_parent_class)->constructed)
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index 880d138..61374a9 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -677,7 +677,6 @@ static enum OvirtResponseStatus parse_action_status(RestXmlNode *root,
 {
     RestXmlNode *node;
     const char *status_key = g_intern_string("status");
-    const char *state_key = g_intern_string("state");
 
     g_return_val_if_fail(g_strcmp0(root->name, "action") == 0,
                          OVIRT_RESPONSE_UNKNOWN);
@@ -690,12 +689,6 @@ static enum OvirtResponseStatus parse_action_status(RestXmlNode *root,
                     _("Could not find 'status' node"));
         g_return_val_if_reached(OVIRT_RESPONSE_UNKNOWN);
     }
-    node = g_hash_table_lookup(node->children, state_key);
-    if (node == NULL) {
-        g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
-                    _("Could not find 'state' node"));
-        g_return_val_if_reached(OVIRT_RESPONSE_UNKNOWN);
-    }
     g_debug("State: %s\n", node->content);
     if (g_strcmp0(node->content, "complete") == 0) {
         return OVIRT_RESPONSE_COMPLETE;
diff --git a/govirt/ovirt-storage-domain.c b/govirt/ovirt-storage-domain.c
index 1d636e6..f482f66 100644
--- a/govirt/ovirt-storage-domain.c
+++ b/govirt/ovirt-storage-domain.c
@@ -168,7 +168,7 @@ static gboolean ovirt_storage_domain_init_from_xml(OvirtResource *resource,
           .xml_path = "storage_format",
         },
         { .prop_name = "state",
-          .xml_path = "status/state",
+          .xml_path = "status",
         },
         { .prop_name = "data-center-ids",
           .xml_path = "data_centers",
diff --git a/govirt/ovirt-vm.c b/govirt/ovirt-vm.c
index 697cac8..82ea455 100644
--- a/govirt/ovirt-vm.c
+++ b/govirt/ovirt-vm.c
@@ -198,7 +198,7 @@ static gboolean ovirt_vm_init_from_xml(OvirtResource *resource,
           .xml_attr = "id",
         },
         { .prop_name = "state",
-          .xml_path = "status/state",
+          .xml_path = "status",
         },
         { NULL, },
     };


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