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

+2 -1
View File
@@ -36,7 +36,8 @@ in
IPMasquerade = "both";
};
};
networking.firewall.trustedInterfaces = [ "ve-+" ];
networking.firewall.trustedInterfaces =
[ (if config.networking.nftables.enable then "ve-*" else "ve-+") ];
networking.firewall.allowedTCPPorts = lib.optional (cfg.clusterPort != null) cfg.clusterPort;
systemd.services.slackerbot = {
+2 -1
View File
@@ -83,7 +83,7 @@ type Bot struct {
type incoming struct {
user, channel, ts, threadTS, text string
dm bool
heard bool
heard bool
}
func (m incoming) owner() (string, model.OwnerKind) {
@@ -268,6 +268,7 @@ func (b *Bot) onMessage(ctx context.Context, m incoming) {
Channel: m.channel, ThreadTS: root, OwnerID: u.ID,
ACPID: id, Title: title(m.text), CreatedAt: time.Now(),
})
log.Printf("thread: new thread %s/%s for %s %s (started by %s, session %s)", m.channel, root, u.Kind, u.ID, m.user, id)
if w := b.where(ctx, m.channel); w != "" {
text = "(You're in " + w + ". Each message starts with the sender's name.)\n" + text
}
+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)
}