diff --git a/pkg/lvm/lock.go b/pkg/lvm/lock.go new file mode 100644 index 00000000..46a9018d --- /dev/null +++ b/pkg/lvm/lock.go @@ -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) +}