[libvirt-glib PATCHv3 18/27] Add test for adding a disk device

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

 



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

diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 6e59f6f..38a7fb9 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -80,8 +80,27 @@ int main(void)
                             GINT_TO_POINTER(GVIR_CONFIG_DOMAIN_OS_BOOT_DEVICE_NETWORK));
     gvir_config_domain_os_set_boot_devices(os, devices);
     g_list_free(devices);
+    devices = NULL;
     gvir_config_domain_set_os(domain, os);
 
+    /* disk node */
+    GVirConfigDomainDisk *disk;
+
+    disk = gvir_config_domain_disk_new();
+    gvir_config_domain_disk_set_type(disk, GVIR_CONFIG_DOMAIN_DISK_FILE);
+    gvir_config_domain_disk_set_guest_device_type(disk, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK);
+    gvir_config_domain_disk_set_source(disk, "/tmp/foo/bar");
+    gvir_config_domain_disk_set_driver_name(disk, "qemu");
+    gvir_config_domain_disk_set_driver_type(disk, "qcow2");
+    gvir_config_domain_disk_set_target_bus(disk, "ide");
+    gvir_config_domain_disk_set_target_dev(disk, "hda");
+
+    devices = g_list_append(devices, disk);
+    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.3

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