|
|
3e596a |
From a05b1ad1eaa5d1a7a2abb61fa5c3ec7231dd5e1f Mon Sep 17 00:00:00 2001
|
|
|
3e596a |
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
|
|
3e596a |
Date: Tue, 11 Apr 2017 21:53:26 -0300
|
|
|
3e596a |
Subject: [PATCH] Initial support for data centers
|
|
|
3e596a |
|
|
|
3e596a |
For this higher level object, the list of clusters and storage domains
|
|
|
3e596a |
associated with it are stored.
|
|
|
3e596a |
|
|
|
3e596a |
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
3e596a |
---
|
|
|
3e596a |
govirt/Makefile.am | 3 +
|
|
|
3e596a |
govirt/govirt-private.h | 1 +
|
|
|
3e596a |
govirt/govirt.sym | 7 ++
|
|
|
3e596a |
govirt/ovirt-api.c | 47 ++++++++++++
|
|
|
3e596a |
govirt/ovirt-api.h | 2 +
|
|
|
3e596a |
govirt/ovirt-data-center-private.h | 37 ++++++++++
|
|
|
3e596a |
govirt/ovirt-data-center.c | 144 +++++++++++++++++++++++++++++++++++++
|
|
|
3e596a |
govirt/ovirt-data-center.h | 67 +++++++++++++++++
|
|
|
3e596a |
govirt/ovirt-types.h | 1 +
|
|
|
3e596a |
9 files changed, 309 insertions(+)
|
|
|
3e596a |
create mode 100644 govirt/ovirt-data-center-private.h
|
|
|
3e596a |
create mode 100644 govirt/ovirt-data-center.c
|
|
|
3e596a |
create mode 100644 govirt/ovirt-data-center.h
|
|
|
3e596a |
|
|
|
3e596a |
diff --git a/govirt/Makefile.am b/govirt/Makefile.am
|
|
|
3e596a |
index cf6b858..9bf0eba 100644
|
|
|
3e596a |
--- a/govirt/Makefile.am
|
|
|
3e596a |
+++ b/govirt/Makefile.am
|
|
|
3e596a |
@@ -21,6 +21,7 @@ libgovirt_la_HEADERS = \
|
|
|
3e596a |
ovirt-cdrom.h \
|
|
|
3e596a |
ovirt-cluster.h \
|
|
|
3e596a |
ovirt-collection.h \
|
|
|
3e596a |
+ ovirt-data-center.h \
|
|
|
3e596a |
ovirt-error.h \
|
|
|
3e596a |
ovirt-host.h \
|
|
|
3e596a |
ovirt-options.h \
|
|
|
3e596a |
@@ -41,6 +42,7 @@ noinst_HEADERS = \
|
|
|
3e596a |
ovirt-api-private.h \
|
|
|
3e596a |
ovirt-cluster-private.h \
|
|
|
3e596a |
ovirt-collection-private.h \
|
|
|
3e596a |
+ ovirt-data-center-private.h \
|
|
|
3e596a |
ovirt-host-private.h \
|
|
|
3e596a |
ovirt-proxy-private.h \
|
|
|
3e596a |
ovirt-resource-private.h \
|
|
|
3e596a |
@@ -58,6 +60,7 @@ libgovirt_la_SOURCES = \
|
|
|
3e596a |
ovirt-cdrom.c \
|
|
|
3e596a |
ovirt-cluster.c \
|
|
|
3e596a |
ovirt-collection.c \
|
|
|
3e596a |
+ ovirt-data-center.c \
|
|
|
3e596a |
ovirt-error.c \
|
|
|
3e596a |
ovirt-host.c \
|
|
|
3e596a |
ovirt-options.c \
|
|
|
3e596a |
diff --git a/govirt/govirt-private.h b/govirt/govirt-private.h
|
|
|
3e596a |
index d466f7a..cd98b5b 100644
|
|
|
3e596a |
--- a/govirt/govirt-private.h
|
|
|
3e596a |
+++ b/govirt/govirt-private.h
|
|
|
3e596a |
@@ -26,6 +26,7 @@
|
|
|
3e596a |
#include <govirt/ovirt-api-private.h>
|
|
|
3e596a |
#include <govirt/ovirt-cluster-private.h>
|
|
|
3e596a |
#include <govirt/ovirt-collection-private.h>
|
|
|
3e596a |
+#include <govirt/ovirt-data-center-private.h>
|
|
|
3e596a |
#include <govirt/ovirt-enum-types-private.h>
|
|
|
3e596a |
#include <govirt/ovirt-host-private.h>
|
|
|
3e596a |
#include <govirt/ovirt-proxy-private.h>
|
|
|
3e596a |
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
|
|
|
3e596a |
index 3e32203..55fe115 100644
|
|
|
3e596a |
--- a/govirt/govirt.sym
|
|
|
3e596a |
+++ b/govirt/govirt.sym
|
|
|
3e596a |
@@ -111,9 +111,11 @@ GOVIRT_0.3.2 {
|
|
|
3e596a |
ovirt_api_search_vm_pools;
|
|
|
3e596a |
|
|
|
3e596a |
ovirt_api_get_clusters;
|
|
|
3e596a |
+ ovirt_api_get_data_centers;
|
|
|
3e596a |
ovirt_api_get_hosts;
|
|
|
3e596a |
|
|
|
3e596a |
ovirt_api_search_clusters;
|
|
|
3e596a |
+ ovirt_api_search_data_centers;
|
|
|
3e596a |
ovirt_api_search_hosts;
|
|
|
3e596a |
ovirt_api_search_storage_domains;
|
|
|
3e596a |
ovirt_api_search_vms;
|
|
|
3e596a |
@@ -123,6 +125,11 @@ GOVIRT_0.3.2 {
|
|
|
3e596a |
ovirt_cluster_get_hosts;
|
|
|
3e596a |
ovirt_cluster_new;
|
|
|
3e596a |
|
|
|
3e596a |
+ ovirt_data_center_get_clusters;
|
|
|
3e596a |
+ ovirt_data_center_get_storage_domains;
|
|
|
3e596a |
+ ovirt_data_center_get_type;
|
|
|
3e596a |
+ ovirt_data_center_new;
|
|
|
3e596a |
+
|
|
|
3e596a |
ovirt_host_get_type;
|
|
|
3e596a |
ovirt_host_get_vms;
|
|
|
3e596a |
ovirt_host_new;
|
|
|
3e596a |
diff --git a/govirt/ovirt-api.c b/govirt/ovirt-api.c
|
|
|
3e596a |
index e152378..7155173 100644
|
|
|
3e596a |
--- a/govirt/ovirt-api.c
|
|
|
3e596a |
+++ b/govirt/ovirt-api.c
|
|
|
3e596a |
@@ -42,6 +42,7 @@
|
|
|
3e596a |
|
|
|
3e596a |
struct _OvirtApiPrivate {
|
|
|
3e596a |
OvirtCollection *clusters;
|
|
|
3e596a |
+ OvirtCollection *data_centers;
|
|
|
3e596a |
OvirtCollection *hosts;
|
|
|
3e596a |
OvirtCollection *storage_domains;
|
|
|
3e596a |
OvirtCollection *vms;
|
|
|
3e596a |
@@ -76,6 +77,7 @@ static void ovirt_api_dispose(GObject *object)
|
|
|
3e596a |
OvirtApi *api = OVIRT_API(object);
|
|
|
3e596a |
|
|
|
3e596a |
g_clear_object(&api->priv->clusters);
|
|
|
3e596a |
+ g_clear_object(&api->priv->data_centers);
|
|
|
3e596a |
g_clear_object(&api->priv->hosts);
|
|
|
3e596a |
g_clear_object(&api->priv->storage_domains);
|
|
|
3e596a |
g_clear_object(&api->priv->vms);
|
|
|
3e596a |
@@ -327,3 +329,48 @@ OvirtCollection *ovirt_api_search_clusters(OvirtApi *api, const char *query)
|
|
|
3e596a |
"cluster",
|
|
|
3e596a |
query);
|
|
|
3e596a |
}
|
|
|
3e596a |
+
|
|
|
3e596a |
+
|
|
|
3e596a |
+/**
|
|
|
3e596a |
+ * ovirt_api_get_data_centers:
|
|
|
3e596a |
+ * @api: a #OvirtApi
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This method does not initiate any network activity, the collection
|
|
|
3e596a |
+ * must be fetched with ovirt_collection_fetch() before having up-to-date
|
|
|
3e596a |
+ * content.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Return value: (transfer none):
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+OvirtCollection *ovirt_api_get_data_centers(OvirtApi *api)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ g_return_val_if_fail(OVIRT_IS_API(api), NULL);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ if (api->priv->data_centers == NULL)
|
|
|
3e596a |
+ api->priv->data_centers = ovirt_sub_collection_new_from_resource(OVIRT_RESOURCE(api),
|
|
|
3e596a |
+ "datacenters",
|
|
|
3e596a |
+ "data_centers",
|
|
|
3e596a |
+ OVIRT_TYPE_DATA_CENTER,
|
|
|
3e596a |
+ "data_center");
|
|
|
3e596a |
+
|
|
|
3e596a |
+ return api->priv->data_centers;
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+
|
|
|
3e596a |
+/**
|
|
|
3e596a |
+ * ovirt_api_search_data_centers:
|
|
|
3e596a |
+ * @api: a #OvirtApi
|
|
|
3e596a |
+ * @query: search query
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Return value: (transfer none):
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+OvirtCollection *ovirt_api_search_data_centers(OvirtApi *api, const char *query)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ g_return_val_if_fail(OVIRT_IS_API(api), NULL);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ return ovirt_sub_collection_new_from_resource_search(OVIRT_RESOURCE(api),
|
|
|
3e596a |
+ "datacenters/search",
|
|
|
3e596a |
+ "data_centers",
|
|
|
3e596a |
+ OVIRT_TYPE_DATA_CENTER,
|
|
|
3e596a |
+ "data_center",
|
|
|
3e596a |
+ query);
|
|
|
3e596a |
+}
|
|
|
3e596a |
diff --git a/govirt/ovirt-api.h b/govirt/ovirt-api.h
|
|
|
3e596a |
index 1b60f35..1448296 100644
|
|
|
3e596a |
--- a/govirt/ovirt-api.h
|
|
|
3e596a |
+++ b/govirt/ovirt-api.h
|
|
|
3e596a |
@@ -62,6 +62,8 @@ OvirtApi *ovirt_api_new(void);
|
|
|
3e596a |
|
|
|
3e596a |
OvirtCollection *ovirt_api_get_clusters(OvirtApi *api);
|
|
|
3e596a |
OvirtCollection *ovirt_api_search_clusters(OvirtApi *api, const char *query);
|
|
|
3e596a |
+OvirtCollection *ovirt_api_get_data_centers(OvirtApi *api);
|
|
|
3e596a |
+OvirtCollection *ovirt_api_search_data_centers(OvirtApi *api, const char *query);
|
|
|
3e596a |
OvirtCollection *ovirt_api_get_hosts(OvirtApi *api);
|
|
|
3e596a |
OvirtCollection *ovirt_api_search_hosts(OvirtApi *api, const char *query);
|
|
|
3e596a |
OvirtCollection *ovirt_api_get_storage_domains(OvirtApi *api);
|
|
|
3e596a |
diff --git a/govirt/ovirt-data-center-private.h b/govirt/ovirt-data-center-private.h
|
|
|
3e596a |
new file mode 100644
|
|
|
3e596a |
index 0000000..5839755
|
|
|
3e596a |
--- /dev/null
|
|
|
3e596a |
+++ b/govirt/ovirt-data-center-private.h
|
|
|
3e596a |
@@ -0,0 +1,37 @@
|
|
|
3e596a |
+/*
|
|
|
3e596a |
+ * ovirt-data_center-private.h: oVirt data center resource
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is free software; you can redistribute it and/or
|
|
|
3e596a |
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
3e596a |
+ * License as published by the Free Software Foundation; either
|
|
|
3e596a |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is distributed in the hope that it will be useful,
|
|
|
3e596a |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
3e596a |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
3e596a |
+ * Lesser General Public License for more details.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
3e596a |
+ * License along with this library. If not, see
|
|
|
3e596a |
+ * <http://www.gnu.org/licenses/>.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+#ifndef __OVIRT_DATA_CENTER_PRIVATE_H__
|
|
|
3e596a |
+#define __OVIRT_DATA_CENTER_PRIVATE_H__
|
|
|
3e596a |
+
|
|
|
3e596a |
+#include <ovirt-data-center.h>
|
|
|
3e596a |
+#include <rest/rest-xml-node.h>
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_BEGIN_DECLS
|
|
|
3e596a |
+
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new_from_id(const char *id,
|
|
|
3e596a |
+ const char *href);
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new_from_xml(RestXmlNode *node,
|
|
|
3e596a |
+ GError **error);
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_END_DECLS
|
|
|
3e596a |
+
|
|
|
3e596a |
+#endif /* __OVIRT_DATA_CENTER_PRIVATE_H__ */
|
|
|
3e596a |
diff --git a/govirt/ovirt-data-center.c b/govirt/ovirt-data-center.c
|
|
|
3e596a |
new file mode 100644
|
|
|
3e596a |
index 0000000..577a31f
|
|
|
3e596a |
--- /dev/null
|
|
|
3e596a |
+++ b/govirt/ovirt-data-center.c
|
|
|
3e596a |
@@ -0,0 +1,144 @@
|
|
|
3e596a |
+/*
|
|
|
3e596a |
+ * ovirt-data_center.c: oVirt data center handling
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is free software; you can redistribute it and/or
|
|
|
3e596a |
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
3e596a |
+ * License as published by the Free Software Foundation; either
|
|
|
3e596a |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is distributed in the hope that it will be useful,
|
|
|
3e596a |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
3e596a |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
3e596a |
+ * Lesser General Public License for more details.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
3e596a |
+ * License along with this library. If not, see
|
|
|
3e596a |
+ * <http://www.gnu.org/licenses/>.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+
|
|
|
3e596a |
+#include <config.h>
|
|
|
3e596a |
+#include "ovirt-enum-types.h"
|
|
|
3e596a |
+#include "ovirt-data-center.h"
|
|
|
3e596a |
+#include "govirt-private.h"
|
|
|
3e596a |
+
|
|
|
3e596a |
+#define OVIRT_DATA_CENTER_GET_PRIVATE(obj) \
|
|
|
3e596a |
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), OVIRT_TYPE_DATA_CENTER, OvirtDataCenterPrivate))
|
|
|
3e596a |
+
|
|
|
3e596a |
+struct _OvirtDataCenterPrivate {
|
|
|
3e596a |
+ OvirtCollection *clusters;
|
|
|
3e596a |
+ OvirtCollection *storage_domains;
|
|
|
3e596a |
+};
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_DEFINE_TYPE(OvirtDataCenter, ovirt_data_center, OVIRT_TYPE_RESOURCE);
|
|
|
3e596a |
+
|
|
|
3e596a |
+static void
|
|
|
3e596a |
+ovirt_data_center_dispose(GObject *obj)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtDataCenter *data_center = OVIRT_DATA_CENTER(obj);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ g_clear_object(&data_center->priv->clusters);
|
|
|
3e596a |
+ g_clear_object(&data_center->priv->storage_domains);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ G_OBJECT_CLASS(ovirt_data_center_parent_class)->dispose(obj);
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+static void ovirt_data_center_class_init(OvirtDataCenterClass *klass)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ g_type_class_add_private(klass, sizeof(OvirtDataCenterPrivate));
|
|
|
3e596a |
+
|
|
|
3e596a |
+ object_class->dispose = ovirt_data_center_dispose;
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+
|
|
|
3e596a |
+static void ovirt_data_center_init(OvirtDataCenter *data_center)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ data_center->priv = OVIRT_DATA_CENTER_GET_PRIVATE(data_center);
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_GNUC_INTERNAL
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new_from_id(const char *id,
|
|
|
3e596a |
+ const char *href)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtResource *data_center = ovirt_resource_new_from_id(OVIRT_TYPE_DATA_CENTER, id, href);
|
|
|
3e596a |
+ return OVIRT_DATA_CENTER(data_center);
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_GNUC_INTERNAL
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new_from_xml(RestXmlNode *node,
|
|
|
3e596a |
+ GError **error)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtResource *data_center = ovirt_resource_new_from_xml(OVIRT_TYPE_DATA_CENTER, node, error);
|
|
|
3e596a |
+ return OVIRT_DATA_CENTER(data_center);
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new(void)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtResource *data_center = ovirt_resource_new(OVIRT_TYPE_DATA_CENTER);
|
|
|
3e596a |
+ return OVIRT_DATA_CENTER(data_center);
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+
|
|
|
3e596a |
+/**
|
|
|
3e596a |
+ * ovirt_data_center_get_clusters:
|
|
|
3e596a |
+ * @data_center: a #OvirtDataCenter
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Gets a #OvirtCollection representing the list of remote clusters from a
|
|
|
3e596a |
+ * data center object. This method does not initiate any network
|
|
|
3e596a |
+ * activity, the remote cluster list must be then be fetched using
|
|
|
3e596a |
+ * ovirt_collection_fetch() or ovirt_collection_fetch_async().
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Return value: (transfer none): a #OvirtCollection representing the list
|
|
|
3e596a |
+ * of clusters associated with @data_center.
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+OvirtCollection *ovirt_data_center_get_clusters(OvirtDataCenter *data_center)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ g_return_val_if_fail(OVIRT_IS_DATA_CENTER(data_center), NULL);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ if (data_center->priv->clusters == NULL) {
|
|
|
3e596a |
+ OvirtCollection *collection;
|
|
|
3e596a |
+ collection = ovirt_sub_collection_new_from_resource(OVIRT_RESOURCE(data_center),
|
|
|
3e596a |
+ "clusters",
|
|
|
3e596a |
+ "clusters",
|
|
|
3e596a |
+ OVIRT_TYPE_CLUSTER,
|
|
|
3e596a |
+ "cluster");
|
|
|
3e596a |
+ data_center->priv->clusters = collection;
|
|
|
3e596a |
+ }
|
|
|
3e596a |
+
|
|
|
3e596a |
+ return data_center->priv->clusters;
|
|
|
3e596a |
+}
|
|
|
3e596a |
+
|
|
|
3e596a |
+
|
|
|
3e596a |
+/**
|
|
|
3e596a |
+ * ovirt_data_center_get_storage_domains:
|
|
|
3e596a |
+ * @data_center: a #OvirtDataCenter
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Gets a #OvirtCollection representing the list of remote storage domains from a
|
|
|
3e596a |
+ * data center object. This method does not initiate any network
|
|
|
3e596a |
+ * activity, the remote storage domain list must be then be fetched using
|
|
|
3e596a |
+ * ovirt_collection_fetch() or ovirt_collection_fetch_async().
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Return value: (transfer none): a #OvirtCollection representing the list
|
|
|
3e596a |
+ * of storage_domains associated with @data_center.
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+OvirtCollection *ovirt_data_center_get_storage_domains(OvirtDataCenter *data_center)
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ g_return_val_if_fail(OVIRT_IS_DATA_CENTER(data_center), NULL);
|
|
|
3e596a |
+
|
|
|
3e596a |
+ if (data_center->priv->storage_domains == NULL) {
|
|
|
3e596a |
+ OvirtCollection *collection;
|
|
|
3e596a |
+ collection = ovirt_sub_collection_new_from_resource(OVIRT_RESOURCE(data_center),
|
|
|
3e596a |
+ "storagedomains",
|
|
|
3e596a |
+ "storage_domains",
|
|
|
3e596a |
+ OVIRT_TYPE_STORAGE_DOMAIN,
|
|
|
3e596a |
+ "storage_domain");
|
|
|
3e596a |
+ data_center->priv->storage_domains = collection;
|
|
|
3e596a |
+ }
|
|
|
3e596a |
+
|
|
|
3e596a |
+ return data_center->priv->storage_domains;
|
|
|
3e596a |
+}
|
|
|
3e596a |
diff --git a/govirt/ovirt-data-center.h b/govirt/ovirt-data-center.h
|
|
|
3e596a |
new file mode 100644
|
|
|
3e596a |
index 0000000..1bad06f
|
|
|
3e596a |
--- /dev/null
|
|
|
3e596a |
+++ b/govirt/ovirt-data-center.h
|
|
|
3e596a |
@@ -0,0 +1,67 @@
|
|
|
3e596a |
+/*
|
|
|
3e596a |
+ * ovirt-data_center.h: oVirt data center resource
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is free software; you can redistribute it and/or
|
|
|
3e596a |
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
3e596a |
+ * License as published by the Free Software Foundation; either
|
|
|
3e596a |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * This library is distributed in the hope that it will be useful,
|
|
|
3e596a |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
3e596a |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
3e596a |
+ * Lesser General Public License for more details.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
3e596a |
+ * License along with this library. If not, see
|
|
|
3e596a |
+ * <http://www.gnu.org/licenses/>.
|
|
|
3e596a |
+ *
|
|
|
3e596a |
+ * Author: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
3e596a |
+ */
|
|
|
3e596a |
+#ifndef __OVIRT_DATA_CENTER_H__
|
|
|
3e596a |
+#define __OVIRT_DATA_CENTER_H__
|
|
|
3e596a |
+
|
|
|
3e596a |
+#include <gio/gio.h>
|
|
|
3e596a |
+#include <glib-object.h>
|
|
|
3e596a |
+#include <govirt/ovirt-collection.h>
|
|
|
3e596a |
+#include <govirt/ovirt-resource.h>
|
|
|
3e596a |
+#include <govirt/ovirt-types.h>
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_BEGIN_DECLS
|
|
|
3e596a |
+
|
|
|
3e596a |
+#define OVIRT_TYPE_DATA_CENTER (ovirt_data_center_get_type ())
|
|
|
3e596a |
+#define OVIRT_DATA_CENTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OVIRT_TYPE_DATA_CENTER, OvirtDataCenter))
|
|
|
3e596a |
+#define OVIRT_DATA_CENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OVIRT_TYPE_DATA_CENTER, OvirtDataCenterClass))
|
|
|
3e596a |
+#define OVIRT_IS_DATA_CENTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OVIRT_TYPE_DATA_CENTER))
|
|
|
3e596a |
+#define OVIRT_IS_DATA_CENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OVIRT_TYPE_DATA_CENTER))
|
|
|
3e596a |
+#define OVIRT_DATA_CENTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OVIRT_TYPE_DATA_CENTER, OvirtDataCenterClass))
|
|
|
3e596a |
+
|
|
|
3e596a |
+typedef struct _OvirtDataCenterPrivate OvirtDataCenterPrivate;
|
|
|
3e596a |
+typedef struct _OvirtDataCenterClass OvirtDataCenterClass;
|
|
|
3e596a |
+
|
|
|
3e596a |
+struct _OvirtDataCenter
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtResource parent;
|
|
|
3e596a |
+
|
|
|
3e596a |
+ OvirtDataCenterPrivate *priv;
|
|
|
3e596a |
+
|
|
|
3e596a |
+ /* Do not add fields to this struct */
|
|
|
3e596a |
+};
|
|
|
3e596a |
+
|
|
|
3e596a |
+struct _OvirtDataCenterClass
|
|
|
3e596a |
+{
|
|
|
3e596a |
+ OvirtResourceClass parent_class;
|
|
|
3e596a |
+
|
|
|
3e596a |
+ gpointer padding[20];
|
|
|
3e596a |
+};
|
|
|
3e596a |
+
|
|
|
3e596a |
+GType ovirt_data_center_get_type(void);
|
|
|
3e596a |
+
|
|
|
3e596a |
+OvirtDataCenter *ovirt_data_center_new(void);
|
|
|
3e596a |
+OvirtCollection *ovirt_data_center_get_clusters(OvirtDataCenter *data_center);
|
|
|
3e596a |
+OvirtCollection *ovirt_data_center_get_storage_domains(OvirtDataCenter *data_center);
|
|
|
3e596a |
+
|
|
|
3e596a |
+G_END_DECLS
|
|
|
3e596a |
+
|
|
|
3e596a |
+#endif /* __OVIRT_DATA_CENTER_H__ */
|
|
|
3e596a |
diff --git a/govirt/ovirt-types.h b/govirt/ovirt-types.h
|
|
|
3e596a |
index e2f196e..eb85fd6 100644
|
|
|
3e596a |
--- a/govirt/ovirt-types.h
|
|
|
3e596a |
+++ b/govirt/ovirt-types.h
|
|
|
3e596a |
@@ -29,6 +29,7 @@ typedef struct _OvirtApi OvirtApi;
|
|
|
3e596a |
typedef struct _OvirtCdrom OvirtCdrom;
|
|
|
3e596a |
typedef struct _OvirtCluster OvirtCluster;
|
|
|
3e596a |
typedef struct _OvirtCollection OvirtCollection;
|
|
|
3e596a |
+typedef struct _OvirtDataCenter OvirtDataCenter;
|
|
|
3e596a |
typedef struct _OvirtHost OvirtHost;
|
|
|
3e596a |
typedef struct _OvirtProxy OvirtProxy;
|
|
|
3e596a |
typedef struct _OvirtStorageDomain OvirtStorageDomain;
|
|
|
3e596a |
--
|
|
|
3e596a |
2.13.6
|
|
|
3e596a |
|