Fix create backup snapshot
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-05 01:36:38 +02:00
parent c0ad8cffb2
commit 590a541e3f

View File

@@ -307,12 +307,12 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error)
var fs string
if v.Backup {
log.WithFields(log.Fields{"name": r.Name}).Info("Going to create a backup snapshot")
if snapshotTextB, err := applyEnv(exec.Command("/sbin/mount.objectivefs", "snapshot", v.Fs), v.Env).CombinedOutput(); err == nil {
if snapshotTextB, err := applyEnv(exec.Command("/sbin/mount.objectivefs", "snapshot", v.Fs), v.Env).CombinedOutput(); err != nil {
log.WithFields(log.Fields{"name": v.Volume.Name, "output": string(snapshotTextB[:])}).Info("Failed to create a new backup snapshot")
return &volume.MountResponse{}, err
} else {
// Format: NOTE: Successfully created snapshot: snapshotId (<current UTC time>)
const okPrefix = "NOTE: Successfully created snapshot:"
const okPrefix = "NOTE: Successfully created snapshot: "
snapshotText := string(snapshotTextB[:])
if snapshotIdWithSuffix, isOk := strings.CutPrefix(snapshotText, okPrefix); !isOk {
log.WithFields(log.Fields{"name": v.Volume.Name, "snapshot": v.BackupSnapshot}).Info("Failed to create a new backup snapshot")