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