hasResource($run, 'backup_job_id')) { return StepResult::advance(); } $instance = $this->instance($run); $schedule = '02:00'; // Proxmox calendar-event: daily at 02:00 // Create a real scheduled vzdump job on the host [E] before recording it. $jobId = $this->pve->forHost($instance->host) ->createBackupJob((string) $run->context('node'), (int) $instance->vmid, $schedule); // Create the local row BEFORE the breadcrumb — the breadcrumb is the // short-circuit guard, so if it exists the row must already exist too. // firstOrCreate on the deterministic job id keeps a retry duplicate-free. $instance->backups()->firstOrCreate( ['external_job_id' => $jobId], ['schedule' => $schedule, 'status' => 'scheduled'], ); $this->recordResource($run, $instance->host, 'backup_job_id', $jobId); return StepResult::advance(); } }