[libgovirt] storage_domain: Add support for storage/type tag
- From: Eduardo de Barros Lima <eblima src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] storage_domain: Add support for storage/type tag
- Date: Wed, 24 Feb 2021 13:11:28 +0000 (UTC)
commit 308ed3c073d33f460a6caf7ac615913924a5f730
Author: Eduardo Lima (Etrunko) <etrunko redhat com>
Date: Thu Jan 14 15:40:17 2021 -0300
storage_domain: Add support for storage/type tag
Signed-off-by: Eduardo Lima (Etrunko) <etrunko redhat com>
govirt/govirt.sym | 1 +
govirt/ovirt-storage-domain.c | 31 +++++++++++++++++++++++++++----
govirt/ovirt-storage-domain.h | 12 ++++++++++++
3 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/govirt/govirt.sym b/govirt/govirt.sym
index 4cd6bb8..bf6a83e 100644
--- a/govirt/govirt.sym
+++ b/govirt/govirt.sym
@@ -148,5 +148,6 @@ GOVIRT_0.4.1 {
ovirt_disk_new;
ovirt_storage_domain_get_disks;
+ ovirt_storage_domain_storage_type_get_type;
} 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 d02c3d5..ae828e1 100644
--- a/govirt/ovirt-storage-domain.c
+++ b/govirt/ovirt-storage-domain.c
@@ -40,13 +40,14 @@ struct _OvirtStorageDomainPrivate {
guint64 committed;
OvirtStorageDomainFormatVersion version;
OvirtStorageDomainState state;
+ OvirtStorageDomainStorageType storage_type;
};
G_DEFINE_TYPE_WITH_PRIVATE(OvirtStorageDomain, ovirt_storage_domain, OVIRT_TYPE_RESOURCE);
enum {
PROP_0,
- PROP_STORAGE_TYPE,
+ PROP_TYPE,
PROP_MASTER,
PROP_AVAILABLE,
PROP_USED,
@@ -56,6 +57,7 @@ enum {
PROP_DATA_CENTER_IDS,
PROP_DATA_CENTER_HREF,
PROP_DATA_CENTER_ID,
+ PROP_STORAGE_TYPE,
};
static char *ensure_href_from_id(const char *id,
@@ -83,7 +85,7 @@ static void ovirt_storage_domain_get_property(GObject *object,
OvirtStorageDomain *domain = OVIRT_STORAGE_DOMAIN(object);
switch (prop_id) {
- case PROP_STORAGE_TYPE:
+ case PROP_TYPE:
g_value_set_enum(value, domain->priv->type);
break;
case PROP_MASTER:
@@ -113,6 +115,9 @@ static void ovirt_storage_domain_get_property(GObject *object,
case PROP_DATA_CENTER_ID:
g_value_set_string(value, domain->priv->data_center_id);
break;
+ case PROP_STORAGE_TYPE:
+ g_value_set_enum(value, domain->priv->storage_type);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -127,7 +132,7 @@ static void ovirt_storage_domain_set_property(GObject *object,
OvirtStorageDomain *domain = OVIRT_STORAGE_DOMAIN(object);
switch (prop_id) {
- case PROP_STORAGE_TYPE:
+ case PROP_TYPE:
domain->priv->type = g_value_get_enum(value);
break;
case PROP_MASTER:
@@ -160,6 +165,9 @@ static void ovirt_storage_domain_set_property(GObject *object,
g_free(domain->priv->data_center_id);
domain->priv->data_center_id = g_value_dup_string(value);
break;
+ case PROP_STORAGE_TYPE:
+ domain->priv->storage_type = g_value_get_enum(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -222,6 +230,9 @@ static gboolean ovirt_storage_domain_init_from_xml(OvirtResource *resource,
.xml_path = "data_center",
.xml_attr = "id",
},
+ { .prop_name = "storage-type",
+ .xml_path = "storage/type",
+ },
{ NULL , }
};
@@ -254,7 +265,7 @@ static void ovirt_storage_domain_class_init(OvirtStorageDomainClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_property(object_class,
- PROP_STORAGE_TYPE,
+ PROP_TYPE,
param_spec);
param_spec = g_param_spec_boolean("master",
@@ -354,6 +365,18 @@ static void ovirt_storage_domain_class_init(OvirtStorageDomainClass *klass)
g_object_class_install_property(object_class,
PROP_DATA_CENTER_ID,
param_spec);
+
+ param_spec = g_param_spec_enum("storage-type",
+ "Host Storage Type",
+ "Type of the storage domain host storage",
+ OVIRT_TYPE_STORAGE_DOMAIN_STORAGE_TYPE,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_NFS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(object_class,
+ PROP_STORAGE_TYPE,
+ param_spec);
+
}
static void ovirt_storage_domain_init(OvirtStorageDomain *domain)
diff --git a/govirt/ovirt-storage-domain.h b/govirt/ovirt-storage-domain.h
index 97cfb06..a83bc14 100644
--- a/govirt/ovirt-storage-domain.h
+++ b/govirt/ovirt-storage-domain.h
@@ -62,6 +62,18 @@ typedef enum {
OVIRT_STORAGE_DOMAIN_TYPE_IMAGE,
} OvirtStorageDomainType;
+typedef enum {
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_CINDER,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_FCP,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_GLANCE,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_GLUSTERFS,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_ISCSI,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_LOCALFS,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_MANAGED_BLOCK_STORAGE,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_NFS,
+ OVIRT_STORAGE_DOMAIN_STORAGE_TYPE_POSIXFS,
+} OvirtStorageDomainStorageType;
+
typedef struct _OvirtStorageDomainPrivate OvirtStorageDomainPrivate;
typedef struct _OvirtStorageDomainClass OvirtStorageDomainClass;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]