mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
create machine dirs at discovery
in various use cases, the required machine dirs are not created. the machine dirs are runtimedir, datadir, and configdir. Example in Linux would be: configDir /<HOME>/.config/containers/podman/machine/<provider> dataDir /<HOME>/.local/share/containers/podman/machine/<provider> runtimeDir /run/user/1000/podman/machine now we blindly create them without checking for their existence (because it is faster). this fixes a bug where runtimedir does not exist on macos after a reboot [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <baude@redhat.com>
This commit is contained in:
@ -193,12 +193,25 @@ func GetMachineDirs(vmType define.VMType) (*define.MachineDirs, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rtDirFile, err := define.NewMachineFile(rtDir, nil)
|
rtDirFile, err := define.NewMachineFile(rtDir, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
dirs := define.MachineDirs{
|
dirs := define.MachineDirs{
|
||||||
ConfigDir: configDirFile,
|
ConfigDir: configDirFile,
|
||||||
DataDir: dataDirFile,
|
DataDir: dataDirFile,
|
||||||
RuntimeDir: rtDirFile,
|
RuntimeDir: rtDirFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure all machine dirs are present
|
||||||
|
if err := os.MkdirAll(rtDir, 0755); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := os.MkdirAll(configDir, 0755); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = os.MkdirAll(dataDir, 0755)
|
||||||
|
|
||||||
return &dirs, err
|
return &dirs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user