import libgovirt-0.3.7-3.el8
This commit is contained in:
parent
652cb80297
commit
70870fd302
406
SOURCES/0001-Initial-support-for-Disks.patch
Normal file
406
SOURCES/0001-Initial-support-for-Disks.patch
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
From 91089ba30f2345ee14be676ca8b7465d6f29871a Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
||||||
|
Date: Tue, 16 Jun 2020 13:37:36 -0300
|
||||||
|
Subject: [PATCH] Initial support for Disks
|
||||||
|
|
||||||
|
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
---
|
||||||
|
govirt/Makefile.am | 3 +
|
||||||
|
govirt/govirt-private.h | 1 +
|
||||||
|
govirt/govirt.h | 1 +
|
||||||
|
govirt/govirt.sym | 6 ++
|
||||||
|
govirt/meson.build | 3 +
|
||||||
|
govirt/ovirt-disk-private.h | 37 +++++++++
|
||||||
|
govirt/ovirt-disk.c | 144 ++++++++++++++++++++++++++++++++++++
|
||||||
|
govirt/ovirt-disk.h | 76 +++++++++++++++++++
|
||||||
|
govirt/ovirt-types.h | 1 +
|
||||||
|
9 files changed, 272 insertions(+)
|
||||||
|
create mode 100644 govirt/ovirt-disk-private.h
|
||||||
|
create mode 100644 govirt/ovirt-disk.c
|
||||||
|
create mode 100644 govirt/ovirt-disk.h
|
||||||
|
|
||||||
|
diff --git a/govirt/Makefile.am b/govirt/Makefile.am
|
||||||
|
index 0ce276d..f7ab835 100644
|
||||||
|
--- a/govirt/Makefile.am
|
||||||
|
+++ b/govirt/Makefile.am
|
||||||
|
@@ -21,6 +21,7 @@ libgovirt_la_HEADERS = \
|
||||||
|
ovirt-cluster.h \
|
||||||
|
ovirt-collection.h \
|
||||||
|
ovirt-data-center.h \
|
||||||
|
+ ovirt-disk.h \
|
||||||
|
ovirt-error.h \
|
||||||
|
ovirt-host.h \
|
||||||
|
ovirt-options.h \
|
||||||
|
@@ -41,6 +42,7 @@ noinst_HEADERS = \
|
||||||
|
ovirt-cluster-private.h \
|
||||||
|
ovirt-collection-private.h \
|
||||||
|
ovirt-data-center-private.h \
|
||||||
|
+ ovirt-disk-private.h \
|
||||||
|
ovirt-host-private.h \
|
||||||
|
ovirt-proxy-private.h \
|
||||||
|
ovirt-resource-private.h \
|
||||||
|
@@ -58,6 +60,7 @@ libgovirt_la_SOURCES = \
|
||||||
|
ovirt-cluster.c \
|
||||||
|
ovirt-collection.c \
|
||||||
|
ovirt-data-center.c \
|
||||||
|
+ ovirt-disk.c \
|
||||||
|
ovirt-error.c \
|
||||||
|
ovirt-host.c \
|
||||||
|
ovirt-options.c \
|
||||||
|
diff --git a/govirt/govirt-private.h b/govirt/govirt-private.h
|
||||||
|
index 2c0e30f..f5cf721 100644
|
||||||
|
--- a/govirt/govirt-private.h
|
||||||
|
+++ b/govirt/govirt-private.h
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include <govirt/ovirt-cluster-private.h>
|
||||||
|
#include <govirt/ovirt-collection-private.h>
|
||||||
|
#include <govirt/ovirt-data-center-private.h>
|
||||||
|
+#include <govirt/ovirt-disk-private.h>
|
||||||
|
#include <govirt/ovirt-enum-types-private.h>
|
||||||
|
#include <govirt/ovirt-host-private.h>
|
||||||
|
#include <govirt/ovirt-proxy-private.h>
|
||||||
|
diff --git a/govirt/govirt.h b/govirt/govirt.h
|
||||||
|
index 9c92318..8eab984 100644
|
||||||
|
--- a/govirt/govirt.h
|
||||||
|
+++ b/govirt/govirt.h
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#include <govirt/ovirt-cluster.h>
|
||||||
|
#include <govirt/ovirt-collection.h>
|
||||||
|
#include <govirt/ovirt-data-center.h>
|
||||||
|
+#include <govirt/ovirt-disk.h>
|
||||||
|
#include <govirt/ovirt-error.h>
|
||||||
|
#include <govirt/ovirt-host.h>
|
||||||
|
#include <govirt/ovirt-options.h>
|
||||||
|
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
|
||||||
|
index 0d488e6..1cc2a8e 100644
|
||||||
|
--- a/govirt/govirt.sym
|
||||||
|
+++ b/govirt/govirt.sym
|
||||||
|
@@ -141,4 +141,10 @@ GOVIRT_0.4.0 {
|
||||||
|
ovirt_vm_get_host;
|
||||||
|
ovirt_vm_get_cluster;
|
||||||
|
} GOVIRT_0.3.4;
|
||||||
|
+
|
||||||
|
+GOVIRT_0.4.1 {
|
||||||
|
+ ovirt_disk_get_type;
|
||||||
|
+ ovirt_disk_content_type_get_type;
|
||||||
|
+ ovirt_disk_new;
|
||||||
|
+} GOVIRT_0.4.0;
|
||||||
|
# .... define new API here using predicted next version number ....
|
||||||
|
diff --git a/govirt/meson.build b/govirt/meson.build
|
||||||
|
index bec7781..778e5c0 100644
|
||||||
|
--- a/govirt/meson.build
|
||||||
|
+++ b/govirt/meson.build
|
||||||
|
@@ -7,6 +7,7 @@ govirt_headers = [
|
||||||
|
'ovirt-cluster.h',
|
||||||
|
'ovirt-collection.h',
|
||||||
|
'ovirt-data-center.h',
|
||||||
|
+ 'ovirt-disk.h',
|
||||||
|
'ovirt-error.h',
|
||||||
|
'ovirt-host.h',
|
||||||
|
'ovirt-options.h',
|
||||||
|
@@ -34,6 +35,7 @@ govirt_private_headers = [
|
||||||
|
'ovirt-cluster-private.h',
|
||||||
|
'ovirt-collection-private.h',
|
||||||
|
'ovirt-data-center-private.h',
|
||||||
|
+ 'ovirt-disk-private.h',
|
||||||
|
'ovirt-host-private.h',
|
||||||
|
'ovirt-proxy-private.h',
|
||||||
|
'ovirt-resource-private.h',
|
||||||
|
@@ -58,6 +60,7 @@ govirt_sources = [
|
||||||
|
'ovirt-cluster.c',
|
||||||
|
'ovirt-collection.c',
|
||||||
|
'ovirt-data-center.c',
|
||||||
|
+ 'ovirt-disk.c',
|
||||||
|
'ovirt-error.c',
|
||||||
|
'ovirt-host.c',
|
||||||
|
'ovirt-options.c',
|
||||||
|
diff --git a/govirt/ovirt-disk-private.h b/govirt/ovirt-disk-private.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d9fff3f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/govirt/ovirt-disk-private.h
|
||||||
|
@@ -0,0 +1,37 @@
|
||||||
|
+/*
|
||||||
|
+ * ovirt-disk-private.h: oVirt disk resource
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2020 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library. If not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ *
|
||||||
|
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
+ */
|
||||||
|
+#ifndef __OVIRT_DISK_PRIVATE_H__
|
||||||
|
+#define __OVIRT_DISK_PRIVATE_H__
|
||||||
|
+
|
||||||
|
+#include <govirt/ovirt-disk.h>
|
||||||
|
+#include <rest/rest-xml-node.h>
|
||||||
|
+
|
||||||
|
+G_BEGIN_DECLS
|
||||||
|
+
|
||||||
|
+OvirtDisk *ovirt_disk_new_from_id(const char *id,
|
||||||
|
+ const char *href);
|
||||||
|
+OvirtDisk *ovirt_disk_new_from_xml(RestXmlNode *node,
|
||||||
|
+ GError **error);
|
||||||
|
+
|
||||||
|
+G_END_DECLS
|
||||||
|
+
|
||||||
|
+#endif /* __OVIRT_DISK_PRIVATE_H__ */
|
||||||
|
diff --git a/govirt/ovirt-disk.c b/govirt/ovirt-disk.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..9242c4c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/govirt/ovirt-disk.c
|
||||||
|
@@ -0,0 +1,144 @@
|
||||||
|
+/*
|
||||||
|
+ * ovirt-disk.c: oVirt disk handling
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2020 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library. If not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ *
|
||||||
|
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <config.h>
|
||||||
|
+#include "ovirt-enum-types.h"
|
||||||
|
+#include "ovirt-disk.h"
|
||||||
|
+#include "govirt-private.h"
|
||||||
|
+
|
||||||
|
+struct _OvirtDiskPrivate {
|
||||||
|
+ OvirtDiskContentType content_type;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+G_DEFINE_TYPE_WITH_PRIVATE(OvirtDisk, ovirt_disk, OVIRT_TYPE_RESOURCE);
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
+ PROP_0,
|
||||||
|
+ PROP_CONTENT_TYPE,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void ovirt_disk_get_property(GObject *object,
|
||||||
|
+ guint prop_id,
|
||||||
|
+ GValue *value,
|
||||||
|
+ GParamSpec *pspec)
|
||||||
|
+{
|
||||||
|
+ OvirtDisk *disk = OVIRT_DISK(object);
|
||||||
|
+
|
||||||
|
+ switch (prop_id) {
|
||||||
|
+ case PROP_CONTENT_TYPE:
|
||||||
|
+ g_value_set_enum(value, disk->priv->content_type);
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void ovirt_disk_set_property(GObject *object,
|
||||||
|
+ guint prop_id,
|
||||||
|
+ const GValue *value,
|
||||||
|
+ GParamSpec *pspec)
|
||||||
|
+{
|
||||||
|
+ OvirtDisk *disk = OVIRT_DISK(object);
|
||||||
|
+
|
||||||
|
+ switch (prop_id) {
|
||||||
|
+ case PROP_CONTENT_TYPE:
|
||||||
|
+ disk->priv->content_type = g_value_get_enum(value);
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean ovirt_disk_init_from_xml(OvirtResource *resource,
|
||||||
|
+ RestXmlNode *node,
|
||||||
|
+ GError **error)
|
||||||
|
+{
|
||||||
|
+ gboolean parsed_ok;
|
||||||
|
+ OvirtResourceClass *parent_class;
|
||||||
|
+ OvirtXmlElement disk_elements[] = {
|
||||||
|
+ { .prop_name = "content_type",
|
||||||
|
+ .xml_path = "content_type",
|
||||||
|
+ },
|
||||||
|
+ { NULL , }
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ parsed_ok = ovirt_rest_xml_node_parse(node, G_OBJECT(resource), disk_elements);
|
||||||
|
+ if (!parsed_ok) {
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+ parent_class = OVIRT_RESOURCE_CLASS(ovirt_disk_parent_class);
|
||||||
|
+
|
||||||
|
+ return parent_class->init_from_xml(resource, node, error);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void ovirt_disk_class_init(OvirtDiskClass *klass)
|
||||||
|
+{
|
||||||
|
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||||
|
+ OvirtResourceClass *resource_class = OVIRT_RESOURCE_CLASS(klass);
|
||||||
|
+ GParamSpec *param_spec;
|
||||||
|
+
|
||||||
|
+ resource_class->init_from_xml = ovirt_disk_init_from_xml;
|
||||||
|
+
|
||||||
|
+ object_class->get_property = ovirt_disk_get_property;
|
||||||
|
+ object_class->set_property = ovirt_disk_set_property;
|
||||||
|
+
|
||||||
|
+ param_spec = g_param_spec_enum("type",
|
||||||
|
+ "Content Type",
|
||||||
|
+ "The actual content residing on the disk",
|
||||||
|
+ OVIRT_TYPE_DISK_CONTENT_TYPE,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_DATA,
|
||||||
|
+ G_PARAM_READWRITE |
|
||||||
|
+ G_PARAM_STATIC_STRINGS);
|
||||||
|
+ g_object_class_install_property(object_class,
|
||||||
|
+ PROP_CONTENT_TYPE,
|
||||||
|
+ param_spec);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void ovirt_disk_init(OvirtDisk *disk)
|
||||||
|
+{
|
||||||
|
+ disk->priv = ovirt_disk_get_instance_private(disk);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+G_GNUC_INTERNAL
|
||||||
|
+OvirtDisk *ovirt_disk_new_from_id(const char *id,
|
||||||
|
+ const char *href)
|
||||||
|
+{
|
||||||
|
+ OvirtResource *disk = ovirt_resource_new_from_id(OVIRT_TYPE_DISK, id, href);
|
||||||
|
+ return OVIRT_DISK(disk);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+G_GNUC_INTERNAL
|
||||||
|
+OvirtDisk *ovirt_disk_new_from_xml(RestXmlNode *node,
|
||||||
|
+ GError **error)
|
||||||
|
+{
|
||||||
|
+ OvirtResource *disk = ovirt_resource_new_from_xml(OVIRT_TYPE_DISK, node, error);
|
||||||
|
+ return OVIRT_DISK(disk);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OvirtDisk *ovirt_disk_new(void)
|
||||||
|
+{
|
||||||
|
+ OvirtResource *disk = ovirt_resource_new(OVIRT_TYPE_DISK);
|
||||||
|
+ return OVIRT_DISK(disk);
|
||||||
|
+}
|
||||||
|
diff --git a/govirt/ovirt-disk.h b/govirt/ovirt-disk.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a0bdd5a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/govirt/ovirt-disk.h
|
||||||
|
@@ -0,0 +1,76 @@
|
||||||
|
+/*
|
||||||
|
+ * ovirt-disk.h: oVirt disk resource
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2020 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library. If not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ *
|
||||||
|
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
+ */
|
||||||
|
+#ifndef __OVIRT_DISK_H__
|
||||||
|
+#define __OVIRT_DISK_H__
|
||||||
|
+
|
||||||
|
+#include <gio/gio.h>
|
||||||
|
+#include <glib-object.h>
|
||||||
|
+#include <govirt/ovirt-resource.h>
|
||||||
|
+#include <govirt/ovirt-types.h>
|
||||||
|
+
|
||||||
|
+G_BEGIN_DECLS
|
||||||
|
+
|
||||||
|
+#define OVIRT_TYPE_DISK (ovirt_disk_get_type ())
|
||||||
|
+#define OVIRT_DISK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OVIRT_TYPE_DISK, OvirtDisk))
|
||||||
|
+#define OVIRT_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OVIRT_TYPE_DISK, OvirtDiskClass))
|
||||||
|
+#define OVIRT_IS_DISK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OVIRT_TYPE_DISK))
|
||||||
|
+#define OVIRT_IS_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OVIRT_TYPE_DISK))
|
||||||
|
+#define OVIRT_DISK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OVIRT_TYPE_DISK, OvirtDiskClass))
|
||||||
|
+
|
||||||
|
+typedef enum {
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_DATA,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_HOSTED_ENGINE,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_HOSTED_ENGINE_CONFIGURATION,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_HOSTED_ENGINE_METADATA,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_HOSTED_ENGINE_SANLOCK,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_ISO,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_MEMORY_DUMP_VOLUME,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_METADATA_VOLUME,
|
||||||
|
+ OVIRT_DISK_CONTENT_TYPE_OVF_STORE,
|
||||||
|
+} OvirtDiskContentType;
|
||||||
|
+
|
||||||
|
+typedef struct _OvirtDiskPrivate OvirtDiskPrivate;
|
||||||
|
+typedef struct _OvirtDiskClass OvirtDiskClass;
|
||||||
|
+
|
||||||
|
+struct _OvirtDisk
|
||||||
|
+{
|
||||||
|
+ OvirtResource parent;
|
||||||
|
+
|
||||||
|
+ OvirtDiskPrivate *priv;
|
||||||
|
+
|
||||||
|
+ /* Do not add fields to this struct */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct _OvirtDiskClass
|
||||||
|
+{
|
||||||
|
+ OvirtResourceClass parent_class;
|
||||||
|
+
|
||||||
|
+ gpointer padding[20];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+GType ovirt_disk_get_type(void);
|
||||||
|
+
|
||||||
|
+OvirtDisk *ovirt_disk_new(void);
|
||||||
|
+
|
||||||
|
+G_END_DECLS
|
||||||
|
+
|
||||||
|
+#endif /* __OVIRT_DISK_H__ */
|
||||||
|
diff --git a/govirt/ovirt-types.h b/govirt/ovirt-types.h
|
||||||
|
index eb85fd6..3c05d36 100644
|
||||||
|
--- a/govirt/ovirt-types.h
|
||||||
|
+++ b/govirt/ovirt-types.h
|
||||||
|
@@ -29,6 +29,7 @@ typedef struct _OvirtApi OvirtApi;
|
||||||
|
typedef struct _OvirtCdrom OvirtCdrom;
|
||||||
|
typedef struct _OvirtCluster OvirtCluster;
|
||||||
|
typedef struct _OvirtCollection OvirtCollection;
|
||||||
|
+typedef struct _OvirtDisk OvirtDisk;
|
||||||
|
typedef struct _OvirtDataCenter OvirtDataCenter;
|
||||||
|
typedef struct _OvirtHost OvirtHost;
|
||||||
|
typedef struct _OvirtProxy OvirtProxy;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,93 @@
|
|||||||
|
From 8ab1be89c70d0f6454e74442d382b9ea55f1df58 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
||||||
|
Date: Tue, 16 Jun 2020 10:07:49 -0300
|
||||||
|
Subject: [PATCH] ovirt-storage-domain: Introduce
|
||||||
|
ovirt_storage_domain_get_disks()
|
||||||
|
|
||||||
|
This function is used to return the list of disks in a given storage
|
||||||
|
domain with DATA type.
|
||||||
|
|
||||||
|
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
---
|
||||||
|
govirt/govirt.sym | 2 ++
|
||||||
|
govirt/ovirt-storage-domain.c | 28 ++++++++++++++++++++++++++++
|
||||||
|
govirt/ovirt-storage-domain.h | 1 +
|
||||||
|
3 files changed, 31 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
|
||||||
|
index 1cc2a8e..4cd6bb8 100644
|
||||||
|
--- a/govirt/govirt.sym
|
||||||
|
+++ b/govirt/govirt.sym
|
||||||
|
@@ -146,5 +146,7 @@ GOVIRT_0.4.1 {
|
||||||
|
ovirt_disk_get_type;
|
||||||
|
ovirt_disk_content_type_get_type;
|
||||||
|
ovirt_disk_new;
|
||||||
|
+
|
||||||
|
+ ovirt_storage_domain_get_disks;
|
||||||
|
} GOVIRT_0.4.0;
|
||||||
|
# .... define new API here using predicted next version number ....
|
||||||
|
diff --git a/govirt/ovirt-storage-domain.c b/govirt/ovirt-storage-domain.c
|
||||||
|
index a713d89..d02c3d5 100644
|
||||||
|
--- a/govirt/ovirt-storage-domain.c
|
||||||
|
+++ b/govirt/ovirt-storage-domain.c
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
|
||||||
|
struct _OvirtStorageDomainPrivate {
|
||||||
|
OvirtCollection *files;
|
||||||
|
+ OvirtCollection *disks;
|
||||||
|
GStrv data_center_ids;
|
||||||
|
|
||||||
|
gchar *data_center_href;
|
||||||
|
@@ -172,6 +173,7 @@ ovirt_storage_domain_dispose(GObject *obj)
|
||||||
|
OvirtStorageDomain *domain = OVIRT_STORAGE_DOMAIN(obj);
|
||||||
|
|
||||||
|
g_clear_object(&domain->priv->files);
|
||||||
|
+ g_clear_object(&domain->priv->disks);
|
||||||
|
g_clear_pointer(&domain->priv->data_center_ids, g_strfreev);
|
||||||
|
g_clear_pointer(&domain->priv->data_center_href, g_free);
|
||||||
|
g_clear_pointer(&domain->priv->data_center_id, g_free);
|
||||||
|
@@ -399,3 +401,29 @@ OvirtCollection *ovirt_storage_domain_get_files(OvirtStorageDomain *domain)
|
||||||
|
|
||||||
|
return domain->priv->files;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * ovirt_storage_domain_get_disks:
|
||||||
|
+ * @domain: a #OvirtStorageDomain
|
||||||
|
+ *
|
||||||
|
+ * Gets a #OvirtCollection representing the list of remote disks from a
|
||||||
|
+ * storage domain object. This method does not initiate any network
|
||||||
|
+ * activity, the remote file list must be then be fetched using
|
||||||
|
+ * ovirt_collection_fetch() or ovirt_collection_fetch_async().
|
||||||
|
+ *
|
||||||
|
+ * Return value: (transfer none): a #OvirtCollection representing the list
|
||||||
|
+ * of disks associated with @domain.
|
||||||
|
+ */
|
||||||
|
+OvirtCollection *ovirt_storage_domain_get_disks(OvirtStorageDomain *domain)
|
||||||
|
+{
|
||||||
|
+ g_return_val_if_fail(OVIRT_IS_STORAGE_DOMAIN(domain), NULL);
|
||||||
|
+
|
||||||
|
+ if (domain->priv->disks == NULL)
|
||||||
|
+ domain->priv->disks = ovirt_sub_collection_new_from_resource(OVIRT_RESOURCE(domain),
|
||||||
|
+ "disks",
|
||||||
|
+ "disks",
|
||||||
|
+ OVIRT_TYPE_DISK,
|
||||||
|
+ "disk");
|
||||||
|
+
|
||||||
|
+ return domain->priv->disks;
|
||||||
|
+}
|
||||||
|
diff --git a/govirt/ovirt-storage-domain.h b/govirt/ovirt-storage-domain.h
|
||||||
|
index f122e27..97cfb06 100644
|
||||||
|
--- a/govirt/ovirt-storage-domain.h
|
||||||
|
+++ b/govirt/ovirt-storage-domain.h
|
||||||
|
@@ -86,6 +86,7 @@ GType ovirt_storage_domain_get_type(void);
|
||||||
|
OvirtStorageDomain *ovirt_storage_domain_new(void);
|
||||||
|
|
||||||
|
OvirtCollection *ovirt_storage_domain_get_files(OvirtStorageDomain *domain);
|
||||||
|
+OvirtCollection *ovirt_storage_domain_get_disks(OvirtStorageDomain *domain);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
40
SOURCES/0003-ovirt-disk-Fix-content-type-property-name.patch
Normal file
40
SOURCES/0003-ovirt-disk-Fix-content-type-property-name.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From f49fb13abcc7d0c2fb8a2551913d9d5997997487 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
||||||
|
Date: Thu, 25 Jun 2020 13:39:50 -0300
|
||||||
|
Subject: [PATCH] ovirt-disk: Fix content type property name
|
||||||
|
|
||||||
|
Instead of using underscore, which is not accepted, make use of a dash,
|
||||||
|
avoiding error messages like the following:
|
||||||
|
|
||||||
|
GLib-CRITICAL **: g_param_spec_internal: assertion '!(flags & G_PARAM_STATIC_NAME) || is_canonical (name)' failed
|
||||||
|
|
||||||
|
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
||||||
|
---
|
||||||
|
govirt/ovirt-disk.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/govirt/ovirt-disk.c b/govirt/ovirt-disk.c
|
||||||
|
index 9242c4c..4772002 100644
|
||||||
|
--- a/govirt/ovirt-disk.c
|
||||||
|
+++ b/govirt/ovirt-disk.c
|
||||||
|
@@ -77,7 +77,7 @@ static gboolean ovirt_disk_init_from_xml(OvirtResource *resource,
|
||||||
|
gboolean parsed_ok;
|
||||||
|
OvirtResourceClass *parent_class;
|
||||||
|
OvirtXmlElement disk_elements[] = {
|
||||||
|
- { .prop_name = "content_type",
|
||||||
|
+ { .prop_name = "content-type",
|
||||||
|
.xml_path = "content_type",
|
||||||
|
},
|
||||||
|
{ NULL , }
|
||||||
|
@@ -103,7 +103,7 @@ static void ovirt_disk_class_init(OvirtDiskClass *klass)
|
||||||
|
object_class->get_property = ovirt_disk_get_property;
|
||||||
|
object_class->set_property = ovirt_disk_set_property;
|
||||||
|
|
||||||
|
- param_spec = g_param_spec_enum("type",
|
||||||
|
+ param_spec = g_param_spec_enum("content-type",
|
||||||
|
"Content Type",
|
||||||
|
"The actual content residing on the disk",
|
||||||
|
OVIRT_TYPE_DISK_CONTENT_TYPE,
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
Summary: A GObject library for interacting with oVirt REST API
|
Summary: A GObject library for interacting with oVirt REST API
|
||||||
Name: libgovirt
|
Name: libgovirt
|
||||||
Version: 0.3.7
|
Version: 0.3.7
|
||||||
Release: 1%{?dist}%{?extra_release}
|
Release: 3%{?dist}%{?extra_release}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
Source0: http://ftp.gnome.org/pub/GNOME/sources/libgovirt/0.3/%{name}-%{version}.tar.xz
|
Source0: http://ftp.gnome.org/pub/GNOME/sources/libgovirt/0.3/%{name}-%{version}.tar.xz
|
||||||
@ -25,6 +25,10 @@ Source1: http://ftp.gnome.org/pub/GNOME/sources/libgovirt/0.3/%{name}-%{version}
|
|||||||
Source2: etrunko-57E1C130.keyring
|
Source2: etrunko-57E1C130.keyring
|
||||||
URL: https://gitlab.gnome.org/GNOME/libgovirt
|
URL: https://gitlab.gnome.org/GNOME/libgovirt
|
||||||
|
|
||||||
|
Patch0001: 0001-Initial-support-for-Disks.patch
|
||||||
|
Patch0002: 0002-ovirt-storage-domain-Introduce-ovirt_storage_domain_.patch
|
||||||
|
Patch0003: 0003-ovirt-disk-Fix-content-type-property-name.patch
|
||||||
|
|
||||||
%if 0%{?enable_autotools}
|
%if 0%{?enable_autotools}
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
@ -111,6 +115,14 @@ make check
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 16 2020 Eduardo Lima (Etrunko) <etrunko@redhat.com> - 0.3.7-3
|
||||||
|
- Fix content-type property name
|
||||||
|
Resolves: rhbz#1847223
|
||||||
|
|
||||||
|
* Tue Jun 16 2020 Eduardo Lima (Etrunko) <etrunko@redhat.com> - 0.3.7-2
|
||||||
|
- Add support for storage domains 'disks' query
|
||||||
|
Resolves: rhbz#1847223
|
||||||
|
|
||||||
* Fri May 08 2020 Eduardo Lima (Etrunko) <etrunko@redhat.com> - 0.3.7-1
|
* Fri May 08 2020 Eduardo Lima (Etrunko) <etrunko@redhat.com> - 0.3.7-1
|
||||||
- Rebase to latest upstream version
|
- Rebase to latest upstream version
|
||||||
Resolves: rhbz#1801226
|
Resolves: rhbz#1801226
|
||||||
|
Loading…
Reference in New Issue
Block a user