mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 05:46:37 +00:00
logging tweaks for clarity
Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
@@ -387,6 +387,8 @@ func (ib *defaultItemBackupper) takePVSnapshot(obj runtime.Unstructured, log log
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
log = log.WithField("persistentVolume", pv.Name)
|
||||
|
||||
// If this PV is claimed, see if we've already taken a (restic) snapshot of the contents
|
||||
// of this PV. If so, don't take a snapshot.
|
||||
if pv.Spec.ClaimRef != nil {
|
||||
@@ -412,17 +414,14 @@ func (ib *defaultItemBackupper) takePVSnapshot(obj runtime.Unstructured, log log
|
||||
)
|
||||
|
||||
for _, snapshotLocation := range ib.backupRequest.SnapshotLocations {
|
||||
log := log.WithField("volumeSnapshotLocation", snapshotLocation.Name)
|
||||
|
||||
bs, err := ib.blockStore(snapshotLocation)
|
||||
if err != nil {
|
||||
log.WithError(err).WithField("volumeSnapshotLocation", snapshotLocation).Error("Error getting block store for volume snapshot location")
|
||||
log.WithError(err).Error("Error getting block store for volume snapshot location")
|
||||
continue
|
||||
}
|
||||
|
||||
log := log.WithFields(map[string]interface{}{
|
||||
"volumeSnapshotLocation": snapshotLocation.Name,
|
||||
"persistentVolume": metadata.GetName(),
|
||||
})
|
||||
|
||||
if volumeID, err = bs.GetVolumeID(obj); err != nil {
|
||||
log.WithError(err).Errorf("Error attempting to get volume ID for persistent volume")
|
||||
continue
|
||||
|
||||
@@ -103,22 +103,22 @@ func shouldSync(location *velerov1api.BackupStorageLocation, now time.Time, back
|
||||
|
||||
revision, err := backupStore.GetRevision()
|
||||
if err != nil {
|
||||
log.WithError(err).Info("Error getting backup store's revision, syncing")
|
||||
log.WithError(err).Debugf("Unable to get backup store's revision file, syncing (this is not an error if a v0.10+ backup has not yet been taken into this location)")
|
||||
return true, ""
|
||||
}
|
||||
log = log.WithField("revision", revision)
|
||||
|
||||
if location.Status.LastSyncedTime.Add(time.Hour).Before(now) {
|
||||
log.Infof("Backup location hasn't been synced in more than %s, syncing", time.Hour)
|
||||
log.Debugf("Backup location hasn't been synced in more than %s, syncing", time.Hour)
|
||||
return true, revision
|
||||
}
|
||||
|
||||
if string(location.Status.LastSyncedRevision) != revision {
|
||||
log.Info("Backup location hasn't been synced since its last modification, syncing")
|
||||
log.Debugf("Backup location hasn't been synced since its last modification, syncing")
|
||||
return true, revision
|
||||
}
|
||||
|
||||
log.Debug("Backup location's contents haven't changed since last sync, not syncing")
|
||||
log.Debugf("Backup location's contents haven't changed since last sync, not syncing")
|
||||
return false, ""
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ func (c *backupSyncController) run() {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
log.Infof("Syncing contents of backup store into cluster")
|
||||
|
||||
res, err := backupStore.ListBackups()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user