From 9857eb369bd24424a2e99e302403bbb860da2e3a Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 16 Nov 2022 15:49:33 +0900 Subject: [PATCH] vz: fix readonly mounts Signed-off-by: Akihiro Suda --- pkg/cidata/cidata.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/cidata/cidata.go b/pkg/cidata/cidata.go index da69a7f7c09..5ea42aefcf3 100644 --- a/pkg/cidata/cidata.go +++ b/pkg/cidata/cidata.go @@ -166,19 +166,22 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort return err } options := "defaults" - if fstype == "9p" { + switch fstype { + case "9p", "virtiofs": options = "ro" if *f.Writable { options = "rw" } - options += ",trans=virtio" - options += fmt.Sprintf(",version=%s", *f.NineP.ProtocolVersion) - msize, err := units.RAMInBytes(*f.NineP.Msize) - if err != nil { - return fmt.Errorf("failed to parse msize for %q: %w", location, err) + if fstype == "9p" { + options += ",trans=virtio" + options += fmt.Sprintf(",version=%s", *f.NineP.ProtocolVersion) + msize, err := units.RAMInBytes(*f.NineP.Msize) + if err != nil { + return fmt.Errorf("failed to parse msize for %q: %w", location, err) + } + options += fmt.Sprintf(",msize=%d", msize) + options += fmt.Sprintf(",cache=%s", *f.NineP.Cache) } - options += fmt.Sprintf(",msize=%d", msize) - options += fmt.Sprintf(",cache=%s", *f.NineP.Cache) // don't fail the boot, if virtfs is not available options += ",nofail" }