[libvirt] [libvirt-glib 15/37] Add test for GVirConfigOs

Christophe Fergeau cfergeau at redhat.com
Thu Nov 10 20:33:47 UTC 2011


---
 libvirt-gconfig/tests/test-domain-create.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index a5c5b99..8abca00 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -33,7 +33,6 @@ const char *features[] = { "foo", "bar", "baz", NULL };
 int main(void)
 {
     GVirConfigDomain *domain;
-    GVirConfigClock *klock;
     char *name;
     GStrv feat;
     unsigned int i;
@@ -60,10 +59,28 @@ int main(void)
     }
     g_strfreev(feat);
 
+    /* clock node */
+    GVirConfigClock *klock;
+
     klock = gvir_config_clock_new();
     gvir_config_clock_set_offset(klock, GVIR_CONFIG_CLOCK_UTC);
     gvir_config_domain_set_clock(domain, klock);
 
+    /* os node */
+    GVirConfigOs *os;
+    GList *devices = NULL;
+
+    os = gvir_config_os_new();
+    gvir_config_os_set_os_type(os, GVIR_CONFIG_OS_TYPE_HVM);
+    gvir_config_os_set_arch(os, "x86_64");
+    devices = g_list_append(devices,
+                             GINT_TO_POINTER(GVIR_CONFIG_OS_BOOT_DEVICE_CDROM));
+    devices = g_list_append(devices,
+                            GINT_TO_POINTER(GVIR_CONFIG_OS_BOOT_DEVICE_NETWORK));
+    gvir_config_os_set_boot_devices(os, devices);
+    g_list_free(devices);
+    gvir_config_domain_set_os(domain, os);
+
     xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(domain));
     g_print("%s\n", xml);
     g_free(xml);
-- 
1.7.7




More information about the libvir-list mailing list