|
|
546e1e |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
546e1e |
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
|
|
546e1e |
Date: Thu, 13 Apr 2017 15:26:41 -0300
|
|
|
546e1e |
Subject: [PATCH] storage-domain: Retrieve data center ids
|
|
|
546e1e |
|
|
|
546e1e |
Storage domains can be part of one or more data centers, so we use a
|
|
|
546e1e |
GStrv to store each id.
|
|
|
546e1e |
|
|
|
546e1e |
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
546e1e |
---
|
|
|
546e1e |
govirt/ovirt-storage-domain.c | 27 ++++++++++++++++++++++++++-
|
|
|
546e1e |
1 file changed, 26 insertions(+), 1 deletion(-)
|
|
|
546e1e |
|
|
|
546e1e |
diff --git a/govirt/ovirt-storage-domain.c b/govirt/ovirt-storage-domain.c
|
|
|
546e1e |
index e255565..718c1d2 100644
|
|
|
546e1e |
--- a/govirt/ovirt-storage-domain.c
|
|
|
546e1e |
+++ b/govirt/ovirt-storage-domain.c
|
|
|
546e1e |
@@ -30,6 +30,7 @@
|
|
|
546e1e |
|
|
|
546e1e |
struct _OvirtStorageDomainPrivate {
|
|
|
546e1e |
OvirtCollection *files;
|
|
|
546e1e |
+ GStrv data_center_ids;
|
|
|
546e1e |
|
|
|
546e1e |
OvirtStorageDomainType type;
|
|
|
546e1e |
gboolean is_master;
|
|
|
546e1e |
@@ -50,7 +51,8 @@ enum {
|
|
|
546e1e |
PROP_USED,
|
|
|
546e1e |
PROP_COMMITTED,
|
|
|
546e1e |
PROP_VERSION,
|
|
|
546e1e |
- PROP_STATE
|
|
|
546e1e |
+ PROP_STATE,
|
|
|
546e1e |
+ PROP_DATA_CENTER_IDS,
|
|
|
546e1e |
};
|
|
|
546e1e |
|
|
|
546e1e |
static void ovirt_storage_domain_get_property(GObject *object,
|
|
|
546e1e |
@@ -82,6 +84,9 @@ static void ovirt_storage_domain_get_property(GObject *object,
|
|
|
546e1e |
case PROP_STATE:
|
|
|
546e1e |
g_value_set_enum(value, domain->priv->state);
|
|
|
546e1e |
break;
|
|
|
546e1e |
+ case PROP_DATA_CENTER_IDS:
|
|
|
546e1e |
+ g_value_set_boxed(value, domain->priv->data_center_ids);
|
|
|
546e1e |
+ break;
|
|
|
546e1e |
default:
|
|
|
546e1e |
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
546e1e |
break;
|
|
|
546e1e |
@@ -117,6 +122,10 @@ static void ovirt_storage_domain_set_property(GObject *object,
|
|
|
546e1e |
case PROP_STATE:
|
|
|
546e1e |
domain->priv->state = g_value_get_enum(value);
|
|
|
546e1e |
break;
|
|
|
546e1e |
+ case PROP_DATA_CENTER_IDS:
|
|
|
546e1e |
+ g_strfreev(domain->priv->data_center_ids);
|
|
|
546e1e |
+ domain->priv->data_center_ids = g_value_dup_boxed(value);
|
|
|
546e1e |
+ break;
|
|
|
546e1e |
default:
|
|
|
546e1e |
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
546e1e |
break;
|
|
|
546e1e |
@@ -130,6 +139,7 @@ ovirt_storage_domain_dispose(GObject *obj)
|
|
|
546e1e |
OvirtStorageDomain *domain = OVIRT_STORAGE_DOMAIN(obj);
|
|
|
546e1e |
|
|
|
546e1e |
g_clear_object(&domain->priv->files);
|
|
|
546e1e |
+ g_clear_pointer(&domain->priv->data_center_ids, g_strfreev);
|
|
|
546e1e |
|
|
|
546e1e |
G_OBJECT_CLASS(ovirt_storage_domain_parent_class)->dispose(obj);
|
|
|
546e1e |
}
|
|
|
546e1e |
@@ -170,6 +180,11 @@ static gboolean ovirt_storage_domain_init_from_xml(OvirtResource *resource,
|
|
|
546e1e |
.type = OVIRT_TYPE_STORAGE_DOMAIN_STATE,
|
|
|
546e1e |
.xml_path = "status/state",
|
|
|
546e1e |
},
|
|
|
546e1e |
+ { .prop_name = "data-center-ids",
|
|
|
546e1e |
+ .type = G_TYPE_STRV,
|
|
|
546e1e |
+ .xml_path = "data_centers",
|
|
|
546e1e |
+ .xml_attr = "id",
|
|
|
546e1e |
+ },
|
|
|
546e1e |
{ NULL , }
|
|
|
546e1e |
};
|
|
|
546e1e |
|
|
|
546e1e |
@@ -274,6 +289,16 @@ static void ovirt_storage_domain_class_init(OvirtStorageDomainClass *klass)
|
|
|
546e1e |
g_object_class_install_property(object_class,
|
|
|
546e1e |
PROP_STATE,
|
|
|
546e1e |
param_spec);
|
|
|
546e1e |
+
|
|
|
546e1e |
+ param_spec = g_param_spec_boxed("data-center-ids",
|
|
|
546e1e |
+ "Data Center Ids",
|
|
|
546e1e |
+ "Ids of Data Centers for this Storage Domain",
|
|
|
546e1e |
+ G_TYPE_STRV,
|
|
|
546e1e |
+ G_PARAM_READWRITE |
|
|
|
546e1e |
+ G_PARAM_STATIC_STRINGS);
|
|
|
546e1e |
+ g_object_class_install_property(object_class,
|
|
|
546e1e |
+ PROP_DATA_CENTER_IDS,
|
|
|
546e1e |
+ param_spec);
|
|
|
546e1e |
}
|
|
|
546e1e |
|
|
|
546e1e |
static void ovirt_storage_domain_init(OvirtStorageDomain *domain)
|