qemu: Support filesystem model=virtio-{non-}transitional

Add <filesystem> model handling for virtio transitional devices. Ex:

  <filesystem type='mount' model='virtio-transitional'>
    ...
  </filesystem

* "virtio-transitional" maps to qemu "virtio-9p-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-9p-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-01-17 12:52:37 -05:00
parent 947448e212
commit 62eef965ba
7 changed files with 46 additions and 34 deletions

View File

@ -497,8 +497,12 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
has_ntmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL; has_ntmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL;
break; break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_FS:
has_tmodel = device.data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL;
has_ntmodel = device.data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_VIDEO:

View File

@ -678,7 +678,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_FS:
/* the only type of filesystem so far is virtio-9p-pci */ /* the only type of filesystem so far is virtio-9p-pci */
switch ((virDomainFSModel) dev->data.fs->model) {
case VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL:
/* Transitional devices only work in conventional PCI slots */
return pciFlags;
case VIR_DOMAIN_FS_MODEL_VIRTIO:
case VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL:
case VIR_DOMAIN_FS_MODEL_DEFAULT:
return virtioFlags; return virtioFlags;
case VIR_DOMAIN_FS_MODEL_LAST:
break;
}
return 0;
case VIR_DOMAIN_DEVICE_NET: { case VIR_DOMAIN_DEVICE_NET: {
virDomainNetDefPtr net = dev->data.net; virDomainNetDefPtr net = dev->data.net;

View File

@ -34,7 +34,8 @@ addr=0x1 \
-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -device virtio-9p-pci,disable-legacy=on,disable-modern=off,id=fs0,\
fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \ -netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \

View File

@ -34,7 +34,8 @@ addr=0x1 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \ -netdev user,id=hostnet0 \
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \

View File

@ -25,22 +25,22 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=on \ -boot strict=on \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \ addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=off,disable-modern=off,scsi=off,\ -device virtio-blk-pci,disable-legacy=off,disable-modern=off,scsi=off,\
bus=pci.3,addr=0x2,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ bus=pci.2,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ -device virtio-9p-pci,disable-legacy=off,disable-modern=off,id=fs0,\
fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \ -netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=off,disable-modern=off,netdev=hostnet0,\ -device virtio-net-pci,disable-legacy=off,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.3,addr=0x1 \ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device vhost-scsi-pci,disable-legacy=off,disable-modern=off,\ -device vhost-scsi-pci,disable-legacy=off,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x3 \ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.2,addr=0x4 \
-object rng-random,id=objrng0,filename=/dev/urandom \ -object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,disable-legacy=off,disable-modern=off,rng=objrng0,\ -device virtio-rng-pci,disable-legacy=off,disable-modern=off,rng=objrng0,\
id=rng0,bus=pci.3,addr=0x4 \ id=rng0,bus=pci.2,addr=0x5 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \ resourcecontrol=deny \
-msg timestamp=on -msg timestamp=on

View File

@ -25,21 +25,21 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=on \ -boot strict=on \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \ addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.3,addr=0x2,\ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ -device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \ -netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.3,addr=0x1 \ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.3,addr=0x3 \ id=hostdev0,bus=pci.2,addr=0x4 \
-object rng-random,id=objrng0,filename=/dev/urandom \ -object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \ -device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \ resourcecontrol=deny \
-msg timestamp=on -msg timestamp=on

View File

@ -18,7 +18,7 @@
<driver name='qemu' type='raw'/> <driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='vda' bus='virtio'/> <target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
</disk> </disk>
<controller type='usb' index='0' model='none'/> <controller type='usb' index='0' model='none'/>
<controller type='sata' index='0'> <controller type='sata' index='0'>
@ -30,40 +30,35 @@
<target chassis='1' port='0x8'/> <target chassis='1' port='0x8'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
</controller> </controller>
<controller type='pci' index='2' model='pcie-root-port'> <controller type='pci' index='2' model='pcie-to-pci-bridge'>
<model name='pcie-root-port'/>
<target chassis='2' port='0x9'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='pci' index='3' model='pcie-to-pci-bridge'>
<model name='pcie-pci-bridge'/> <model name='pcie-pci-bridge'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</controller> </controller>
<controller type='pci' index='4' model='pcie-root-port'> <controller type='pci' index='3' model='pcie-root-port'>
<model name='pcie-root-port'/> <model name='pcie-root-port'/>
<target chassis='4' port='0xa'/> <target chassis='3' port='0x9'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller> </controller>
<filesystem type='mount' accessmode='passthrough' model='virtio-transitional'> <filesystem type='mount' accessmode='passthrough' model='virtio-transitional'>
<source dir='/export/fs1'/> <source dir='/export/fs1'/>
<target dir='fs1'/> <target dir='fs1'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
</filesystem> </filesystem>
<interface type='user'> <interface type='user'>
<mac address='00:11:22:33:44:55'/> <mac address='00:11:22:33:44:55'/>
<model type='virtio-transitional'/> <model type='virtio-transitional'/>
<address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
</interface> </interface>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/> <input type='keyboard' bus='ps2'/>
<hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'> <hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'>
<source protocol='vhost' wwpn='naa.5123456789abcde0'/> <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
<address type='pci' domain='0x0000' bus='0x03' slot='0x03' function='0x0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
</hostdev> </hostdev>
<memballoon model='none'/> <memballoon model='none'/>
<rng model='virtio-transitional'> <rng model='virtio-transitional'>
<backend model='random'>/dev/urandom</backend> <backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x03' slot='0x04' function='0x0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
</rng> </rng>
</devices> </devices>
</domain> </domain>