Always clean stale taps before creating new ones
deleteTap before createTap in all four call sites: snapshot restore, cold boot, agent start, snapshot create. Prevents "Device or resource busy" from leftover taps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -268,6 +268,7 @@ export async function startAgent(
|
||||
// Setup network
|
||||
ensureBridge();
|
||||
ensureNat();
|
||||
deleteTap(tapDevice); // clean stale tap from previous run
|
||||
createTap(tapDevice);
|
||||
|
||||
// Boot VM
|
||||
|
||||
@@ -63,6 +63,7 @@ export async function createSnapshot() {
|
||||
log("Setting up network...");
|
||||
ensureBridge();
|
||||
ensureNat();
|
||||
deleteTap(snap.tapDevice); // clean stale tap from previous run
|
||||
createTap(snap.tapDevice);
|
||||
|
||||
let proc: ChildProcess | null = null;
|
||||
|
||||
@@ -78,6 +78,7 @@ export class VMInstance {
|
||||
log(verbose, `VM ${id}: restoring from snapshot...`);
|
||||
ensureBridge();
|
||||
ensureNat();
|
||||
deleteTap(snap.tapDevice); // clean stale tap from previous run
|
||||
createTap(snap.tapDevice);
|
||||
|
||||
// Spawn firecracker and load snapshot
|
||||
@@ -155,6 +156,7 @@ export class VMInstance {
|
||||
log(verbose, `VM ${id}: creating tap ${tapDevice}...`);
|
||||
ensureBridge();
|
||||
ensureNat();
|
||||
deleteTap(tapDevice); // clean stale tap from previous run
|
||||
createTap(tapDevice);
|
||||
|
||||
log(verbose, `VM ${id}: booting...`);
|
||||
|
||||
Reference in New Issue
Block a user