Add virtio-related options to controllers

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

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Ján Tomko 2016-06-06 16:50:22 +02:00
parent 1bc2cb3b32
commit c85217cf8a
5 changed files with 20 additions and 0 deletions

View File

@ -3600,6 +3600,12 @@
<code>iothread</code> value. The <code>iothread</code> value <code>iothread</code> value. The <code>iothread</code> value
must be within the range 1 to the domain iothreads value. must be within the range 1 to the domain iothreads value.
</dd> </dd>
<dt>virtio options</dt>
<dd>
For virtio controllers,
<a href="#elementsVirtio">Virtio-specific options</a> can also be
set. (<span class="since">Since 3.5.0</span>)
</dd>
</dl> </dl>
<p> <p>
USB companion controllers have an optional USB companion controllers have an optional

View File

@ -2073,6 +2073,7 @@
<optional> <optional>
<ref name="driverIOThread"/> <ref name="driverIOThread"/>
</optional> </optional>
<ref name="virtioOptions"/>
</element> </element>
</optional> </optional>
</interleave> </interleave>

View File

@ -1886,6 +1886,7 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def)
return; return;
virDomainDeviceInfoClear(&def->info); virDomainDeviceInfoClear(&def->info);
VIR_FREE(def->virtio);
VIR_FREE(def); VIR_FREE(def);
} }
@ -9064,6 +9065,9 @@ virDomainControllerDefParseXML(xmlNodePtr node,
cur = cur->next; cur = cur->next;
} }
if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
goto error;
/* node is parsed differently from target attributes because /* node is parsed differently from target attributes because
* someone thought it should be a subelement instead... * someone thought it should be a subelement instead...
*/ */
@ -19240,6 +19244,10 @@ virDomainControllerDefCheckABIStability(virDomainControllerDefPtr src,
} }
} }
if (src->virtio && dst->virtio &&
!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
return false; return false;
@ -21557,6 +21565,8 @@ virDomainControllerDriverFormat(virBufferPtr buf,
if (def->iothread) if (def->iothread)
virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
if (virBufferUse(&driverBuf)) { if (virBufferUse(&driverBuf)) {
virBufferAddLit(buf, "<driver"); virBufferAddLit(buf, "<driver");
virBufferAddBuffer(buf, &driverBuf); virBufferAddBuffer(buf, &driverBuf);

View File

@ -813,6 +813,7 @@ struct _virDomainControllerDef {
virDomainUSBControllerOpts usbopts; virDomainUSBControllerOpts usbopts;
} opts; } opts;
virDomainDeviceInfo info; virDomainDeviceInfo info;
virDomainVirtioOptionsPtr virtio;
}; };

View File

@ -27,10 +27,12 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller> </controller>
<controller type='scsi' index='0' model='virtio-scsi'> <controller type='scsi' index='0' model='virtio-scsi'>
<driver iommu='on' ats='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</controller> </controller>
<controller type='pci' index='0' model='pci-root'/> <controller type='pci' index='0' model='pci-root'/>
<controller type='virtio-serial' index='0'> <controller type='virtio-serial' index='0'>
<driver iommu='on' ats='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</controller> </controller>
<filesystem type='mount' accessmode='passthrough'> <filesystem type='mount' accessmode='passthrough'>