Blame SOURCES/0002-ovirt-storage-domain-Introduce-ovirt_storage_domain_.patch

71924b
From 8ab1be89c70d0f6454e74442d382b9ea55f1df58 Mon Sep 17 00:00:00 2001
71924b
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
71924b
Date: Tue, 16 Jun 2020 10:07:49 -0300
71924b
Subject: [PATCH] ovirt-storage-domain: Introduce
71924b
 ovirt_storage_domain_get_disks()
71924b
71924b
This function is used to return the list of disks in a given storage
71924b
domain with DATA type.
71924b
71924b
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
71924b
---
71924b
 govirt/govirt.sym             |  2 ++
71924b
 govirt/ovirt-storage-domain.c | 28 ++++++++++++++++++++++++++++
71924b
 govirt/ovirt-storage-domain.h |  1 +
71924b
 3 files changed, 31 insertions(+)
71924b
71924b
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
71924b
index 1cc2a8e..4cd6bb8 100644
71924b
--- a/govirt/govirt.sym
71924b
+++ b/govirt/govirt.sym
71924b
@@ -146,5 +146,7 @@ GOVIRT_0.4.1 {
71924b
         ovirt_disk_get_type;
71924b
         ovirt_disk_content_type_get_type;
71924b
         ovirt_disk_new;
71924b
+
71924b
+        ovirt_storage_domain_get_disks;
71924b
 } GOVIRT_0.4.0;
71924b
 # .... define new API here using predicted next version number ....
71924b
diff --git a/govirt/ovirt-storage-domain.c b/govirt/ovirt-storage-domain.c
71924b
index a713d89..d02c3d5 100644
71924b
--- a/govirt/ovirt-storage-domain.c
71924b
+++ b/govirt/ovirt-storage-domain.c
71924b
@@ -27,6 +27,7 @@
71924b
 
71924b
 struct _OvirtStorageDomainPrivate {
71924b
     OvirtCollection *files;
71924b
+    OvirtCollection *disks;
71924b
     GStrv data_center_ids;
71924b
 
71924b
     gchar *data_center_href;
71924b
@@ -172,6 +173,7 @@ ovirt_storage_domain_dispose(GObject *obj)
71924b
     OvirtStorageDomain *domain = OVIRT_STORAGE_DOMAIN(obj);
71924b
 
71924b
     g_clear_object(&domain->priv->files);
71924b
+    g_clear_object(&domain->priv->disks);
71924b
     g_clear_pointer(&domain->priv->data_center_ids, g_strfreev);
71924b
     g_clear_pointer(&domain->priv->data_center_href, g_free);
71924b
     g_clear_pointer(&domain->priv->data_center_id, g_free);
71924b
@@ -399,3 +401,29 @@ OvirtCollection *ovirt_storage_domain_get_files(OvirtStorageDomain *domain)
71924b
 
71924b
     return domain->priv->files;
71924b
 }
71924b
+
71924b
+/**
71924b
+ * ovirt_storage_domain_get_disks:
71924b
+ * @domain: a #OvirtStorageDomain
71924b
+ *
71924b
+ * Gets a #OvirtCollection representing the list of remote disks from a
71924b
+ * storage domain object.  This method does not initiate any network
71924b
+ * activity, the remote file list must be then be fetched using
71924b
+ * ovirt_collection_fetch() or ovirt_collection_fetch_async().
71924b
+ *
71924b
+ * Return value: (transfer none): a #OvirtCollection representing the list
71924b
+ * of disks associated with @domain.
71924b
+ */
71924b
+OvirtCollection *ovirt_storage_domain_get_disks(OvirtStorageDomain *domain)
71924b
+{
71924b
+    g_return_val_if_fail(OVIRT_IS_STORAGE_DOMAIN(domain), NULL);
71924b
+
71924b
+    if (domain->priv->disks == NULL)
71924b
+        domain->priv->disks = ovirt_sub_collection_new_from_resource(OVIRT_RESOURCE(domain),
71924b
+                                                                     "disks",
71924b
+                                                                     "disks",
71924b
+                                                                     OVIRT_TYPE_DISK,
71924b
+                                                                     "disk");
71924b
+
71924b
+    return domain->priv->disks;
71924b
+}
71924b
diff --git a/govirt/ovirt-storage-domain.h b/govirt/ovirt-storage-domain.h
71924b
index f122e27..97cfb06 100644
71924b
--- a/govirt/ovirt-storage-domain.h
71924b
+++ b/govirt/ovirt-storage-domain.h
71924b
@@ -86,6 +86,7 @@ GType ovirt_storage_domain_get_type(void);
71924b
 OvirtStorageDomain *ovirt_storage_domain_new(void);
71924b
 
71924b
 OvirtCollection *ovirt_storage_domain_get_files(OvirtStorageDomain *domain);
71924b
+OvirtCollection *ovirt_storage_domain_get_disks(OvirtStorageDomain *domain);
71924b
 
71924b
 G_END_DECLS
71924b
 
71924b
-- 
71924b
2.26.2
71924b