Skip to content

Commit c8f18bd

Browse files
author
Rafael Garcia
committed
liveness / reconciliation on startup
1 parent 0131bce commit c8f18bd

File tree

9 files changed

+2464
-113
lines changed

9 files changed

+2464
-113
lines changed

cmd/api/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ func run() error {
173173
logger.Info("Network manager initialized")
174174

175175
// Reconcile device state (clears orphaned attachments from crashed VMs)
176+
// Set up liveness checker so device reconciliation can accurately detect orphaned attachments
176177
logger.Info("Reconciling device state...")
178+
livenessChecker := instances.NewLivenessChecker(app.InstanceManager)
179+
if livenessChecker != nil {
180+
app.DeviceManager.SetLivenessChecker(livenessChecker)
181+
}
177182
if err := app.DeviceManager.ReconcileDevices(app.Ctx); err != nil {
178183
logger.Error("failed to reconcile device state", "error", err)
179184
return fmt.Errorf("reconcile device state: %w", err)

lib/devices/gpu_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func TestGPUPassthrough(t *testing.T) {
249249
if execErr != nil {
250250
// Print console log for debugging
251251
p := paths.New(tmpDir)
252-
consoleLogPath := p.InstanceConsoleLog(inst.Id)
252+
consoleLogPath := p.InstanceAppLog(inst.Id)
253253
if consoleLog, err := os.ReadFile(consoleLogPath); err == nil {
254254
t.Logf("=== VM Console Log ===\n%s\n=== End Console Log ===", string(consoleLog))
255255
} else {

lib/devices/gpu_inference_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ func TestGPUInference(t *testing.T) {
400400

401401
if err != nil {
402402
// Log console for debugging
403-
consoleLogPath := p.InstanceConsoleLog(inst.Id)
403+
consoleLogPath := p.InstanceAppLog(inst.Id)
404404
if consoleLog, readErr := os.ReadFile(consoleLogPath); readErr == nil {
405405
t.Logf("=== VM Console Log ===\n%s\n=== End ===", truncateTail(string(consoleLog), 3000))
406406
}

0 commit comments

Comments
 (0)