Migrate a VM between two Proxmox Cluster

perriot

New Member
Jun 14, 2013
4
0
1
Hello,

we have to migrate our VMs between two Proxmox clusters (clusterA/clusterB).
To do it, we will have the same backup storage defined in the 2 clusters.
And we want to do the migration by a backup on the clusterA and a restore on the clusterB.

Firstly, is it the good way to migrate a VM between two clusters ?

Secondly, as we have to do it several times, we want to have an automatic procedure to do it.
About this procedure I have two questions:

Firstly, for the backup we want to use the REST API ( POST /api2/json/nodes/{node}/vzdump )
But how to get the archive file name created with the API ?
For me, the only way seems to be parsing the task logs.
But is there a better solution ? (logs parsing is never a stable solution)

Secondly, I don't find how to do a restore with the REST API.
Did I miss something in the REST API documentation ? ( I use http://pve.proxmox.com/pve2-api-doc/ )
If I can’t do the restore by the REST API, what do you suggest me to do ?

Thanks in advance for your help,

Olivier
 
Firstly, is it the good way to migrate a VM between two clusters ?
Depending on the kind of storage you're using that's probably easier than copying the storage data & configs manually, which is another option.

Secondly, as we have to do it several times, we want to have an automatic procedure to do it
That's +1 for the backup&restore method.

Firstly, for the backup we want to use the REST API ( POST /api2/json/nodes/{node}/vzdump )
But how to get the archive file name created with the API ?
You're right, this is currently an issue. However, the hook scripts do get the filename (via the TARFILE environment variable), so you could let the backup-end hook trigger the next stage of your migration script. (Which is actually nicer than polling the task status for its completion, as it's event-based then :) .) (See /etc/vzdump.conf's script option and the example at /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl for how to use it.)

Secondly, I don't find how to do a restore with the REST API.
Did I miss something in the REST API documentation ?
Shares the same entry as creating a new one: POST to /nodes/{node}/{qemu|lxc} and give it an archive argument in case of qemu, or set the restore flag in case of containers.