taking wrong box for cleanup
This commit is contained in:
24
app.go
24
app.go
@@ -173,8 +173,8 @@ func (a *App) Cleanup(now time.Time) error {
|
||||
}
|
||||
for _, dest := range a.destinations {
|
||||
if cfg.box[dest.Box()].online {
|
||||
dest = dest.Append("/" + src.Box() + "/" + src.Path())
|
||||
for _, s := range cfg.box[dest.Box()].zfs.filesystems[dest.Path()].snapshots {
|
||||
dest2 := dest.Append("/" + src.Box() + "/" + src.Path())
|
||||
for _, s := range cfg.box[dest2.Box()].zfs.filesystems[dest2.Path()].snapshots {
|
||||
if !s.Valid() {
|
||||
if err := s.Delete(); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "now": now, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("")
|
||||
@@ -478,27 +478,31 @@ func (a *App) Transfer() error {
|
||||
defer log.WithFields(log.Fields{"app": a.name}).Debugf("done")
|
||||
|
||||
for _, src := range a.sources {
|
||||
backedUp := false
|
||||
for _, dest := range a.destinations {
|
||||
dest := dest.Append("/" + src.Box() + "/" + src.Path())
|
||||
if dest.Online() {
|
||||
if err := dest.Mkdir(); err != nil {
|
||||
dest2 := dest.Append("/" + src.Box() + "/" + src.Path())
|
||||
if dest2.Online() {
|
||||
if err := dest2.Mkdir(); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "call": "Mkdir", "attr": dest, "error": err}).Errorf("")
|
||||
return err
|
||||
}
|
||||
|
||||
if err := TransferZfs(src, dest); err != nil {
|
||||
if err := TransferZfs(src, dest2); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "call": "TransferZfs", "src": src, "dest": dest, "error": err}).Errorf("")
|
||||
return err
|
||||
}
|
||||
if err := dest.SetManaged(true); err != nil {
|
||||
if err := dest2.SetManaged(true); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "call": "SetManaged", "src": src, "dest": dest, "error": err}).Errorf("")
|
||||
return err
|
||||
}
|
||||
backedUp = true
|
||||
}
|
||||
}
|
||||
if err := src.SetBackedUp(true); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "call": "SetBackedUp", "src": src, "error": err}).Errorf("")
|
||||
return err
|
||||
if backedUp {
|
||||
if err := src.SetBackedUp(true); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "call": "SetBackedUp", "src": src, "error": err}).Errorf("")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user