mirror of
https://github.com/containers/podman.git
synced 2025-06-26 21:07:02 +08:00
Implement automatic port reassignment on Windows
While only leveraged by the WSL backend, this commit also adds core infrastructure for all other backends for future enhancement. - Adds a common port cross backend allocation registry to prevent duplicate assignment across multiple machine instances - Introduces logic in Start() that detects OS port conflicts and scans for a viable replacement port - Updates connection definitions and server configuration accordingly - Utilizes a coordinated file lock strategy to prevent racing overwrites of port and connection registries - WSL backend coordinates locking for containers.conf until a future common enhancement exists to replace it [NO NEW TESTS NEEDED] Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
@ -199,6 +199,17 @@ func GetDataDir(vmType VMType) (string, error) {
|
||||
return dataDir, mkdirErr
|
||||
}
|
||||
|
||||
// GetGLobalDataDir returns the root of all backends
|
||||
// for shared machine data.
|
||||
func GetGlobalDataDir() (string, error) {
|
||||
dataDir, err := DataDirPrefix()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return dataDir, os.MkdirAll(dataDir, 0755)
|
||||
}
|
||||
|
||||
// DataDirPrefix returns the path prefix for all machine data files
|
||||
func DataDirPrefix() (string, error) {
|
||||
data, err := homedir.GetDataHome()
|
||||
|
Reference in New Issue
Block a user