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

[libvirt] [libvirt-designer 2/3] Accept 'iso' format in gvir_designer_domain_add_disk_full()



We need this to be able to mark the device we are creating as a
CDROM.
---
 examples/virtxml.c                         | 2 +-
 libvirt-designer/libvirt-designer-domain.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/virtxml.c b/examples/virtxml.c
index d4a5fe2..9a36142 100644
--- a/examples/virtxml.c
+++ b/examples/virtxml.c
@@ -712,7 +712,7 @@ Domain with Fedora 17 from locally stored ISO and one NIC with mac
 
 To add multiple devices just use appropriate argument multiple times:
 
-  # virtxml -d /tmp/Fedora-17-x86_64-Live-KDE.iso,raw \
+  # virtxml -d /tmp/Fedora-17-x86_64-Live-KDE.iso,iso \
             -d /var/lib/libvirt/images/f17.img,qcow2 \
             -i default,mac=00:11:22:33:44:55,link=down \
             -i blue_network \
diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c
index 0d47d3c..5da8dd3 100644
--- a/libvirt-designer/libvirt-designer-domain.c
+++ b/libvirt-designer/libvirt-designer-domain.c
@@ -894,6 +894,14 @@ gvir_designer_domain_add_disk_full(GVirDesignerDomain *design,
     gvir_config_domain_disk_set_type(disk, type);
     gvir_config_domain_disk_set_source(disk, path);
     gvir_config_domain_disk_set_driver_name(disk, driver_name);
+    if (g_strcmp0(format, "iso") == 0) {
+        /* FIXME: Should probably reorder the disk devices so that floppies
+         * go first, then disks, then CDROMs
+         */
+        gvir_config_domain_disk_set_guest_device_type(disk,
+                                                      GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM);
+        format = "raw";
+    }
     if (format)
         gvir_config_domain_disk_set_driver_type(disk, format);
     if (g_str_equal(bus_str, "ide")) {
-- 
1.8.1.4


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