conf: Correctly format controller's driver

https://bugzilla.redhat.com/show_bug.cgi?id=1179684

The way that we currently generate the <driver/> for <controller/> is
just madness:

    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='12'/>
      <driver cmd_per_lun='123'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>

It's obvious that we should be aiming at the following:

    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='12' cmd_per_lun='123'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>

Signed-off-by: Luyao Huang <lhuang@redhat.com>
This commit is contained in:
Luyao Huang 2015-01-07 18:39:37 +08:00 committed by Michal Privoznik
parent 1390c26847
commit 97fac17c77
1 changed files with 11 additions and 6 deletions

View File

@ -17120,14 +17120,19 @@ virDomainControllerDefFormat(virBufferPtr buf,
virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (def->queues)
virBufferAsprintf(buf, "<driver queues='%u'/>\n", def->queues);
if (def->cmd_per_lun)
virBufferAsprintf(buf, "<driver cmd_per_lun='%u'/>\n", def->cmd_per_lun);
if (def->queues || def->cmd_per_lun || def->max_sectors) {
virBufferAddLit(buf, "<driver");
if (def->queues)
virBufferAsprintf(buf, " queues='%u'", def->queues);
if (def->max_sectors)
virBufferAsprintf(buf, "<driver max_sectors='%u'/>\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)