Make adding new attributes easier. --- src/conf/domain_conf.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 99e8a8b..af1c12e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20080,6 +20080,7 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *model = NULL; const char *modelName = NULL; bool pcihole64 = false, pciModel = false, pciTarget = false; + virBuffer driverBuf = VIR_BUFFER_INITIALIZER; if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -20184,26 +20185,26 @@ virDomainControllerDefFormat(virBufferPtr buf, } } - if (def->queues || def->cmd_per_lun || - def->max_sectors || def->ioeventfd || def->iothread) { - virBufferAddLit(buf, "<driver"); - if (def->queues) - virBufferAsprintf(buf, " queues='%u'", def->queues); + if (def->queues) + virBufferAsprintf(&driverBuf, " queues='%u'", def->queues); - if (def->cmd_per_lun) - virBufferAsprintf(buf, " cmd_per_lun='%u'", def->cmd_per_lun); + if (def->cmd_per_lun) + virBufferAsprintf(&driverBuf, " cmd_per_lun='%u'", def->cmd_per_lun); - if (def->max_sectors) - virBufferAsprintf(buf, " max_sectors='%u'", def->max_sectors); + if (def->max_sectors) + virBufferAsprintf(&driverBuf, " max_sectors='%u'", def->max_sectors); - if (def->ioeventfd) { - virBufferAsprintf(buf, " ioeventfd='%s'", - virTristateSwitchTypeToString(def->ioeventfd)); - } + if (def->ioeventfd) { + virBufferAsprintf(&driverBuf, " ioeventfd='%s'", + virTristateSwitchTypeToString(def->ioeventfd)); + } - if (def->iothread) - virBufferAsprintf(buf, " iothread='%u'", def->iothread); + if (def->iothread) + virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); + if (virBufferUse(&driverBuf)) { + virBufferAddLit(buf, "<driver"); + virBufferAddBuffer(buf, &driverBuf); virBufferAddLit(buf, "/>\n"); } -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list