@@ -17,12 +17,9 @@ import (
1717 "github.com/sirupsen/logrus"
1818 "go.podman.io/common/pkg/config"
1919 "go.podman.io/common/pkg/strongunits"
20- "go.podman.io/podman/v6/pkg/machine"
2120 "go.podman.io/podman/v6/pkg/machine/define"
22- "go.podman.io/podman/v6/pkg/machine/ignition"
2321 "go.podman.io/podman/v6/pkg/machine/sockets"
2422 "go.podman.io/podman/v6/pkg/machine/vmconfigs"
25- "go.podman.io/podman/v6/pkg/systemd/parser"
2623)
2724
2825const applehvMACAddress = "5a:94:ef:e4:0c:ee"
@@ -65,80 +62,6 @@ func SetProviderAttrs(mc *vmconfigs.MachineConfig, opts define.SetOptions, state
6562 return nil
6663}
6764
68- func GenerateSystemDFilesForVirtiofsMounts (mounts []machine.VirtIoFs ) ([]ignition.Unit , error ) {
69- // mounting in fcos with virtiofs is a bit of a dance. we need a unit file for the mount, a unit file
70- // for automatic mounting on boot, and a "preparatory" service file that disables FCOS security, performs
71- // the mkdir of the mount point, and then re-enables security. This must be done for each mount.
72-
73- unitFiles := make ([]ignition.Unit , 0 , len (mounts ))
74- for _ , mnt := range mounts {
75- // Create mount unit for each mount
76- mountUnit := parser .NewUnitFile ()
77- mountUnit .Add ("Mount" , "What" , "%s" )
78- mountUnit .Add ("Mount" , "Where" , "%s" )
79- mountUnit .Add ("Mount" , "Type" , "virtiofs" )
80- mountUnit .Add ("Mount" , "Options" , fmt .Sprintf ("context=\" %s\" " , machine .NFSSELinuxContext ))
81- mountUnit .Add ("Install" , "WantedBy" , "local-fs.target" )
82- mountUnitFile , err := mountUnit .ToString ()
83- if err != nil {
84- return nil , err
85- }
86-
87- virtiofsMount := ignition.Unit {
88- Enabled : ignition .BoolToPtr (true ),
89- Name : fmt .Sprintf ("%s.mount" , parser .PathEscape (mnt .Target )),
90- Contents : ignition .StrToPtr (fmt .Sprintf (mountUnitFile , mnt .Tag , mnt .Target )),
91- }
92-
93- unitFiles = append (unitFiles , virtiofsMount )
94- }
95-
96- // This is a way to workaround the FCOS limitation of creating directories
97- // at the rootfs / and then mounting to them.
98- immutableRootOff := parser .NewUnitFile ()
99- immutableRootOff .Add ("Unit" , "Description" , "Allow systemd to create mount points on /" )
100- immutableRootOff .Add ("Unit" , "DefaultDependencies" , "no" )
101-
102- immutableRootOff .Add ("Service" , "Type" , "oneshot" )
103- immutableRootOff .Add ("Service" , "ExecStart" , "chattr -i /" )
104-
105- immutableRootOff .Add ("Install" , "WantedBy" , "local-fs-pre.target" )
106- immutableRootOffFile , err := immutableRootOff .ToString ()
107- if err != nil {
108- return nil , err
109- }
110-
111- immutableRootOffUnit := ignition.Unit {
112- Contents : ignition .StrToPtr (immutableRootOffFile ),
113- Name : "immutable-root-off.service" ,
114- Enabled : ignition .BoolToPtr (true ),
115- }
116- unitFiles = append (unitFiles , immutableRootOffUnit )
117-
118- immutableRootOn := parser .NewUnitFile ()
119- immutableRootOn .Add ("Unit" , "Description" , "Set / back to immutable after mounts are done" )
120- immutableRootOn .Add ("Unit" , "DefaultDependencies" , "no" )
121- immutableRootOn .Add ("Unit" , "After" , "local-fs.target" )
122-
123- immutableRootOn .Add ("Service" , "Type" , "oneshot" )
124- immutableRootOn .Add ("Service" , "ExecStart" , "chattr +i /" )
125-
126- immutableRootOn .Add ("Install" , "WantedBy" , "local-fs.target" )
127- immutableRootOnFile , err := immutableRootOn .ToString ()
128- if err != nil {
129- return nil , err
130- }
131-
132- immutableRootOnUnit := ignition.Unit {
133- Contents : ignition .StrToPtr (immutableRootOnFile ),
134- Name : "immutable-root-on.service" ,
135- Enabled : ignition .BoolToPtr (true ),
136- }
137- unitFiles = append (unitFiles , immutableRootOnUnit )
138-
139- return unitFiles , nil
140- }
141-
14265// StartGenericAppleVM is wrapped by apple provider methods and starts the vm
14366func StartGenericAppleVM (mc * vmconfigs.MachineConfig , cmdBinary string , bootloader vfConfig.Bootloader , endpoint string ) (func () error , func () error , error ) {
14467 var ignitionSocket * define.VMFile
0 commit comments