mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-07 10:15:45 +00:00
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:
parent
e1822cfdad
commit
143471b739
12
docs/fs.md
12
docs/fs.md
@ -60,7 +60,7 @@ Assuming you have `clear-kvm.img` and `custom-vmlinux.bin` on your system, here
|
|||||||
--disk path=clear-kvm.img \
|
--disk path=clear-kvm.img \
|
||||||
--kernel custom-vmlinux.bin \
|
--kernel custom-vmlinux.bin \
|
||||||
--cmdline "console=ttyS0 reboot=k panic=1 nomodules root=/dev/vda3" \
|
--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:
|
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
|
### 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
|
```bash
|
||||||
mkdir mount_dir
|
mkdir mount_dir
|
||||||
mount \
|
mount -t virtiofs -o dax myfs mount_dir/
|
||||||
-t virtio_fs virtiofs mount_dir/ \
|
|
||||||
-o rootmode=040000,user_id=0,group_id=0,dax
|
|
||||||
```
|
```
|
||||||
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.
|
||||||
|
@ -2823,7 +2823,7 @@ mod tests {
|
|||||||
let mut kernel_path = workload_path;
|
let mut kernel_path = workload_path;
|
||||||
kernel_path.push("vmlinux");
|
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 {
|
let cache_size_vmm_param = if let Some(cache) = cache_size {
|
||||||
format!(",cache_size={}", cache)
|
format!(",cache_size={}", cache)
|
||||||
} else {
|
} else {
|
||||||
@ -2857,7 +2857,7 @@ mod tests {
|
|||||||
.args(&[
|
.args(&[
|
||||||
"--fs",
|
"--fs",
|
||||||
format!(
|
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
|
virtiofsd_socket_path, dax_vmm_param, cache_size_vmm_param
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
@ -2878,8 +2878,7 @@ mod tests {
|
|||||||
// Mount shared directory through virtio_fs filesystem
|
// Mount shared directory through virtio_fs filesystem
|
||||||
let mount_cmd = format!(
|
let mount_cmd = format!(
|
||||||
"mkdir -p mount_dir && \
|
"mkdir -p mount_dir && \
|
||||||
sudo mount -t virtio_fs virtiofs mount_dir/ -o \
|
sudo mount -t virtiofs {} myfs mount_dir/ && \
|
||||||
rootmode=040000,user_id=1001,group_id=1001{} && \
|
|
||||||
echo ok",
|
echo ok",
|
||||||
dax_mount_param
|
dax_mount_param
|
||||||
);
|
);
|
||||||
@ -3546,7 +3545,7 @@ mod tests {
|
|||||||
.args(&[
|
.args(&[
|
||||||
"--fs",
|
"--fs",
|
||||||
format!(
|
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,
|
virtiofsd_socket_path,
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
|
@ -58,10 +58,10 @@ write_files:
|
|||||||
content: |
|
content: |
|
||||||
#!/bin/bash
|
#!/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 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 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 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"
|
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/
|
||||||
|
Loading…
Reference in New Issue
Block a user