diff --git a/box.go b/box.go index c705f60..8223592 100644 --- a/box.go +++ b/box.go @@ -198,13 +198,18 @@ func TransferDirectZfs(from, to Addr) error { } - fromFromSnapshotId := -1 - lastToSnapshot := toSnapshots[len(toSnapshots)-1] - log.WithFields(log.Fields{"from": from, "to": to}).Debugf("searching last snapshot %s", lastToSnapshot.String()) - for id, v := range fromSnapshots { - if v.name == lastToSnapshot.name { - fromFromSnapshotId = id - log.WithFields(log.Fields{"from": from, "to": to}).Debugf("found %s", v.String()) + fromFromSnapshotId := len(fromSnapshots) + fromToSnapshotId := -1 + for fromFromSnapshotId >= 0 { + fromFromSnapshotId = fromFromSnapshotId - 1 + fromToSnapshotId = len(toSnapshots) + for fromToSnapshotId >= 0 { + fromToSnapshotId = fromToSnapshotId - 1 + if fromSnapshots[fromFromSnapshotId].name == toSnapshots[fromToSnapshotId].name { + break + } + } + if fromToSnapshotId >= 0 { break } } diff --git a/version.go b/version.go index f79c30f..794dbfd 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "e7ed6cb" +var githash = "3b1d0fc" var branch = "master" -var buildstamp = "2023-08-22_11:08:53" -var commits = "85" -var version = "e7ed6cb-b85 - 2023-08-22_11:08:53" +var buildstamp = "2023-09-10_16:35:29" +var commits = "86" +var version = "3b1d0fc-b86 - 2023-09-10_16:35:29" diff --git a/zfs.go b/zfs.go index 54cb6e8..e2d771a 100644 --- a/zfs.go +++ b/zfs.go @@ -311,6 +311,9 @@ func (fs *ZfsFs) AddSnapshot(s *ZfsSnapshot) error { } func (fs *ZfsFs) ValidSnapshots() []*ZfsSnapshot { + log.WithFields(log.Fields{"box": fs.zfs.box.name, "fs": fs.path}).Debugf("starting") + defer log.WithFields(log.Fields{"box": fs.zfs.box.name, "fs": fs.path}).Debugf("done") + tab := make([]*ZfsSnapshot, 0) for _, s := range fs.snapshots {