Libvirt provides domain capabilities where supported disk bus types are listed. Virt-manager should try to get those bus types. The old code remains as fallback if domain capabilities doesn't contain the disk bus types. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1387218 Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- virtManager/addhardware.py | 49 +++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index aab90957..e63ad3d0 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -690,25 +690,38 @@ class vmmAddHardware(vmmGObjectUI): @staticmethod def populate_disk_bus_combo(vm, devtype, model): + # try to get supported disk bus types from domain capabilities + domcaps = vm.get_domain_capabilities() + disk_bus_types = None + if "bus" in domcaps.devices.disk.enum_names(): + disk_bus_types = domcaps.devices.disk.get_enum("bus").get_values() + + # if there are no disk bus types in domain capabilities fallback to + # old code + if not disk_bus_types: + disk_bus_types = [] + if vm.is_hvm(): + if not vm.get_xmlobj().os.is_q35(): + disk_bus_types.append("ide") + disk_bus_types.append("sata") + disk_bus_types.append("fdc") + + if not vm.stable_defaults(): + disk_bus_types.append("scsi") + disk_bus_types.append("usb") + + if vm.get_hv_type() in ["qemu", "kvm", "test"]: + disk_bus_types.append("sd") + disk_bus_types.append("virtio") + if "scsi" not in disk_bus_types: + disk_bus_types.append("scsi") + + if vm.conn.is_xen() or vm.conn.is_test_conn(): + disk_bus_types.append("xen") + rows = [] - if vm.is_hvm(): - if not vm.get_xmlobj().os.is_q35(): - rows.append(["ide", "IDE"]) - rows.append(["sata", "SATA"]) - rows.append(["fdc", _("Floppy")]) - - if not vm.stable_defaults(): - rows.append(["scsi", "SCSI"]) - rows.append(["usb", "USB"]) - - if vm.get_hv_type() in ["qemu", "kvm", "test"]: - rows.append(["sd", "SD"]) - rows.append(["virtio", "VirtIO"]) - if not rows.count(["scsi", "SCSI"]): - rows.append(["scsi", "SCSI"]) - - if vm.conn.is_xen() or vm.conn.is_test_conn(): - rows.append(["xen", "Xen"]) + for bus in disk_bus_types: + rows.append([bus, virtinst.VirtualDisk.pretty_disk_bus(bus)]) model.clear() -- 2.11.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list