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

mount: add virtio-fs mount driver #434

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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