Skip to content

Commit b8edf2b

Browse files
committed
Add default volumes for hyperv
All machine providers except WSL should have default volumes defined. HyperV was empty meaning no defaults were being added. For HyperV, like Linux, I think $HOME is sufficient. Signed-off-by: Brent Baude <bbaude@redhat.com>
1 parent bed861a commit b8edf2b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/config/default_windows.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package config
22

3-
import "os"
3+
import (
4+
"fmt"
5+
"os"
6+
"path/filepath"
7+
"strings"
8+
9+
"github.com/containers/storage/pkg/homedir"
10+
)
411

512
// isCgroup2UnifiedMode returns whether we are running in cgroup2 mode.
613
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
@@ -36,7 +43,10 @@ func getLibpodTmpDir() string {
3643

3744
// getDefaultMachineVolumes returns default mounted volumes (possibly with env vars, which will be expanded)
3845
func getDefaultMachineVolumes() []string {
39-
return []string{}
46+
hd := homedir.Get()
47+
vol := filepath.VolumeName(hd)
48+
hostMnt := filepath.ToSlash(strings.TrimPrefix(hd, vol))
49+
return []string{fmt.Sprintf("%s:%s", hd, hostMnt)}
4050
}
4151

4252
func getDefaultComposeProviders() []string {

0 commit comments

Comments
 (0)