VM migration leaves junk in pool database

Jul 31, 2023
13
3
8
I have migrated a VM (in my case the one with ID 104) from one cluster to another. I noticed that the pool was not transferred. I didn't find this so tragic and then manually assigned the VM to the pool on the new cluster. However, the pool config on the old cluster seems to have retained some of the VM. When I run
Code:
pvesh get /cluster/resources --type vm --output-format json | jq
, I get the error message
Code:
user config - ignore duplicate vmid ‘104’ in pool 'team-abc'
.
This is because there is now a new VM with ID 104 on the old cluster.
 
I have found the cause of the error message, but I do not have a solution.


When migrating a VM from one cluster to another using pdm, the pool assignment of the ID in the /etc/pve/user.cfg file is retained.

You have to delete it manually after the migration, otherwise an ID is in two pools at the same time, which is not possible.

In my case, this was done by cloning a VM, but it should also happen when creating a VM, as all the old IDs are still in my user.cfg.
 
The issue arises because the pool configuration on the old Proxmox cluster still references VM ID 104 as a member of the team-abc pool, even though that VM has been migrated to a new cluster and manually added to a pool there.


After migration, if VM ID 104 is reused on the old cluster (even for a different VM), Proxmox detects a conflict: it sees two VMs with the same VMID assigned to the same pool (due to the leftover configuration), which isn't allowed. This results in the following error:


user config - ignore duplicate vmid ‘104’ in pool 'team-abc'



️ Resolution StepsTo resolve this, you’ll need to remove the stale VM pool association from the old cluster
  • Check the current pool members on the old cluster:

    pvesh get /pools/team-abc
    This lists all VMs and containers assigned to the team-abc pool.
  • Remove VM ID 104 from the pool (if it's listed):

    pvesh delete /pools/team-abc -vmid 104
    ⚠️ This will not delete the VM—it simply removes its association with the pool.
  • Verify removal:

    pvesh get /pools/team-abc
    Confirm that VM 104 no longer appears in the list.
  • Re-run the original command to confirm the error is resolved:

    pvesh get /cluster/resources --type vm --output-format json | jq


Proxmox pools are defined in the user.cfg file, which is cluster-wide. If you migrate a VM between two separate clusters (not part of the same Proxmox cluster), the pool association from the old cluster isn't automatically removed. Reusing the same VMID without updating pool entries can lead to these kinds of conflicts.
 
The issue arises because the pool configuration on the old Proxmox cluster still references VM ID 104 as a member of the team-abc pool, even though that VM has been migrated to a new cluster and manually added to a pool there.


After migration, if VM ID 104 is reused on the old cluster (even for a different VM), Proxmox detects a conflict: it sees two VMs with the same VMID assigned to the same pool (due to the leftover configuration), which isn't allowed. This results in the following error:


user config - ignore duplicate vmid ‘104’ in pool 'team-abc'



️ Resolution StepsTo resolve this, you’ll need to remove the stale VM pool association from the old cluster​

  • Check the current pool members on the old cluster:

    pvesh get /pools/team-abc
    This lists all VMs and containers assigned to the team-abc pool.
  • Remove VM ID 104 from the pool (if it's listed):

    pvesh delete /pools/team-abc -vmid 104
  • Verify removal:

    pvesh get /pools/team-abc
    Confirm that VM 104 no longer appears in the list.
  • Re-run the original command to confirm the error is resolved:

    pvesh get /cluster/resources --type vm --output-format json | jq


Proxmox pools are defined in the user.cfg file, which is cluster-wide. If you migrate a VM between two separate clusters (not part of the same Proxmox cluster), the pool association from the old cluster isn't automatically removed. Reusing the same VMID without updating pool entries can lead to these kinds of conflicts.
Thank you for paraphrasing my bug report using an AI. That is very helpful.

Just found out that it's already in the bug tracker, so the thread can be closed here.
https://bugzilla.proxmox.com/show_bug.cgi?id=6245
 
  • Like
Reactions: Johannes S