File tree 2 files changed +14
-9
lines changed
internal/cvmfs/singlemount
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -47,17 +47,21 @@ func main() {
47
47
os .Exit (0 )
48
48
}
49
49
50
- // Initialize and run automount -runner.
50
+ // Initialize and run singlemount -runner.
51
51
52
52
log .Infof ("singlemount-runner for CVMFS CSI plugin version %s" , cvmfsversion .FullVersion ())
53
53
log .Infof ("Command line arguments %v" , os .Args )
54
54
55
+ if err := singlemount .CreateSingleMountsDir (); err != nil {
56
+ log .Fatalf ("Failed to create metadata directory in %s: %v" , singlemount .SinglemountsDir , err )
57
+ }
58
+
55
59
opts := singlemount.Opts {
56
60
Endpoint : * endpoint ,
57
61
}
58
62
59
63
if err := singlemount .RunBlocking (opts ); err != nil {
60
- log .Fatalf ("Failed to run automount -runner: %v" , err )
64
+ log .Fatalf ("Failed to run singlemount -runner: %v" , err )
61
65
}
62
66
63
67
os .Exit (0 )
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ const (
41
41
// bind.json
42
42
// config
43
43
// mount.json
44
- singlemountsDir = "/var/lib/cvmfs.csi.cern.ch/single"
44
+ SinglemountsDir = "/var/lib/cvmfs.csi.cern.ch/single"
45
45
46
46
// Contains mapping between all mountpoint -> mount ID that are currently
47
47
// in use. We need to keep track of these, because CSI's NodeUnstageVolume
80
80
)
81
81
82
82
func fmtMountSingleBasePath (mountID string ) string {
83
- return path .Join (singlemountsDir , mountID )
83
+ return path .Join (SinglemountsDir , mountID )
84
84
}
85
85
86
86
func fmtMountpointPath (mountID string ) string {
@@ -100,13 +100,14 @@ func fmtConfigPath(mountID string) string {
100
100
}
101
101
102
102
func fmtMountpointsMetadataPath () string {
103
- return path .Join (singlemountsDir , mountpointsFilename )
103
+ return path .Join (SinglemountsDir , mountpointsFilename )
104
104
}
105
105
106
- func init () {
107
- if err := os .MkdirAll (singlemountsDir , 0775 ); err != nil {
108
- panic (err )
109
- }
106
+ // Creates the metadata directory for singlemount-runner.
107
+ // Must be called before RunBlocking().
108
+ // TOOD: make the path configurable and expose via the chart.
109
+ func CreateSingleMountsDir () error {
110
+ return os .MkdirAll (SinglemountsDir , 0775 )
110
111
}
111
112
112
113
// Makes sure that directory <mountsDir>/<MountSingleRequest.MountId> exists.
You can’t perform that action at this time.
0 commit comments