Skip to content

prevent reuse of proxmox ids - #127

Open
addidotlol wants to merge 4 commits into
mainfrom
addison/fix-deletion-v2
Open

addidotlol wants to merge 4 commits into
mainfrom
addison/fix-deletion-v2

Conversation

@addidotlol

@addidotlol addidotlol commented Sep 20, 2026

Copy link
Copy Markdown
Member

do not merge

- Allocate Proxmox VM IDs from a database sequence
- Enforce unique active Proxmox IDs and reconcile duplicates
- Preserve VM identity across backend provisioning and deletion flows
- Allow repeated deletion requests to be re-queued safely
- Require stable VM tags when resolving Proxmox resources
- Cache config lookups and use stable IDs consistently
@addidotlol addidotlol changed the title Prevent Proxmox VM ID reuse during deletion prevent reuse of proxmox ids Sep 20, 2026
@addidotlol
addidotlol marked this pull request as draft September 20, 2026 19:26
- Close VM meters before marking resources for deletion
- Delete billing entities only after usage events are synced
- Verify Proxmox ownership and exclude deleting VMs from metering
@addidotlol
addidotlol marked this pull request as ready for review September 20, 2026 20:27
{
id: ulidPk(),
name: text('name').notNull(),
proxmoxId: integer('proxmox_id'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to convert this to a identity column starting at 1000?

return resources.filter((r) => r.type === 'qemu').map((r) => this.resourceToInfo(r));
}

async listUsedProxmoxIds(): Promise<number[]> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return a Set?

const [nodes, vmid] = await Promise.all([this.client.listNodes(), this.client.getNextVmId()]);
const [nodes, vmid] = await Promise.all([
this.client.listNodes(),
params.proxmoxId ?? this.client.getNextVmId()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a valid usecase for having the client pick the proxmox id? Shouldn't this always come from a DB sequence? If so, please make proxmoxId on the params type non-null.

- Remove Proxmox next-ID API usage
- Return used VM IDs as a Set for allocation checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants