Skip to content

Commit

Permalink
vfkit: Add file sharing support
Browse files Browse the repository at this point in the history
This adds file sharing support to the vfkit driver.
This requires a version of vfkit with file sharing support (0.0.2 or
newer).
  • Loading branch information
cfergeau authored and anjannath committed Aug 4, 2022
1 parent 933e7bc commit 50faa96
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/drivers/vfkit/driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ func (d *Driver) Start() error {
}
}

// shared directories
for _, sharedDir := range d.SharedDirs {
// TODO: add support for 'mount.ReadOnly'
// TODO: check format
dev, err := client.VirtioFsNew(sharedDir.Source, sharedDir.Tag)
if err != nil {
return err
}
err = vm.AddDevice(dev)
if err != nil {
return err
}
}

// entropy
dev, err = client.VirtioRNGNew()
if err != nil {
Expand Down Expand Up @@ -264,6 +278,11 @@ func (d *Driver) Start() error {
return nil
}

func (d *Driver) GetSharedDirs() ([]drivers.SharedDir, error) {
// check if host supports file sharing, return drivers.ErrNotSupported if not
return d.SharedDirs, nil
}

// GetState returns the state that the host is in (running, stopped, etc)
func (d *Driver) GetState() (state.State, error) {
p, err := d.findVfkitProcess()
Expand Down

0 comments on commit 50faa96

Please sign in to comment.