From: Luyao Huang Date: Wed, 7 Jan 2015 10:39:37 +0000 (+0800) Subject: conf: Correctly format controller's driver X-Git-Tag: v1.2.12-rc1~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97fac17c77d9bdfacafff1c5c39b2df3c1530614;p=thirdparty%2Flibvirt.git conf: Correctly format controller's driver https://bugzilla.redhat.com/show_bug.cgi?id=1179684 The way that we currently generate the for is just madness:
It's obvious that we should be aiming at the following:
Signed-off-by: Luyao Huang --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d1a483add0..57e99e6782 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17120,14 +17120,19 @@ virDomainControllerDefFormat(virBufferPtr buf, virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - if (def->queues) - virBufferAsprintf(buf, "\n", def->queues); - if (def->cmd_per_lun) - virBufferAsprintf(buf, "\n", def->cmd_per_lun); + if (def->queues || def->cmd_per_lun || def->max_sectors) { + virBufferAddLit(buf, "queues) + virBufferAsprintf(buf, " queues='%u'", def->queues); - if (def->max_sectors) - virBufferAsprintf(buf, "\n", def->max_sectors); + if (def->cmd_per_lun) + virBufferAsprintf(buf, " cmd_per_lun='%u'", def->cmd_per_lun); + + if (def->max_sectors) + virBufferAsprintf(buf, " max_sectors='%u'", def->max_sectors); + virBufferAddLit(buf, "/>\n"); + } if (virDomainDeviceInfoIsSet(&def->info, flags) && virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)