[pve-devel] [PATCH container 1/5] Adjust snapshot_create and snapshot_prepare signatures
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Feb 22 13:08:57 CET 2016
Add new save_vmstate parameter to snapshot_create and
snapshot_prepare, like in QemuServer.pm
Also make snapshot_prepare and snapshot_commit proper subs.
---
src/PVE/API2/LXC/Snapshot.pm | 2 +-
src/PVE/LXC.pm | 18 +++++++++---------
src/PVE/VZDump/LXC.pm | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/PVE/API2/LXC/Snapshot.pm b/src/PVE/API2/LXC/Snapshot.pm
index 49fd4f5..4da2d87 100644
--- a/src/PVE/API2/LXC/Snapshot.pm
+++ b/src/PVE/API2/LXC/Snapshot.pm
@@ -128,7 +128,7 @@ __PACKAGE__->register_method({
my $realcmd = sub {
PVE::Cluster::log_msg('info', $authuser, "snapshot container $vmid: $snapname");
- PVE::LXC::snapshot_create($vmid, $snapname, $param->{description});
+ PVE::LXC::snapshot_create($vmid, $snapname, 0, $param->{description});
};
return $rpcenv->fork_worker('pctsnapshot', $vmid, $authuser, $realcmd);
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index a1fb746..2aaa6a7 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1748,8 +1748,8 @@ my $snapshot_copy_config = sub {
}
};
-my $snapshot_prepare = sub {
- my ($vmid, $snapname, $comment) = @_;
+sub snapshot_prepare {
+ my ($vmid, $snapname, $save_vmstate, $comment) = @_;
my $snap;
@@ -1786,9 +1786,9 @@ my $snapshot_prepare = sub {
lock_config($vmid, $updatefn);
return $snap;
-};
+}
-my $snapshot_commit = sub {
+sub snapshot_commit {
my ($vmid, $snapname) = @_;
my $updatefn = sub {
@@ -1812,8 +1812,8 @@ my $snapshot_commit = sub {
write_config($vmid, $conf);
};
- lock_config($vmid ,$updatefn);
-};
+ lock_config($vmid, $updatefn);
+}
sub has_feature {
my ($feature, $conf, $storecfg, $snapname) = @_;
@@ -1908,9 +1908,9 @@ sub sync_container_namespace {
}
sub snapshot_create {
- my ($vmid, $snapname, $comment) = @_;
+ my ($vmid, $snapname, $save_vmstate, $comment) = @_;
- my $snap = &$snapshot_prepare($vmid, $snapname, $comment);
+ my $snap = snapshot_prepare($vmid, $snapname, $save_vmstate, $comment);
my $conf = load_config($vmid);
@@ -1947,7 +1947,7 @@ sub snapshot_create {
die "$err\n";
}
- &$snapshot_commit($vmid, $snapname);
+ snapshot_commit($vmid, $snapname);
}
# Note: $drivehash is only set when called from snapshot_create.
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index 0979f15..1d24036 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -211,7 +211,7 @@ sub snapshot {
$self->loginfo("create storage snapshot 'vzdump'");
# todo: freeze/unfreeze if we have more than one volid
- PVE::LXC::snapshot_create($vmid, 'vzdump', "vzdump backup snapshot");
+ PVE::LXC::snapshot_create($vmid, 'vzdump', 0, "vzdump backup snapshot");
$task->{cleanup}->{remove_snapshot} = 1;
# reload config
--
2.1.4
More information about the pve-devel
mailing list