[pve-devel] [PATCH container 1/2] Make snapshot_save_vmstate a proper sub

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Feb 25 15:52:55 CET 2016


---
 src/PVE/LXC.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index dcec775..970bd02 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1800,9 +1800,9 @@ my $snapshot_apply_config = sub {
     return $newconf;
 };
 
-my $snapshot_save_vmstate = sub {
+sub snapshot_save_vmstate {
     die "implement me - snapshot_save_vmstate\n";
-};
+}
 
 sub snapshot_prepare {
     my ($vmid, $snapname, $save_vmstate, $comment) = @_;
@@ -1828,11 +1828,12 @@ sub snapshot_prepare {
 	# workaround until mp snapshots are implemented
 	my $feature = $snapname eq 'vzdump' ? 'vzdump' : 'snapshot';
 	die "snapshot feature is not available\n" if !has_feature($feature, $conf, $storecfg);
+	my $running = check_running($vmid);
 
 	$snap = $conf->{snapshots}->{$snapname} = {};
 
-	if ($save_vmstate && check_running($vmid)) {
-	    &$snapshot_save_vmstate($vmid, $conf, $snapname, $storecfg);
+	if ($save_vmstate && $running) {
+	    snapshot_save_vmstate($vmid, $conf, $snapname, $storecfg);
 	}
 
 	&$snapshot_copy_config($conf, $snap);
-- 
2.1.4





More information about the pve-devel mailing list