Skip to content

Commit

Permalink
Modify freeze functionality for updated longhorn-engine logic
Browse files Browse the repository at this point in the history
Lognhorn 2187

Signed-off-by: Eric Weber <[email protected]>
  • Loading branch information
ejweber committed May 3, 2024
1 parent e73c159 commit 619b852
Show file tree
Hide file tree
Showing 15 changed files with 2,120 additions and 49 deletions.
17 changes: 11 additions & 6 deletions app/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,22 @@ func unfreezeFilesystems() error {
// - If it does, we just need to know where in the container we can access the mount points to unfreeze the file
// system.
mounter := mount.New("")
sourcePoints, err := mounter.List()
mountPoints, err := mounter.List()
if err != nil {
return errors.Wrap(err, "failed to list mount points while starting up")
}

for _, sourcePoint := range sourcePoints {
if strings.Contains(sourcePoint.Device, "/dev/longhorn") { // TODO: Find this as a const somewhere.
for _, mountPoint := range mountPoints {
if strings.Contains(mountPoint.Device, engineutil.DevicePathPrefix) {
// We do not actually expect any filesystems to be frozen. This is a best effort attempt to unfreeze them
// if somehow instance manager crashed at the wrong moment during a snapshot. Log on success, but not on
// failure.
engineutil.AttemptUnfreezeFilesystem(sourcePoint.Path, nil, false, logrus.New())
// if somehow instance manager crashed at the wrong moment during a snapshot.
unfroze, err := engineutil.UnfreezeFilesystem(mountPoint.Path, nil)
if err != nil {
logrus.WithError(err).Warnf("Failed to unfreeze filesystem mounted at %v", mountPoint)
}
if unfroze {
logrus.Warnf("Unfroze filesystem mounted at %v", mountPoint)
}
}
}
return nil
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce // indirect
github.com/longhorn/nsfilelock v0.0.0-20200723175406-fa7c83ad0003 // indirect
github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand Down Expand Up @@ -73,4 +74,4 @@ require (

replace github.com/longhorn/types => github.com/ejweber/types v0.0.0-20240429162331-ac822e968757

replace github.com/longhorn/longhorn-engine => github.com/ejweber/longhorn-engine v0.0.0-20240429165702-94f3cdb5a7c1
replace github.com/longhorn/longhorn-engine => github.com/ejweber/longhorn-engine v0.0.0-20240503190751-5af258211e63
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8Yc
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/ejweber/longhorn-engine v0.0.0-20240429165702-94f3cdb5a7c1 h1:96lNxxq+mdpdMTX+hIIXkyoXKgtIFkYbaLXFKcLVo5Q=
github.com/ejweber/longhorn-engine v0.0.0-20240429165702-94f3cdb5a7c1/go.mod h1:TnJGy4ygBIDPWy2pBICakYyQqrkufdG61op+rskVXfo=
github.com/ejweber/longhorn-engine v0.0.0-20240503190751-5af258211e63 h1:6wSvT7zPnni3gUEeTMs1L4n6NLYdHFdxhigzcITkoPY=
github.com/ejweber/longhorn-engine v0.0.0-20240503190751-5af258211e63/go.mod h1:TnJGy4ygBIDPWy2pBICakYyQqrkufdG61op+rskVXfo=
github.com/ejweber/types v0.0.0-20240429162331-ac822e968757 h1:thzRDLmEq2LFQ33CQhQKHup903tsGq8tKO55+Txy2E4=
github.com/ejweber/types v0.0.0-20240429162331-ac822e968757/go.mod h1:1oEh1cnDDqNSuFh/dH/lvJ3Ssq83SOweTAAPLRY4PMI=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
Expand Down Expand Up @@ -73,6 +73,8 @@ github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a h1:cwHDzWi0zk
github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a/go.mod h1:NlOHCyQiGjn9TS1HUfQlBESttDPzi9x1Vs38geRV9SU=
github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 h1:uBVee6AulPsgSvsvaxdj4xIdgkIvjIqA0j7ZD+Hg/Mc=
github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90/go.mod h1:qppGSy9WsxH1C9T6yhSMvG53ynpasyKOH/n9e1jr8mw=
github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce h1:PxKniE9F6IZ2DMKfmxDsbqeAxQI1TZhnw7/HOBMs1Is=
github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce/go.mod h1:d9t3gtE+UPjescbCFluXd4xBc8OQT/JrC2cdkk2IXWQ=
github.com/longhorn/go-spdk-helper v0.0.0-20240427164640-8cb919fb8e53 h1:7JOAKtVr0zOBvBcKJw76IJjbiyJZLI7x5O6GFAifUm0=
github.com/longhorn/go-spdk-helper v0.0.0-20240427164640-8cb919fb8e53/go.mod h1:CiKgQ6CKWCE4CrAUgQx7inzRT7Xzbo6JuDhdRTpaVkY=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240427164543-3425d69b6acb h1:Ze4pc/BNokW++sTFNe7DY22sKUo6S8iPiWYcioA/Ulc=
Expand Down
201 changes: 201 additions & 0 deletions vendor/github.com/longhorn/go-iscsi-helper/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 619b852

Please sign in to comment.