Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmd/singlemount-runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@ func main() {
os.Exit(0)
}

// Initialize and run automount-runner.
// Initialize and run singlemount-runner.

log.Infof("singlemount-runner for CVMFS CSI plugin version %s", cvmfsversion.FullVersion())
log.Infof("Command line arguments %v", os.Args)

if err := singlemount.CreateSingleMountsDir(); err != nil {
log.Fatalf("Failed to create metadata directory in %s: %v", singlemount.SinglemountsDir, err)
}

opts := singlemount.Opts{
Endpoint: *endpoint,
}

if err := singlemount.RunBlocking(opts); err != nil {
log.Fatalf("Failed to run automount-runner: %v", err)
log.Fatalf("Failed to run singlemount-runner: %v", err)
}

os.Exit(0)
Expand Down
15 changes: 8 additions & 7 deletions internal/cvmfs/singlemount/sharedmount.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
// bind.json
// config
// mount.json
singlemountsDir = "/var/lib/cvmfs.csi.cern.ch/single"
SinglemountsDir = "/var/lib/cvmfs.csi.cern.ch/single"

// Contains mapping between all mountpoint -> mount ID that are currently
// in use. We need to keep track of these, because CSI's NodeUnstageVolume
Expand Down Expand Up @@ -80,7 +80,7 @@ type (
)

func fmtMountSingleBasePath(mountID string) string {
return path.Join(singlemountsDir, mountID)
return path.Join(SinglemountsDir, mountID)
}

func fmtMountpointPath(mountID string) string {
Expand All @@ -100,13 +100,14 @@ func fmtConfigPath(mountID string) string {
}

func fmtMountpointsMetadataPath() string {
return path.Join(singlemountsDir, mountpointsFilename)
return path.Join(SinglemountsDir, mountpointsFilename)
}

func init() {
if err := os.MkdirAll(singlemountsDir, 0775); err != nil {
panic(err)
}
// Creates the metadata directory for singlemount-runner.
// Must be called before RunBlocking().
// TOOD: make the path configurable and expose via the chart.
func CreateSingleMountsDir() error {
return os.MkdirAll(SinglemountsDir, 0775)
}

// Makes sure that directory <mountsDir>/<MountSingleRequest.MountId> exists.
Expand Down