proxmox: Delete with seed cleanup, health Checker, CRD type comment

Delete stops and destroys a VM of ours under the per-name lock, then
deletes its seed on the VM's node, or on every node when no VM of ours
was left. A hibernated VM of ours is Permanent, as in Create. The
Checker verifies each node concurrently (version, node status, ISO
storage, templates) and adds CertificateInvalid, CredentialsUnavailable,
StorageNotFound and TemplateNotFound to the shared reasons. The
ProviderHealth type comment gains proxmox.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-23 20:14:14 +00:00
co-authored by Claude Opus 5.5
parent 34f132d421
commit 2f89c1fffb
13 changed files with 1936 additions and 46 deletions
+10 -5
View File
@@ -39,9 +39,10 @@ type fakeAPI struct {
// taskPolls is how many TaskStatus polls answer "running" before a
// task stops.
taskPolls int
// cloneFailsWith and startFailsWith, when set, are the exitstatus of
// every clone or start task. A failed clone removes its VM.
cloneFailsWith, startFailsWith string
// cloneFailsWith, startFailsWith and destroyFailsWith, when set, are
// the exitstatus of every clone, start or destroy task. A failed clone
// removes its VM; a failed destroy keeps it.
cloneFailsWith, startFailsWith, destroyFailsWith string
// agentNotRunning makes the agent of every running VM with agent=1
// answer "QEMU guest agent is not running".
agentNotRunning bool
@@ -510,8 +511,12 @@ func (f *fakeAPI) Destroy(ctx context.Context, node string, vmid int) (string, e
if vm.status == "running" {
return "", fakeErr(500, fmt.Sprintf("fake: VM %d is running - destroy failed", vmid))
}
return f.newTask(node, "qmdestroy", strconv.Itoa(vmid), "OK", func() {
if f.vms[vmid] == vm {
exit := "OK"
if f.destroyFailsWith != "" {
exit = f.destroyFailsWith
}
return f.newTask(node, "qmdestroy", strconv.Itoa(vmid), exit, func() {
if exit == "OK" && f.vms[vmid] == vm {
delete(f.vms, vmid)
}
}), nil