[Bug] Site Recovery and cross-cluster replication give a remote migration one hour, whatever its size
Describe the bug
Two more places give a remote migration a fixed time, then take its token away. I found them by reading the code while working on the token of the manual cross-cluster migration (#1348). I have not run either of them.
-
Site Recovery,
_migrate_vm_cross_clusterinpegaprox/background/site_recovery.py. The token of the migration is deleted after a fixed hour, without a look at the task:def _delayed_cleanup(): time.sleep(3600) # 1h grace - large disks (1TB+) need time ... gevent.spawn(ha.as_job(_delayed_cleanup, f'token cleanup for {vmid}'))A failover migration that copies for more than an hour loses its token and ends with
401 Unauthorized. One that ends in two minutes leaves a token with the rights of its user on the target for an hour. -
Cross-cluster replication,
_execute_replicationinpegaprox/api/vms.py. The run waits for the migration with_wait_for_task(source_mgr, mig_task, timeout=3600). When that wait times out, the job is marked as failed and thefinallyblock deletes the token, with the task still running. A first full copy of more than an hour is cut the same way.
Steps to Reproduce
Not reproduced on a cluster. By reading: a Site Recovery failover, or the first run of a cross-cluster replication, of a guest whose disks take more than an hour to copy.
Expected behavior
The token stays until the task has ended, and goes then, as for the manual migration. The function of #1349 (drop_token_when_done) takes the source, the target, the token name and the UPID, so both places could call it.
Environment
- PegaProx Version: 1.4.1, and
Testingat e320c541 - Installation Method: apt
- OS: Debian 13
- Browser: not involved
- Behind Reverse Proxy? Yes
- UI? not involved
Confirmed by reading as well: _delayed_cleanup in site_recovery.py drops the token after a fixed hour without looking at the task, and _execute_replication gives the migration 3600 s and its finally deletes the token while the task may still be copying. Sending both through the same "task has ended" check as #1349 makes sense. Noted together with that one.
Marcus
Released in 1.5.0. Site Recovery and cross-cluster replication no longer cut a remote migration off after a fixed hour. Thanks, closing.