[libvirt-glib 3/4] Add gvir_config_domain_timer_[gs]et_present()

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

 



---
 libvirt-gconfig/libvirt-gconfig-domain-timer.c | 26 +++++++++++++++++++++++++-
 libvirt-gconfig/libvirt-gconfig-domain-timer.h |  4 +++-
 libvirt-gconfig/libvirt-gconfig.sym            |  3 +++
 libvirt-gconfig/tests/test-domain-create.c     |  2 ++
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
index e4c68fe..2d778dd 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
@@ -1,7 +1,7 @@
 /*
  * libvirt-gconfig-domain-timer.c: libvirt domain timer configuration
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -73,3 +73,27 @@ gvir_config_domain_timer_get_tick_policy(GVirConfigDomainTimer *timer)
                                                   GVIR_CONFIG_TYPE_DOMAIN_TIMER_TICK_POLICY,
                                                   GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY);
 }
+
+
+void gvir_config_domain_timer_set_present(GVirConfigDomainTimer *timer,
+                                          gboolean present)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_TIMER(timer));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(timer),
+                                               "present",
+                                               G_TYPE_BOOLEAN,
+                                               present,
+                                               NULL);
+}
+
+
+gboolean gvir_config_domain_timer_get_present(GVirConfigDomainTimer *timer)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_TIMER(timer), TRUE);
+
+    return gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(timer),
+                                                    NULL,
+                                                    "present",
+                                                    TRUE);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.h b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
index 677e85f..8c93562 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
@@ -1,7 +1,7 @@
 /*
  * libvirt-gconfig-domain-timer.h: libvirt domain timer configuration
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -67,6 +67,8 @@ GType gvir_config_domain_timer_get_type(void);
 
 GVirConfigDomainTimerTickPolicy gvir_config_domain_timer_get_tick_policy(GVirConfigDomainTimer *timer);
 void gvir_config_domain_timer_set_tick_policy(GVirConfigDomainTimer *timer, GVirConfigDomainTimerTickPolicy policy);
+gboolean gvir_config_domain_timer_get_present(GVirConfigDomainTimer *timer);
+void gvir_config_domain_timer_set_present(GVirConfigDomainTimer *timer, gboolean present);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 9c35f97..a393db3 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -673,6 +673,9 @@ global:
 	gvir_config_domain_interface_get_filterref;
 	gvir_config_domain_interface_set_filterref;
 
+	gvir_config_domain_timer_get_present;
+	gvir_config_domain_timer_set_present;
+
 	gvir_config_domain_set_uuid;
 
 	gvir_config_object_new_from_xml;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index e0d6c00..c973bf5 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -147,6 +147,7 @@ int main(int argc, char **argv)
                                              GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY);
     gvir_config_domain_clock_add_timer(klock, GVIR_CONFIG_DOMAIN_TIMER(pit));
     g_assert(gvir_config_domain_timer_get_tick_policy(GVIR_CONFIG_DOMAIN_TIMER(pit)) == GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_DELAY);
+    g_assert(gvir_config_domain_timer_get_present(GVIR_CONFIG_DOMAIN_TIMER(pit)) != FALSE);
     g_object_unref(G_OBJECT(pit));
 
     rtc = gvir_config_domain_timer_rtc_new();
@@ -154,6 +155,7 @@ int main(int argc, char **argv)
                                              GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_CATCHUP);
     gvir_config_domain_clock_add_timer(klock, GVIR_CONFIG_DOMAIN_TIMER(rtc));
     g_assert(gvir_config_domain_timer_get_tick_policy(GVIR_CONFIG_DOMAIN_TIMER(rtc)) == GVIR_CONFIG_DOMAIN_TIMER_TICK_POLICY_CATCHUP);
+    g_assert(gvir_config_domain_timer_get_present(GVIR_CONFIG_DOMAIN_TIMER(rtc)) != FALSE);
     g_object_unref(G_OBJECT(rtc));
 
     gvir_config_domain_set_clock(domain, klock);
-- 
1.8.4.2

--
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]