Move code from 3 conditional blocks into one. --- src/qemu/qemu_command.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 455cb7ae36..df3c14d627 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1653,16 +1653,12 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0) goto error; - if (emitDeviceSyntax) - virBufferAddLit(&opt, "if=none"); - else - virBufferAsprintf(&opt, "if=%s", - virDomainDiskQEMUBusTypeToString(disk->bus)); - if (emitDeviceSyntax) { char *drivealias = qemuAliasFromDisk(disk); if (!drivealias) goto error; + + virBufferAddLit(&opt, "if=none"); virBufferAsprintf(&opt, ",id=%s", drivealias); VIR_FREE(drivealias); } else { @@ -1673,11 +1669,11 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, _("unsupported disk type '%s'"), disk->dst); goto error; } + virBufferAsprintf(&opt, "if=%s", + virDomainDiskQEMUBusTypeToString(disk->bus)); virBufferAsprintf(&opt, ",index=%d", idx); - } - - if (!emitDeviceSyntax) qemuBuildDiskFrontendAttributes(disk, qemuCaps, &opt); + } if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list