Skip to content
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
27 changes: 27 additions & 0 deletions pkg/machine/e2e/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,33 @@ var _ = Describe("run basic podman commands", func() {
Expect(findmnt.outputToString()).To(ContainSubstring("virtiofs"))
})

It("Volume should be disabled by command line", func() {
skipIfWSL("Requires standard volume handling")
skipIfVmtype(define.AppleHvVirt, "Skipped on Apple platform")
skipIfVmtype(define.LibKrun, "Skipped on Apple platform")

name := randomString()
i := new(initMachine).withImage(mb.imagePath).withNow()

// Empty arg forces no volumes
i.withVolume("")
session, err := mb.setName(name).setCmd(i).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

ssh9p := new(sshMachine).withSSHCommand([]string{"findmnt", "-no", "FSTYPE", "-t", "9p"})
findmnt9p, err := mb.setName(name).setCmd(ssh9p).run()
Expect(err).ToNot(HaveOccurred())
Expect(findmnt9p).To(Exit(0))
Expect(findmnt9p.outputToString()).To(BeEmpty())

sshVirtiofs := new(sshMachine).withSSHCommand([]string{"findmnt", "-no", "FSTYPE", "-t", "virtiofs"})
findmntVirtiofs, err := mb.setName(name).setCmd(sshVirtiofs).run()
Expect(err).ToNot(HaveOccurred())
Expect(findmntVirtiofs).To(Exit(0))
Expect(findmntVirtiofs.outputToString()).To(BeEmpty())
})

It("Podman ops with port forwarding and gvproxy", func() {
name := randomString()
i := new(initMachine)
Expand Down
10 changes: 7 additions & 3 deletions pkg/machine/qemu/stubber.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,13 @@ func (q *QEMUStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func()
if err != nil {
return nil, nil, err
}
spawner, err := newVirtiofsdSpawner(runtime)
if err != nil {
return nil, nil, err

var spawner *virtiofsdSpawner
if len(mc.Mounts) > 0 {
spawner, err = newVirtiofsdSpawner(runtime)
if err != nil {
return nil, nil, err
}
}

for _, hostmnt := range mc.Mounts {
Expand Down
3 changes: 3 additions & 0 deletions pkg/machine/shim/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
func CmdLineVolumesToMounts(volumes []string, volumeType vmconfigs.VolumeMountType) []*vmconfigs.Mount {
mounts := []*vmconfigs.Mount{}
for i, volume := range volumes {
if volume == "" {
continue
}
var mount vmconfigs.Mount
tag, source, target, readOnly, _ := vmconfigs.SplitVolume(i, volume)
switch volumeType {
Expand Down