[pve-devel] [PATCH] savevm-end : wait that savevm is finished

Alexandre DERUMIER aderumier at odiso.com
Fri Nov 21 10:06:01 CET 2014


>>What exactly is async in 'savevm-end'?

In this case, with my other patch,
if user cancel the proxmox snapshot task, the coroutine continue to run in active status.
So we catch the eval and we call savevm-end.

if status==active, I set a new status cancelled and the savevm_end return and it's async.


 +static const QEMUFileOps block_file_ops = {
@@ -677,6 +683,11 @@ Index: new/savevm-async.c
 +        return;
 +    }
 +
++    if (snap_state.state == SAVE_STATE_ACTIVE) {
++        snap_state.state = SAVE_STATE_CANCELLED;
++        return;
++    }
++
 +    if (snap_state.saved_vm_running) {
 +        vm_start();
 +    }


But the coroutine has not yet finished to cleanup and close the vm state file

@@ -588,6 +589,11 @@ Index: new/savevm-async.c
 +            }
 +        }
 +    }
++    if(snap_state.state == SAVE_STATE_CANCELLED) {
++        save_snapshot_completed();
++        Error *errp = NULL;
++        qmp_savevm_end(&errp);
++    }
 +}

So, I wait after savevm_end, to be sure that the vmstate state is closed, to be able to delete it in case of an abort.





>>So maybe we need to wait with 'query-savevm' before we call 'savevm-end'? 

Wait for which status ? I think that if user want to cancel job, we should do it without waiting.


----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Vendredi 21 Novembre 2014 08:53:54 
Objet: RE: [pve-devel] [PATCH] savevm-end : wait that savevm is finished 

> savevm-end is async, we need to wait that savevm is finished, before continue. 

What exactly is async in 'savevm-end'? Instead, I thought 'savevm-start' is async? 

---code-------- 
void qmp_savevm_end(Error **errp) 
{ 
if (snap_state.state == SAVE_STATE_DONE) { 
error_set(errp, ERROR_CLASS_GENERIC_ERROR, 
"VM snapshot not started\n"); 
return; 
} 

if (snap_state.saved_vm_running) { 
vm_start(); 
} 

snap_state.state = SAVE_STATE_DONE; 
} 
---------------- 

IMHO, this is synchronous, and it is wrong to call while 'savevm-start' is 
still running (will cancel savevm)? 

So maybe we need to wait with 'query-savevm' before we call 'savevm-end'? 


More information about the pve-devel mailing list