]> git.proxmox.com Git - qemu-server.git/commitdiff
add snapshot time stamp
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 11 Sep 2012 06:45:39 +0000 (08:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 11 Sep 2012 06:45:39 +0000 (08:45 +0200)
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index a928c4cd7a4b62601d31cd6b3da1c22af0673a21..9c6d71426c25daf91383f36975a122d1cc1df2e5 100644 (file)
@@ -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;
        }
index 6b6a7e64e3bbdb39071933a380cd938db0d49d2a..9f554604b9aae858dd8bb940612ed33cce1c341a 100644 (file)
@@ -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);