Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
mount: add virtio-fs mount driver
Browse files Browse the repository at this point in the history
Mounting a virtio-fs filesystem is similar to 9pfs.

Fixes: #440
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Feb 20, 2019
1 parent a581aeb commit 42e664f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

const (
driver9pType = "9p"
driverVirtioFSType = "virtio-fs"
driverBlkType = "blk"
driverMmioBlkType = "mmioblk"
driverSCSIType = "scsi"
Expand Down
9 changes: 8 additions & 1 deletion mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

const (
type9pFs = "9p"
typeVirtioFS = "virtio_fs"
typeTmpFs = "tmpfs"
devPrefix = "/dev/"
timeoutHotplug = 3
Expand Down Expand Up @@ -98,7 +99,7 @@ func mount(source, destination, fsType string, flags int, options string) error

var err error
switch fsType {
case type9pFs:
case type9pFs, typeVirtioFS:
if err = createDestinationDir(destination); err != nil {
return err
}
Expand Down Expand Up @@ -191,6 +192,7 @@ type storageHandler func(storage pb.Storage, s *sandbox) (string, error)
// storageHandlerList lists the supported drivers.
var storageHandlerList = map[string]storageHandler{
driver9pType: virtio9pStorageHandler,
driverVirtioFSType: virtioFSStorageHandler,
driverBlkType: virtioBlkStorageHandler,
driverMmioBlkType: virtioMmioBlkStorageHandler,
driverSCSIType: virtioSCSIStorageHandler,
Expand Down Expand Up @@ -223,6 +225,11 @@ func virtioMmioBlkStorageHandler(storage pb.Storage, s *sandbox) (string, error)
return commonStorageHandler(storage)
}

// virtioFSStorageHandler handles the storage for virtio-fs.
func virtioFSStorageHandler(storage pb.Storage, s *sandbox) (string, error) {
return commonStorageHandler(storage)
}

// virtioBlkStorageHandler handles the storage for blk driver.
func virtioBlkStorageHandler(storage pb.Storage, s *sandbox) (string, error) {
// Get the device node path based on the PCI address provided
Expand Down

0 comments on commit 42e664f

Please sign in to comment.