Create pool and copy pool membership to destination cluster
Urth opened this issue · comments
Harm Geerts commented
We have all virtual machine organised in proxmox pools and it would be great if proxmove would create the pool and add the VM as a member on the destination cluster.
Walter Doekes commented
from proxmoxer import ProxmoxAPI
hostname = ''
api = ProxmoxAPI(hostname, port=8006, user='xxx', password='xxx', verify_ssl=False)
api.pools.get() # [{'poolid': 'pool1'}, ...]
# Requires additional perms:
# - "/pool", "USER", "PVEPoolAdmin" (for: Pool.Audit)
api.pools('osso').get() # {'members': [{'vmid': 164}, ...]}
# Requires additional perms:
# - "/pool", "USER", "PVEPoolAdmin" (for: Pool.Allocate)
api.pools.create(poolid='foobar')
api.pools('foobar').get() # {'members': []}
# Adding/removing members:
api.pools('foobar').put(vms='124')
api.pools('foobar').put(vms='124', delete=1)
api.pools('foobar').put(vms='124,152')
# Checking for existence:
try:
api.pools('foobar2').get()
except proxmoxer.core.ResourceException: # 500, 'foobar2' does not exist
pass
Walter Doekes commented