[PATCH glib] Add support for reading/writing UUID attribute in domain config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 libvirt-gconfig/libvirt-gconfig-domain.c | 33 ++++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index eb97cd5..3c28a4a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -39,6 +39,7 @@ G_DEFINE_TYPE(GVirConfigDomain, gvir_config_domain, GVIR_CONFIG_TYPE_OBJECT);
 enum {
     PROP_0,
     PROP_NAME,
+    PROP_UUID,
     PROP_TITLE,
     PROP_DESCRIPTION,
     PROP_MEMORY,
@@ -58,6 +59,9 @@ static void gvir_config_domain_get_property(GObject *object,
     case PROP_NAME:
         g_value_set_string(value, gvir_config_domain_get_name(domain));
         break;
+    case PROP_UUID:
+        g_value_set_string(value, gvir_config_domain_get_uuid(domain));
+        break;
     case PROP_TITLE:
         g_value_set_string(value, gvir_config_domain_get_title(domain));
         break;
@@ -93,6 +97,9 @@ static void gvir_config_domain_set_property(GObject *object,
     case PROP_NAME:
         gvir_config_domain_set_name(domain, g_value_get_string(value));
         break;
+    case PROP_UUID:
+        gvir_config_domain_set_uuid(domain, g_value_get_string(value));
+        break;
     case PROP_TITLE:
         gvir_config_domain_set_title(domain, g_value_get_string(value));
         break;
@@ -135,6 +142,14 @@ static void gvir_config_domain_class_init(GVirConfigDomainClass *klass)
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_STATIC_STRINGS));
     g_object_class_install_property(object_class,
+                                    PROP_UUID,
+                                    g_param_spec_string("uuid",
+                                                        "UUID",
+                                                        "Domain UUID",
+                                                        NULL,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
                                     PROP_TITLE,
                                     g_param_spec_string("title",
                                                         "Title",
@@ -247,6 +262,12 @@ const char *gvir_config_domain_get_name(GVirConfigDomain *domain)
                                                "name");
 }
 
+const char *gvir_config_domain_get_uuid(GVirConfigDomain *domain)
+{
+    return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
+                                               "uuid");
+}
+
 const char *gvir_config_domain_get_title(GVirConfigDomain *domain)
 {
     return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
@@ -266,6 +287,18 @@ void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
 }
 
 /**
+ * gvir_config_domain_set_uuid:
+ * @domain: a #GVirConfigDomain
+ * @uuid: (allow-none):
+ */
+void gvir_config_domain_set_uuid(GVirConfigDomain *domain, const char *uuid)
+{
+    gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
+                                        "uuid", uuid);
+    g_object_notify(G_OBJECT(domain), "uuid");
+}
+
+/**
  * gvir_config_domain_set_title:
  * @domain: a #GVirConfigDomain
  * @title: (allow-none): title of the domain
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 4951cf1..6e85374 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -105,6 +105,8 @@ GVirConfigDomainVirtType gvir_config_domain_get_virt_type(GVirConfigDomain *doma
 void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type);
 const char *gvir_config_domain_get_name(GVirConfigDomain *domain);
 void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name);
+const char *gvir_config_domain_get_uuid(GVirConfigDomain *domain);
+void gvir_config_domain_set_uuid(GVirConfigDomain *domain, const char *uuid);
 const char *gvir_config_domain_get_description(GVirConfigDomain *domain);
 void gvir_config_domain_set_description(GVirConfigDomain *domain, const char *description);
 guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain);
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]