[pve-devel] [PATCH pve-guest-common] Add new function delete_guest_states.

Wolfgang Link w.link at proxmox.com
Tue Jun 27 12:20:23 CEST 2017


---
 PVE/ReplicationState.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index 5401db6..5e72d6e 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -147,6 +147,18 @@ sub record_job_start {
     write_job_state($jobcfg, $state);
 }
 
+sub delete_guest_states {
+    my ($vmid) = @_;
+
+    my $code = sub {
+	my $stateobj = read_state();
+	delete $stateobj->{$vmid};
+	PVE::Tools::file_set_contents($state_path, encode_json($stateobj));
+    };
+
+    PVE::Tools::lock_file($state_lock, 10, $code);
+}
+
 sub record_job_end {
     my ($jobcfg, $state, $start_time, $duration, $err) = @_;
 
-- 
2.11.0





More information about the pve-devel mailing list