mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-07-23 13:39:55 +00:00
fix #3424: api: snapshot delete: wait for active replication
A to-be-deleted snapshot might be actively used by replication, resulting in a not (or only partially) removed snapshot and locked (snapshot-delete) VM. Simply wait a few seconds for any ongoing replication. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
7979bbcd43
commit
fdbbed2fac
@ -4580,11 +4580,19 @@ __PACKAGE__->register_method({
|
|||||||
|
|
||||||
my $snapname = extract_param($param, 'snapname');
|
my $snapname = extract_param($param, 'snapname');
|
||||||
|
|
||||||
my $realcmd = sub {
|
my $do_delete = sub {
|
||||||
PVE::Cluster::log_msg('info', $authuser, "delete snapshot VM $vmid: $snapname");
|
PVE::Cluster::log_msg('info', $authuser, "delete snapshot VM $vmid: $snapname");
|
||||||
PVE::QemuConfig->snapshot_delete($vmid, $snapname, $param->{force});
|
PVE::QemuConfig->snapshot_delete($vmid, $snapname, $param->{force});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
my $realcmd = sub {
|
||||||
|
if ($param->{force}) {
|
||||||
|
$do_delete->();
|
||||||
|
} else {
|
||||||
|
PVE::GuestHelpers::guest_migration_lock($vmid, 10, $do_delete);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return $rpcenv->fork_worker('qmdelsnapshot', $vmid, $authuser, $realcmd);
|
return $rpcenv->fork_worker('qmdelsnapshot', $vmid, $authuser, $realcmd);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user