Fix machine volumes with long path and paths with dashes

AppleHV accepts a max 36 bytes for mount tags. Instead of using the fully qualified path for the mount tag, SHA256 the path, and truncate the shasum to 36 bytes.
Also correctly escape dashes in mounted paths.

Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
Ashley Cui
2024-04-05 17:53:54 -04:00
parent ba73c604c4
commit a140c74ba4
5 changed files with 40 additions and 23 deletions

View File

@ -932,3 +932,9 @@ func (f *UnitFile) GetTemplateParts() (string, string) {
}
return parts[0] + "@" + ext, parts[1]
}
func PathEscape(path string) string {
var escaped strings.Builder
escapeString(&escaped, path, true)
return escaped.String()
}