and virtio disks can be advertised as PCI bus devices. --- libvirt-designer/libvirt-designer-domain.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index 0411da4..4046d8c 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -688,6 +688,9 @@ gvir_designer_domain_get_supported_disk_bus_types(GVirDesignerDomain *design) dev_list = osinfo_os_get_devices_by_property(priv->os, "class", "block", TRUE); + if (!dev_list) + goto cleanup; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(dev_list)); i++) { OsinfoDevice *dev = OSINFO_DEVICE(osinfo_list_get_nth(OSINFO_LIST(dev_list), i)); const gchar *bus = osinfo_device_get_bus_type(dev); @@ -699,6 +702,7 @@ gvir_designer_domain_get_supported_disk_bus_types(GVirDesignerDomain *design) ret = g_hash_table_get_keys(bus_hash); ret = g_list_copy(ret); +cleanup: g_hash_table_destroy(bus_hash); return ret; } @@ -811,18 +815,23 @@ gvir_designer_domain_add_disk_full(GVirDesignerDomain *design, goto error; item = g_list_first(bus_str_list); - bus_str_list = item->data; + bus_str = item->data; + if (!bus_str) + goto error; } + g_clear_error(error); disk = gvir_config_domain_disk_new(); gvir_config_domain_disk_set_type(disk, type); gvir_config_domain_disk_set_source(disk, path); gvir_config_domain_disk_set_driver_name(disk, "qemu"); - gvir_config_domain_disk_set_driver_type(disk, format); + if (format) + gvir_config_domain_disk_set_driver_type(disk, format); if (g_str_equal(bus_str, "ide")) { bus = GVIR_CONFIG_DOMAIN_DISK_BUS_IDE; - } else if (g_str_equal(bus_str, "virtio")) { + } else if (g_str_equal(bus_str, "virtio") || + g_str_equal(bus_str, "pci")) { bus = GVIR_CONFIG_DOMAIN_DISK_BUS_VIRTIO; } else if (g_str_equal(bus_str, "sata")) { bus = GVIR_CONFIG_DOMAIN_DISK_BUS_SATA; -- 1.7.8.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list