From 982c7f1273dc2c80206f83c534f8ffe64da1c659 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 11 Sep 2012 08:45:39 +0200 Subject: [PATCH] add snapshot time stamp --- PVE/API2/Qemu.pm | 6 +++++- PVE/QemuServer.pm | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index a928c4cd..9c6d7142 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1919,7 +1919,11 @@ __PACKAGE__->register_method({ foreach my $name (keys %$snaphash) { my $d = $snaphash->{$name}; - my $item = { name => $name, description => $d->{description} }; + my $item = { + name => $name, + snaptime => $d->{snaptime} || 0, + description => $d->{description} || '', + }; $item->{parent} = $d->{parent} if $d->{parent}; push @$res, $item; } diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 6b6a7e64..9f554604 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -394,6 +394,12 @@ EODESCR optional => 1, description => "Parent snapshot name. This is used internally, and should not be modified.", }), + snaptime => { + optional => 1, + description => "Timestamp for snapshots.", + type => 'integer', + minimum => 0, + }, }; # what about other qemu settings ? @@ -1393,6 +1399,7 @@ sub json_config_properties { my $prop = shift; foreach my $opt (keys %$confdesc) { + next if $opt eq 'parent' || $opt eq 'snaptime'; $prop->{$opt} = $confdesc->{$opt}; } @@ -3574,6 +3581,8 @@ my $snapshot_copy_config = sub { foreach my $k (keys %$source) { next if $k eq 'snapshots'; + next if $k eq 'snapstate'; + next if $k eq 'snaptime'; next if $k eq 'lock'; next if $k eq 'digest'; next if $k =~ m/^unused\d+$/; @@ -3641,6 +3650,7 @@ my $snapshot_prepare = sub { $snap = $conf->{snapshots}->{$snapname} = { snapstate => "prepare", + snaptime => time(), }; &$snapshot_copy_config($conf, $snap);