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 15, 2024
1 parent 0d05f89 commit 3cc7633
Showing 1 changed file with 11 additions and 6 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

0 comments on commit 3cc7633

Please sign in to comment.