Adding disk_address_type option. (#954)

This patch allows to specify the virtio-mmio address type, which is
needed for debian guests on virt machines that don't support the PCI
address type.

See also 
https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
where it is explicitly said to use `virtio-blk-device` and
`virtio-net-device` instead of `virtio-blk-pci` and `virtio-net-pci`, for
that reason.

Apparently, libvirt will use the `virtio-blk-pci` and `virtio-net-pci`
by default. By setting address type to `virtio-mmio`, it uses
`virtio-blk-device` instead. It seems not necessary to do the same for
the network controller, since libvirt will also use `virtio-net-device`
if the disk address type is set to `virtio-mmio`.

While this should help with ARM machines, it won't solve all issues
as some machines will boot perfectly with the existing defaults
provided the correct loader binary is used.

Relates-to: #1608
This commit is contained in:
Bram de Greve
2022-11-14 13:52:22 +01:00
committed by GitHub
parent df41f6f037
commit 6c4b7758aa
7 changed files with 36 additions and 2 deletions

View File

@@ -58,24 +58,35 @@
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test.qcow2'/>
<target dev='vda' bus='ide'/>
<address type='virtio-mmio'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-box-volume-1'/>
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test2.qcow2'/>
<target dev='vdb' bus='ide'/>
<address type='virtio-mmio'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-disk-volume-0'/>
<driver name='qemu' type='qcow2' cache='default'/>
<source file='/var/lib/libvirt/images/test-disk1.qcow2'/>
<target dev='vdc' bus='virtio'/>
<address type='virtio-mmio'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-disk-volume-1'/>
<driver name='qemu' type='qcow2' cache='default' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test-disk2.qcow2'/>
<target dev='vdd' bus='virtio'/>
<address type='virtio-mmio'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-disk-volume-2'/>
<driver name='qemu' type='qcow2' cache='default'/>
<source file='/var/lib/libvirt/images/test-disk3.qcow2'/>
<target dev='vde' bus='virtio'/>
<address type='pci'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw' />

View File

@@ -80,9 +80,11 @@ describe 'templates/domain' do
domain.instance_variable_set('@domain_volume_cache', 'deprecated')
domain.disk_bus = 'ide'
domain.disk_device = 'vda'
domain.disk_address_type = 'virtio-mmio'
domain.disk_driver(:cache => 'unsafe', :io => 'threads', :copy_on_read => 'on', :discard => 'unmap', :detect_zeroes => 'on')
domain.storage(:file, path: 'test-disk1.qcow2')
domain.storage(:file, path: 'test-disk2.qcow2', io: 'threads', copy_on_read: 'on', discard: 'unmap', detect_zeroes: 'on')
domain.storage(:file, path: 'test-disk3.qcow2', address_type: 'pci')
domain.storage(:file, device: :floppy)
domain.storage(:file, device: :cdrom)
domain.storage(:file, device: :cdrom)
@@ -141,12 +143,14 @@ describe 'templates/domain' do
domain.domain_volumes.push({
:cache => 'unsafe',
:bus => domain.disk_bus,
:absolute_path => '/var/lib/libvirt/images/test.qcow2'
:absolute_path => '/var/lib/libvirt/images/test.qcow2',
:address_type => 'virtio-mmio',
})
domain.domain_volumes.push({
:cache => 'unsafe',
:bus => domain.disk_bus,
:absolute_path => '/var/lib/libvirt/images/test2.qcow2'
:absolute_path => '/var/lib/libvirt/images/test2.qcow2',
:address_type => 'virtio-mmio',
})
resolve