From f99fd4457c9b197095c0e63654ae5ba514680bbd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 31 Aug 2024 05:06:41 +0000 Subject: [PATCH] fix(deps): update patch digest dependencies --- go.mod | 4 +- go.sum | 8 +-- .../longhorn/backupstore/deltablock.go | 50 ++++++++++++------- vendor/modules.txt | 4 +- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index f0089f1cdd..4c118b907c 100644 --- a/go.mod +++ b/go.mod @@ -59,10 +59,10 @@ require ( github.com/jinzhu/copier v0.3.5 github.com/kubernetes-csi/csi-lib-utils v0.6.1 github.com/longhorn/backing-image-manager v1.7.1-rc2 - github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e + github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58 - github.com/longhorn/go-spdk-helper v0.0.0-20240820144231-33c0873802ff + github.com/longhorn/go-spdk-helper v0.0.0-20240827171022-9fe38fff5b51 github.com/longhorn/longhorn-engine v1.7.1-rc2 github.com/longhorn/longhorn-instance-manager v1.7.1-rc2 github.com/longhorn/longhorn-share-manager v1.7.0 diff --git a/go.sum b/go.sum index ddba040935..727c7885bb 100644 --- a/go.sum +++ b/go.sum @@ -1223,14 +1223,14 @@ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhn github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/longhorn/backing-image-manager v1.7.1-rc2 h1:phprsZvc1NENpGo025etuCMTFjXbG0KwdMLevjwbYzM= github.com/longhorn/backing-image-manager v1.7.1-rc2/go.mod h1:CGx4XTIk7/sHnp53AwK3Rp4TcFmOQUgaVFemJfou7vM= -github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e h1:Kvt/BqiHKaOlTPSM2HFz0VupuQM0laln67rMIDCRYxQ= -github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e/go.mod h1:N4cqNhSs4VUw9aGbO2OfyiIvJL7/L53hUrNiT73UN+U= +github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f h1:/Wo/leT2yrMmiDieCGhzqyzXb9FNsWoGeYWNfuf29KA= +github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f/go.mod h1:N4cqNhSs4VUw9aGbO2OfyiIvJL7/L53hUrNiT73UN+U= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f h1:hjqUs3WVodkzrWwlUMVsnKAlom3uohoNlhZBGLsRvQY= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo= github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58 h1:fzLAnCLCecoUnsSYyyo7li5GD17xckyBl/zietxz168= github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58/go.mod h1:TobRDCXmF0Ni+jz6+nLJamw3uVu+gNDZoZre1JczGwc= -github.com/longhorn/go-spdk-helper v0.0.0-20240820144231-33c0873802ff h1:8vR29tkbmzmdqRVtOo5kL7Rs7nfhA6duXsmetIh1Tbg= -github.com/longhorn/go-spdk-helper v0.0.0-20240820144231-33c0873802ff/go.mod h1:Bzz7kGNYikAJqpmeV3cgN8jP1y9M+/oaiBc5iolIxuA= +github.com/longhorn/go-spdk-helper v0.0.0-20240827171022-9fe38fff5b51 h1:qU69qwOdcJyDG36Bgp4/b/lydmpJZsPVx+bpszrzQFc= +github.com/longhorn/go-spdk-helper v0.0.0-20240827171022-9fe38fff5b51/go.mod h1:i9btdUP+14isigk+vOfANF7MQAbDO+u/ixeA/oOUwtA= github.com/longhorn/longhorn-engine v1.7.1-rc2 h1:Hbcuyu8ae0qFKhoF4p1uJaQAKGeJ2YMJnDkqFR+vTCE= github.com/longhorn/longhorn-engine v1.7.1-rc2/go.mod h1:E1ec7ub7SNGvASDtiFHL1dXX4bhEQiroBixD2GGeRbQ= github.com/longhorn/longhorn-instance-manager v1.7.1-rc2 h1:Sfer1qrvjNmlkoF4dHPVE7mvLGH8Po2pP7WuZLcHFwQ= diff --git a/vendor/github.com/longhorn/backupstore/deltablock.go b/vendor/github.com/longhorn/backupstore/deltablock.go index 16c5ad42cc..edb237cd72 100644 --- a/vendor/github.com/longhorn/backupstore/deltablock.go +++ b/vendor/github.com/longhorn/backupstore/deltablock.go @@ -741,7 +741,9 @@ func RestoreDeltaBlockBackup(ctx context.Context, config *DeltaRestoreConfig) er } defer func() { if err != nil { - _ = deltaOps.CloseVolumeDev(volDev) + if _err := deltaOps.CloseVolumeDev(volDev); _err != nil { + logrus.WithError(_err).Warnf("Failed to close volume device %v", volDevName) + } } }() @@ -775,7 +777,10 @@ func RestoreDeltaBlockBackup(ctx context.Context, config *DeltaRestoreConfig) er currentProgress := 0 defer func() { - _ = deltaOps.CloseVolumeDev(volDev) + if _err := deltaOps.CloseVolumeDev(volDev); _err != nil { + logrus.WithError(_err).Warnf("Failed to close volume device %v", volDevName) + } + deltaOps.UpdateRestoreStatus(volDevName, currentProgress, err) if unlockErr := lock.Unlock(); unlockErr != nil { logrus.WithError(unlockErr).Warn("Failed to unlock") @@ -843,8 +848,9 @@ func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRest lastBackupName := config.LastBackupName deltaOps := config.DeltaOps if deltaOps == nil { - return fmt.Errorf("missing DeltaBlockBackupOperations") + return fmt.Errorf("missing DeltaRestoreOperations") } + bsDriver, err := GetBackupStoreDriver(backupURL) if err != nil { return err @@ -894,14 +900,16 @@ func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRest } } - volDev, err := os.Create(volDevName) + volDev, volDevPath, err := deltaOps.OpenVolumeDev(volDevName) if err != nil { - return err + return errors.Wrapf(err, "failed to open volume device %v", volDevName) } defer func() { // make sure to close the device if err != nil { - _ = volDev.Close() + if _err := deltaOps.CloseVolumeDev(volDev); _err != nil { + logrus.WithError(_err).Warnf("Failed to close volume device %v", volDevName) + } } }() @@ -933,10 +941,18 @@ func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRest return err } go func() { - defer volDev.Close() + var err error + finalProgress := 0 + defer func() { + if _err := deltaOps.CloseVolumeDev(volDev); _err != nil { + logrus.WithError(_err).Warnf("Failed to close volume device %v", volDevName) + } + + deltaOps.UpdateRestoreStatus(volDevName, finalProgress, err) + if unlockErr := lock.Unlock(); unlockErr != nil { - logrus.WithError(err).Warn("Failed to unlock") + logrus.WithError(unlockErr).Warn("Failed to unlock") } }() @@ -945,20 +961,20 @@ func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRest // closed. // https://github.com/longhorn/longhorn/issues/2503 // We want to truncate regular files, but not device - if stat.Mode()&os.ModeType == 0 { - log.Debugf("Truncate %v to size %v", volDevName, vol.Size) - if err := volDev.Truncate(vol.Size); err != nil { - deltaOps.UpdateRestoreStatus(volDevName, 0, err) + if stat.Mode().IsRegular() { + log.Infof("Truncate %v to size %v", volDevName, vol.Size) + err = volDev.Truncate(vol.Size) + if err != nil { return } } - if err := performIncrementalRestore(ctx, bsDriver, config, srcVolumeName, volDevName, lastBackup, backup); err != nil { - deltaOps.UpdateRestoreStatus(volDevName, 0, err) + err = performIncrementalRestore(ctx, bsDriver, config, srcVolumeName, volDevPath, lastBackup, backup) + if err != nil { return } - deltaOps.UpdateRestoreStatus(volDevName, PROGRESS_PERCENTAGE_BACKUP_TOTAL, nil) + finalProgress = PROGRESS_PERCENTAGE_BACKUP_TOTAL }() return nil } @@ -1107,7 +1123,7 @@ func restoreBlocks(ctx context.Context, bsDriver BackupStoreDriver, deltaOps Del } func performIncrementalRestore(ctx context.Context, bsDriver BackupStoreDriver, config *DeltaRestoreConfig, - srcVolumeName, volDevName string, lastBackup *Backup, backup *Backup) error { + srcVolumeName, volDevPath string, lastBackup *Backup, backup *Backup) error { var err error concurrentLimit := config.ConcurrentLimit @@ -1119,7 +1135,7 @@ func performIncrementalRestore(ctx context.Context, bsDriver BackupStoreDriver, errorChans := []<-chan error{errChan} for i := 0; i < int(concurrentLimit); i++ { - errorChans = append(errorChans, restoreBlocks(ctx, bsDriver, config.DeltaOps, config.Filename, srcVolumeName, blockChan, progress)) + errorChans = append(errorChans, restoreBlocks(ctx, bsDriver, config.DeltaOps, volDevPath, srcVolumeName, blockChan, progress)) } mergedErrChan := mergeErrorChannels(ctx, errorChans...) diff --git a/vendor/modules.txt b/vendor/modules.txt index 8029a82712..ec1556e575 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -230,7 +230,7 @@ github.com/longhorn/backing-image-manager/pkg/client github.com/longhorn/backing-image-manager/pkg/meta github.com/longhorn/backing-image-manager/pkg/types github.com/longhorn/backing-image-manager/pkg/util -# github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e +# github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f ## explicit; go 1.22.0 github.com/longhorn/backupstore github.com/longhorn/backupstore/backupbackingimage @@ -259,7 +259,7 @@ github.com/longhorn/go-iscsi-helper/iscsidev github.com/longhorn/go-iscsi-helper/longhorndev github.com/longhorn/go-iscsi-helper/types github.com/longhorn/go-iscsi-helper/util -# github.com/longhorn/go-spdk-helper v0.0.0-20240820144231-33c0873802ff +# github.com/longhorn/go-spdk-helper v0.0.0-20240827171022-9fe38fff5b51 ## explicit; go 1.22.0 github.com/longhorn/go-spdk-helper/pkg/types # github.com/longhorn/longhorn-engine v1.7.1-rc2