fs: Update mount command to mount virtiofs filesystem

With latest kernel, virtio-fs mount command has been simplified, and
this needs to be applied everywhere in our tests and documentation.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-01-02 19:04:48 +01:00
parent e1822cfdad
commit 143471b739
3 changed files with 11 additions and 14 deletions

View File

@ -60,7 +60,7 @@ Assuming you have `clear-kvm.img` and `custom-vmlinux.bin` on your system, here
--disk path=clear-kvm.img \
--kernel custom-vmlinux.bin \
--cmdline "console=ttyS0 reboot=k panic=1 nomodules root=/dev/vda3" \
--fs tag=virtiofs,sock=/tmp/virtiofs,num_queues=1,queue_size=512
--fs tag=myfs,sock=/tmp/virtiofs,num_queues=1,queue_size=512
```
By default, DAX is enabled with a cache window of 8GiB. You can specify a custom size (let's say 4GiB for this example) for the cache by explicitly setting DAX and the cache size:
@ -78,13 +78,11 @@ In case you don't want to use a shared window of cache to pass the shared files
```
### Mount the shared directory
The last step is to mount the shared directory inside the guest, using the `virtio_fs` filesystem type.
The last step is to mount the shared directory inside the guest, using the `virtiofs` filesystem type.
```bash
mkdir mount_dir
mount \
-t virtio_fs virtiofs mount_dir/ \
-o rootmode=040000,user_id=0,group_id=0,dax
mount -t virtiofs -o dax myfs mount_dir/
```
The `tag` needs to be consistent with what has been provided through the __cloud-hypervisor__ command line, which happens to be `virtiofs` in this example.
The `tag` needs to be consistent with what has been provided through the __cloud-hypervisor__ command line, which happens to be `myfs` in this example.
The `dax` option must be removed in case the shared cache region is not enabled from the VMM.
The `-o dax` option must be removed in case the shared cache region is not enabled from the VMM.

View File

@ -2823,7 +2823,7 @@ mod tests {
let mut kernel_path = workload_path;
kernel_path.push("vmlinux");
let (dax_vmm_param, dax_mount_param) = if dax { ("on", ",dax") } else { ("off", "") };
let (dax_vmm_param, dax_mount_param) = if dax { ("on", "-o dax") } else { ("off", "") };
let cache_size_vmm_param = if let Some(cache) = cache_size {
format!(",cache_size={}", cache)
} else {
@ -2857,7 +2857,7 @@ mod tests {
.args(&[
"--fs",
format!(
"tag=virtiofs,sock={},num_queues=1,queue_size=1024,dax={}{}",
"tag=myfs,sock={},num_queues=1,queue_size=1024,dax={}{}",
virtiofsd_socket_path, dax_vmm_param, cache_size_vmm_param
)
.as_str(),
@ -2878,8 +2878,7 @@ mod tests {
// Mount shared directory through virtio_fs filesystem
let mount_cmd = format!(
"mkdir -p mount_dir && \
sudo mount -t virtio_fs virtiofs mount_dir/ -o \
rootmode=040000,user_id=1001,group_id=1001{} && \
sudo mount -t virtiofs {} myfs mount_dir/ && \
echo ok",
dax_mount_param
);
@ -3546,7 +3545,7 @@ mod tests {
.args(&[
"--fs",
format!(
"tag=virtiofs,sock={},num_queues=1,queue_size=1024,dax=on",
"tag=myfs,sock={},num_queues=1,queue_size=1024,dax=on",
virtiofsd_socket_path,
)
.as_str(),

View File

@ -58,10 +58,10 @@ write_files:
content: |
#!/bin/bash
mount -t virtio_fs virtiofs /mnt -o rootmode=040000,user_id=0,group_id=0,dax
mount -t virtiofs -o dax myfs /mnt
bash -c "echo 0000:00:05.0 > /sys/bus/pci/devices/0000\:00\:05.0/driver/unbind"
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
bash -c "echo 0000:00:06.0 > /sys/bus/pci/devices/0000\:00\:06.0/driver/unbind"
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
/mnt/cloud-hypervisor --kernel /mnt/vmlinux --cmdline "console=hvc0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda2 VFIOTAG" --disk path=/mnt/clear-31310-cloudguest.img path=/mnt/cloudinit.img --cpus 1 --memory size=512M --rng --device path=/sys/bus/pci/devices/0000:00:05.0/ path=/sys/bus/pci/devices/0000:00:06.0/
/mnt/cloud-hypervisor --kernel /mnt/vmlinux --cmdline "console=hvc0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda2 VFIOTAG" --disk path=/mnt/clear-31310-cloudguest.img path=/mnt/cloudinit.img --cpus boot=1 --memory size=512M --device path=/sys/bus/pci/devices/0000:00:05.0/ path=/sys/bus/pci/devices/0000:00:06.0/