mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
conf: qemu: add virtiofs fsdriver type
Introduce a new 'virtiofs' driver type for filesystem. <filesystem type='mount' accessmode='passthrough'> <driver type='virtiofs'/> <source dir='/path'/> <target dir='mount_tag'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </filesystem> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
aecf1f5d70
commit
ecc6ad6b90
@ -3945,6 +3945,11 @@
|
|||||||
<target dir='/import/from/host'/>
|
<target dir='/import/from/host'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<driver type='virtiofs'/>
|
||||||
|
<source dir='/path'/>
|
||||||
|
<target dir='mount_tag'/>
|
||||||
|
</filesystem>
|
||||||
...
|
...
|
||||||
</devices>
|
</devices>
|
||||||
...</pre>
|
...</pre>
|
||||||
@ -3973,6 +3978,9 @@
|
|||||||
while the value <code>immediate</code> means that a host writeback
|
while the value <code>immediate</code> means that a host writeback
|
||||||
is immediately triggered for all pages touched during a guest file
|
is immediately triggered for all pages touched during a guest file
|
||||||
write operation <span class="since">(since 0.9.10)</span>.
|
write operation <span class="since">(since 0.9.10)</span>.
|
||||||
|
<span class="since">Since 6.2.0</span>, <code>type='virtiofs'</code>
|
||||||
|
is also supported. Using virtiofs requires setting up shared memory,
|
||||||
|
see the guide: <a href="kbase/virtiofs.html">Virtio-FS</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>template</code></dt>
|
<dt><code>template</code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
@ -4008,7 +4016,9 @@
|
|||||||
The filesystem element has an optional attribute <code>accessmode</code>
|
The filesystem element has an optional attribute <code>accessmode</code>
|
||||||
which specifies the security mode for accessing the source
|
which specifies the security mode for accessing the source
|
||||||
<span class="since">(since 0.8.5)</span>. Currently this only works
|
<span class="since">(since 0.8.5)</span>. Currently this only works
|
||||||
with <code>type='mount'</code> for the QEMU/KVM driver. The possible
|
with <code>type='mount'</code> for the QEMU/KVM driver.
|
||||||
|
For driver type <code>virtiofs</code>, only <code>passthrough</code> is
|
||||||
|
supported. For other driver types, the possible
|
||||||
values are:
|
values are:
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -2645,6 +2645,12 @@
|
|||||||
</optional>
|
</optional>
|
||||||
<ref name='virtioOptions'/>
|
<ref name='virtioOptions'/>
|
||||||
</group>
|
</group>
|
||||||
|
<group>
|
||||||
|
<attribute name="type">
|
||||||
|
<value>virtiofs</value>
|
||||||
|
</attribute>
|
||||||
|
<ref name='virtioOptions'/>
|
||||||
|
</group>
|
||||||
<empty/>
|
<empty/>
|
||||||
</choice>
|
</choice>
|
||||||
</element>
|
</element>
|
||||||
|
@ -477,6 +477,7 @@ VIR_ENUM_IMPL(virDomainFSDriver,
|
|||||||
"loop",
|
"loop",
|
||||||
"nbd",
|
"nbd",
|
||||||
"ploop",
|
"ploop",
|
||||||
|
"virtiofs",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainFSAccessMode,
|
VIR_ENUM_IMPL(virDomainFSAccessMode,
|
||||||
|
@ -774,6 +774,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
|
VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
|
||||||
VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
|
VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
|
||||||
VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
|
VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
|
||||||
|
VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS,
|
||||||
|
|
||||||
VIR_DOMAIN_FS_DRIVER_TYPE_LAST
|
VIR_DOMAIN_FS_DRIVER_TYPE_LAST
|
||||||
} virDomainFSDriverType;
|
} virDomainFSDriverType;
|
||||||
|
@ -2681,6 +2681,10 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd,
|
|||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
|
||||||
|
/* TODO: vhost-user-fs-pci */
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||||
|
@ -8302,6 +8302,10 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
|
|||||||
_("Filesystem driver type not supported"));
|
_("Filesystem driver type not supported"));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
|
||||||
|
/* TODO: vhost-user-fs-pci */
|
||||||
|
return 0;
|
||||||
|
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
|
||||||
default:
|
default:
|
||||||
virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver);
|
virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver);
|
||||||
|
@ -699,6 +699,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
|
||||||
|
/* vhost-user-fs-pci */
|
||||||
|
return virtioFlags;
|
||||||
|
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||||
|
39
tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
Normal file
39
tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
|
||||||
|
<memory unit='KiB'>14680064</memory>
|
||||||
|
<currentMemory unit='KiB'>14680064</currentMemory>
|
||||||
|
<memoryBacking>
|
||||||
|
<source type='file'/>
|
||||||
|
<access mode='shared'/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<cpu mode='custom' match='exact' check='none'>
|
||||||
|
<model fallback='forbid'>qemu64</model>
|
||||||
|
<numa>
|
||||||
|
<cell id='0' cpus='0-1' memory='14680064' unit='KiB' memAccess='shared'/>
|
||||||
|
</numa>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<controller type='usb' index='0' model='none'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<driver type='virtiofs'/>
|
||||||
|
<source dir='/path'/>
|
||||||
|
<target dir='mount_tag'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</filesystem>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<memballoon model='none'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
74
tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
Normal file
74
tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>guest</name>
|
||||||
|
<uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
|
||||||
|
<memory unit='KiB'>4194304</memory>
|
||||||
|
<currentMemory unit='KiB'>4194304</currentMemory>
|
||||||
|
<memoryBacking>
|
||||||
|
<hugepages>
|
||||||
|
<page size='2048' unit='KiB'/>
|
||||||
|
</hugepages>
|
||||||
|
<access mode='shared'/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='q35'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
<apic/>
|
||||||
|
</features>
|
||||||
|
<cpu mode='custom' match='exact' check='none'>
|
||||||
|
<model fallback='forbid'>qemu64</model>
|
||||||
|
<numa>
|
||||||
|
<cell id='0' cpus='0-1' memory='2097152' unit='KiB' memAccess='shared'/>
|
||||||
|
</numa>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<disk type='file' device='disk'>
|
||||||
|
<driver name='qemu' type='qcow2'/>
|
||||||
|
<source file='/var/lib/libvirt/images/guest.qcow2'/>
|
||||||
|
<target dev='vda' bus='virtio'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='usb' index='0' model='none'/>
|
||||||
|
<controller type='sata' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pcie-root'/>
|
||||||
|
<controller type='pci' index='1' model='pcie-root-port'>
|
||||||
|
<model name='pcie-root-port'/>
|
||||||
|
<target chassis='1' port='0x8'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='2' model='pcie-root-port'>
|
||||||
|
<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-root-port'>
|
||||||
|
<model name='pcie-root-port'/>
|
||||||
|
<target chassis='3' port='0xa'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='4' model='pcie-root-port'>
|
||||||
|
<model name='pcie-root-port'/>
|
||||||
|
<target chassis='4' port='0xb'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
|
||||||
|
</controller>
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<driver type='virtiofs'/>
|
||||||
|
<source dir='/path'/>
|
||||||
|
<target dir='mount_tag'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||||
|
</filesystem>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<memballoon model='none'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1 @@
|
|||||||
|
../qemuxml2argvdata/vhost-user-fs-fd-memory.xml
|
@ -0,0 +1 @@
|
|||||||
|
../qemuxml2argvdata/vhost-user-fs-hugepages.xml
|
@ -1434,6 +1434,9 @@ mymain(void)
|
|||||||
DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK,
|
DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK,
|
||||||
QEMU_CAPS_CCW);
|
QEMU_CAPS_CCW);
|
||||||
|
|
||||||
|
DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory");
|
||||||
|
DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages");
|
||||||
|
|
||||||
DO_TEST("riscv64-virt",
|
DO_TEST("riscv64-virt",
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
|
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
|
||||||
DO_TEST("riscv64-virt-pci",
|
DO_TEST("riscv64-virt-pci",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user