Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
pkg/lvm: add flock-based lock around any lvm invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav Paul committed Aug 9, 2019
1 parent f91368e commit 1706389
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/lvm/lock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package lvm

import (
"github.com/gofrs/flock"
)

var lvmlock *flock.Flock

// SetLockFilePath sets the path to the LOCK file to use for preventing
// concurrent invocations of LVM command-line utilities.
//
// See
// - https://jira.mesosphere.com/browse/DCOS_OSS-5434
// - https://github.com/lvmteam/lvm2/issues/23
func SetLockFilePath(filepath string) {
lvmlock = flock.New(filepath)
}

0 comments on commit 1706389

Please sign in to comment.