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

Commit e7e43d5

Browse files
committed
mount: add virtio-fs mount driver
Mounting a virtio-fs filesystem is similar to 9pfs. Fixes: #440 Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1 parent 91a87bc commit e7e43d5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

device.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
const (
2727
driver9pType = "9p"
28+
driverVirtioFSType = "virtio-fs"
2829
driverBlkType = "blk"
2930
driverMmioBlkType = "mmioblk"
3031
driverSCSIType = "scsi"

mount.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
const (
2424
type9pFs = "9p"
25+
typeVirtioFS = "virtio_fs"
2526
typeTmpFs = "tmpfs"
2627
devPrefix = "/dev/"
2728
timeoutHotplug = 3
@@ -98,7 +99,7 @@ func mount(source, destination, fsType string, flags int, options string) error
9899

99100
var err error
100101
switch fsType {
101-
case type9pFs:
102+
case type9pFs, typeVirtioFS:
102103
if err = createDestinationDir(destination); err != nil {
103104
return err
104105
}
@@ -191,6 +192,7 @@ type storageHandler func(storage pb.Storage, s *sandbox) (string, error)
191192
// storageHandlerList lists the supported drivers.
192193
var storageHandlerList = map[string]storageHandler{
193194
driver9pType: virtio9pStorageHandler,
195+
driverVirtioFSType: virtioFSStorageHandler,
194196
driverBlkType: virtioBlkStorageHandler,
195197
driverMmioBlkType: virtioMmioBlkStorageHandler,
196198
driverSCSIType: virtioSCSIStorageHandler,
@@ -217,6 +219,11 @@ func virtio9pStorageHandler(storage pb.Storage, s *sandbox) (string, error) {
217219
return commonStorageHandler(storage)
218220
}
219221

222+
// virtioFSStorageHandler handles the storage for virtio-fs.
223+
func virtioFSStorageHandler(storage pb.Storage, s *sandbox) (string, error) {
224+
return commonStorageHandler(storage)
225+
}
226+
220227
// virtioMmioBlkStorageHandler handles the storage for mmio blk driver.
221228
func virtioMmioBlkStorageHandler(storage pb.Storage, s *sandbox) (string, error) {
222229
//The source path is VmPath

0 commit comments

Comments
 (0)