logging + networking fix

This commit is contained in:
ari committed 2026-11-01 14:04:15 -05:00
1 parent 092ef6185f
commit 563dd7a759
4 files changed
+21 -4

No files matched your search

+14 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log"
"math"
"sort"
"sync"
@@ -210,7 +211,13 @@ func (m *Manager) Ensure(ctx context.Context, id string, kind model.OwnerKind) (
if !v.Used.Add(u.Size).Fits(v.Usable) {
return u, &node.NodeFullError{Node: u.Node}
}
return u, n.Start(ctx, m.spec(u))
log.Printf("container: starting %s for %s %s on %s (drive %s, %s)", u.Machine, u.Kind, u.ID, u.Node, u.Drive, u.Size)
if err := n.Start(ctx, m.spec(u)); err != nil {
log.Printf("container: starting %s on %s failed: %v", u.Machine, u.Node, err)
return u, err
}
log.Printf("container: %s is running on %s", u.Machine, u.Node)
return u, nil
}
// The old home folder stays on its node, untouched.
@@ -253,7 +260,12 @@ func (m *Manager) Poweroff(ctx context.Context, u *model.Owner) error {
if err != nil {
return err
}
return n.Poweroff(ctx, u.Machine)
log.Printf("container: shutting down %s for %s %s on %s", u.Machine, u.Kind, u.ID, u.Node)
if err := n.Poweroff(ctx, u.Machine); err != nil {
log.Printf("container: shutting down %s on %s failed: %v", u.Machine, u.Node, err)
return err
}
return nil
}
func (m *Manager) RunningOwners(ctx context.Context) []model.Owner {
+3
View File
@@ -110,6 +110,7 @@ func (m *Manager) Migrate(ctx context.Context, id string, opts MoveOptions) (*Mo
_ = src.CloseExport(context.Background(), e)
}
if stopped {
log.Printf("container: restarting %s on %s after a failed move", u.Machine, u.Node)
if err := src.Start(context.Background(), m.spec(u)); err != nil {
return res, fmt.Errorf("%w (and restarting it on %s failed: %v)", cause, u.Node, err)
}
@@ -151,6 +152,7 @@ func (m *Manager) Migrate(ctx context.Context, id string, opts MoveOptions) (*Mo
if opts.WaitIdle != nil {
opts.WaitIdle(ctx)
}
log.Printf("container: shutting down %s on %s to move it to %s", u.Machine, u.Node, target)
if err := src.Poweroff(ctx, u.Machine); err != nil {
return rollback(err)
}
@@ -185,6 +187,7 @@ func (m *Manager) Migrate(ctx context.Context, id string, opts MoveOptions) (*Mo
return res, nil
}
progress(PhaseStart, copied)
log.Printf("container: starting %s on %s after the move from %s", u.Machine, target, oldNode)
if err := dst.Start(ctx, m.spec(u)); err != nil {
return res, fmt.Errorf("moved to %s, but starting it there failed: %w", target, err)
}