[libvirt] [libvirt-glib 37/37] Add test for "console" node creation

Christophe Fergeau cfergeau at redhat.com
Thu Nov 10 20:34:09 UTC 2011


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

diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index ba08a9f..cca3316 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -127,13 +127,30 @@ int main(void)
                                        GVIR_CONFIG_DEVICE_VIDEO_MODEL_QXL);
     devices = g_list_append(devices, GVIR_CONFIG_DEVICE(video));
 
+    /* console node */
+    GVirConfigDeviceChardev *chardev;
+    GVirConfigChardevTargetConsole *console;
+    GVirConfigChardevSourcePty *pty;
 
+    chardev = gvir_config_device_chardev_new();
 
+    pty = gvir_config_chardev_source_pty_new();
+    gvir_config_device_chardev_set_source(chardev,
+                                          GVIR_CONFIG_CHARDEV_SOURCE(pty));
+
+    console = gvir_config_chardev_target_console_new();
+    gvir_config_device_chardev_set_target(chardev,
+                                          GVIR_CONFIG_CHARDEV_TARGET(console));
+    devices = g_list_append(devices, GVIR_CONFIG_DEVICE(chardev));
+
+
+    /* attach devices to domain */
     gvir_config_domain_set_devices(domain, devices);
     g_list_free(devices);
     devices = NULL;
 
 
+
     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