mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-21 22:51:13 +02:00
With the fix #1904, it's now possible to upgrade 0.4.x with `machine.File` extra files (caused by registry mirror for registry.ci.svc). Bump resources for upgrade tests in attempt to speed it up. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package firecracker
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/talos-systems/talos/internal/pkg/provision"
|
|
"github.com/talos-systems/talos/internal/pkg/tail"
|
|
)
|
|
|
|
// CrashDump produces debug information to help with debugging failures.
|
|
func (p *provisioner) CrashDump(ctx context.Context, cluster provision.Cluster, out io.Writer) {
|
|
state, ok := cluster.(*state)
|
|
if !ok {
|
|
fmt.Fprintf(out, "error inspecting firecracker state, %#+v\n", cluster)
|
|
return
|
|
}
|
|
|
|
statePath, err := state.StatePath()
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error getting cluster state path: %s", err)
|
|
return
|
|
}
|
|
|
|
logFiles, err := filepath.Glob(filepath.Join(statePath, "*.log"))
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error finding log paths: %s\n", err)
|
|
return
|
|
}
|
|
|
|
for _, logFile := range logFiles {
|
|
name := filepath.Base(logFile)
|
|
|
|
fmt.Fprintf(out, "%s\n%s\n\n", name, strings.Repeat("=", len(name)))
|
|
|
|
f, err := os.Open(logFile)
|
|
if err != nil {
|
|
fmt.Fprintf(out, "error opening file: %s\n", err)
|
|
continue
|
|
}
|
|
|
|
if err = tail.SeekLines(f, 1000); err != nil {
|
|
fmt.Fprintf(out, "error seeking to the tail: %s\n", err)
|
|
}
|
|
|
|
_, _ = io.Copy(out, f) //nolint: errcheck
|
|
|
|
f.Close() //nolint: errcheck
|
|
}
|
|
}
|