Skip to content

Conversation

@sboeuf
Copy link
Member

@sboeuf sboeuf commented May 22, 2019

In order to support filesystem sharing between host and guest, this pull request introduces the support for vhost-user-fs (also known as virtio-fs) to its device model.

Fixes #9

@sboeuf sboeuf changed the title Add virtio-fs support [WIP] Add virtio-fs support May 22, 2019
@sboeuf
Copy link
Member Author

sboeuf commented May 22, 2019

@sboeuf sboeuf requested review from chao-p, rbradford and sameo May 22, 2019 22:43
@sboeuf sboeuf force-pushed the add_virtiofs_support branch from 8613e78 to c87abcb Compare May 23, 2019 14:44
Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not far off..I see the need to split up the commandline stuff.

@sboeuf sboeuf force-pushed the add_virtiofs_support branch 3 times, most recently from eeaa603 to 8078b3f Compare May 23, 2019 23:46
@bjzhjing
Copy link
Contributor

@sboeuf Why don't you work based on vhost crate directly? Some differences there. If this work will be sent to upstream finally, I think change is needed, right?

@sboeuf
Copy link
Member Author

sboeuf commented May 24, 2019

@bjzhjing yes I need to rebase on top of vhost crate. The reason why I did this first was because I had a POC based off of vhost_user_rs crate and it was simpler to port. Also another reason is that vhost crate is not ready yet.

@sboeuf sboeuf force-pushed the add_virtiofs_support branch from 8078b3f to ec4293e Compare May 24, 2019 18:41
@sboeuf
Copy link
Member Author

sboeuf commented May 24, 2019

PR updated:

  • Added the support for the memory to be backed by a file from the command line --memory "size=256,file=/dev/shm"
  • Ported the code to the rust-vmm vhost crate (I had to submit a PR to fix a few things)

@sboeuf
Copy link
Member Author

sboeuf commented May 29, 2019

Updated on latest rust-vmm/vhost#2

@sboeuf sboeuf force-pushed the add_virtiofs_support branch from 67c651f to cbcf835 Compare May 31, 2019 23:17
@sboeuf sboeuf force-pushed the add_virtiofs_support branch from cbcf835 to b0b422d Compare June 14, 2019 20:46
@sboeuf
Copy link
Member Author

sboeuf commented Jun 14, 2019

@rbradford @sameo @chao-p
I updated the PR based on the PR rust-vmm/vm-memory#29, and also I copied the code from the pending PR rust-vmm/vhost#2 so that we don't depend on the non-existing vhost crate.

@sboeuf sboeuf force-pushed the add_virtiofs_support branch 8 times, most recently from 621db21 to 9a86e98 Compare June 21, 2019 20:43
@sboeuf sboeuf changed the title [WIP] Add virtio-fs support Add virtio-fs support Jun 21, 2019
@sameo
Copy link
Member

sameo commented Jun 25, 2019

@sboeuf Are we waiting for a rust-vmm vm-memory PR to be merged here?

@sboeuf
Copy link
Member Author

sboeuf commented Jun 25, 2019

@sameo Yes we're waiting on rust-vmm/vm-memory#29. Maybe you can have a look at rust-vmm/vm-memory#29 if you have some spare time.

Sebastien Boeuf added 6 commits June 26, 2019 08:45
Remove legacy code coming from Firecracker and/or Crosvm.

Signed-off-by: Sebastien Boeuf <[email protected]>
In order to avoid cloud-hypervisor to rely on a pending PR for the empty
crate "vhost", this commit temporarily copies the content of the crate
based on branch jiangliu/v1 18b5081d9199c76eca49da1971c9d1a65e53e5ff.

Signed-off-by: Sebastien Boeuf <[email protected]>
The vhost-user-fs or virtio-fs device allows files and directories to
be shared between host and guest. This patch adds the implementation
of this device to the cloud-hypervisor device model.

Signed-off-by: Sebastien Boeuf <[email protected]>
The user can now share some files and directories with the guest by
providing the corresponding vhost-user socket. The virtiofsd daemon
should be started by the user before to start the VM.

Signed-off-by: Sebastien Boeuf <[email protected]>
In the context of vhost-user, we need the guest RAM to be backed by
a file in order to be accessed by an external process. This patch
adds the new flag "file=" to the "--memory" option so that we can
specify from the command line if the memory needs to be backed, and
by which specific file.

Signed-off-by: Sebastien Boeuf <[email protected]>
This commit introduces the testing of the --fs option based on the
virtio-fs implementation. This does not simply add a test, but also
updates the integration script by generating a new kernel embedding
the virtio-fs patches and by downloading the virtiofsd daemon.

Signed-off-by: Sebastien Boeuf <[email protected]>
@sboeuf sboeuf force-pushed the add_virtiofs_support branch from 9a86e98 to e9c48fc Compare June 26, 2019 18:28
@sboeuf
Copy link
Member Author

sboeuf commented Jun 26, 2019

@sameo @chao-p This PR is updated and ready now that rust-vmm/vm-memory#29 has been merged :)

Copy link
Member

@sameo sameo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good. 2 things I'd like to see improved:

  • Can we support multiple --fs from the command line?
  • Could you please add a short docs/fs.md document describing how to use that feature?

pub rng: RngConfig<'a>,
pub net: Option<NetConfig<'a>>,
pub rng: RngConfig<'a>,
pub fs: Option<FsConfig<'a>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to support multiple shared directories, so we should have a vector of FsConfig here if possible.

@sboeuf
Copy link
Member Author

sboeuf commented Jun 27, 2019

@sameo yes let me address your comments and I'll repush asap.

Sebastien Boeuf added 2 commits June 27, 2019 09:14
Until now, the VMM was only accepting a single instance of a virtio-fs
device. This commit extend the virtio-fs support by allowing several
devices to be created for a single VM.

Signed-off-by: Sebastien Boeuf <[email protected]>
Add some documentation specific to virtio-fs and how to perform
filesystem sharing between host and guest with cloud-hypervisor.

Signed-off-by: Sebastien Boeuf <[email protected]>
@sboeuf
Copy link
Member Author

sboeuf commented Jun 27, 2019

@sameo PR updated!

@sameo sameo merged commit c0336e8 into cloud-hypervisor:master Jun 27, 2019
@sboeuf sboeuf deleted the add_virtiofs_support branch December 5, 2019 07:12
@phip1611 phip1611 mentioned this pull request Nov 11, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for virtio-fs

4 participants