[pve-devel] [PATCH] Add qga freeze in vzdump in snapshot mode
Wolfgang Link
wolfgang at linksystems.org
Tue Dec 9 08:07:03 CET 2014
it will freeze the filesystem to provide consistents.
Signed-off-by: Wolfgang Link <wolfgang at linksystems.org>
---
PVE/VZDump/QemuServer.pm | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index fd36c69..2c62de3 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -286,8 +286,8 @@ sub archive {
my $resume_on_backup;
my $skiplock = 1;
-
- if (!PVE::QemuServer::check_running($vmid)) {
+ my $vm_is_running = PVE::QemuServer::check_running($vmid);
+ if (!$vm_is_running) {
eval {
$self->loginfo("starting kvm to execute backup task");
PVE::QemuServer::vm_start($self->{storecfg}, $vmid, undef,
@@ -380,8 +380,23 @@ sub archive {
$qmpclient->queue_cmd($vmid, $add_fd_cb, 'getfd',
fd => $outfileno, fdname => "backup");
+
+ my $freeze_fs = 0;
+
+ if ( $self->{vmlist}->{$vmid}->{agent} == 1 && $vm_is_running ){
+ $freeze_fs = PVE::QemuServer::vm_mon_cmd($vmid,"guest-fsfreeze-freeze");
+ $self->loginfo("Can't freeze fs!")if ( defined($freeze_fs) && $freeze_fs == 0 );
+ }
+
$qmpclient->queue_execute();
+ my $thaw_fs = 0;
+ $thaw_fs= PVE::QemuServer::vm_mon_cmd($vmid,"guest-fsfreeze-thaw")
+ if ( $freeze_fs > 0 );
+
+ $self->loginfo("Error by trying thaw fs, you must unlock manually")
+ if ( $freeze_fs > 0 && 0 != $freeze_fs - $thaw_fs );
+
die $qmpclient->{errors}->{$vmid} if $qmpclient->{errors}->{$vmid};
if ($cpid) {
--
1.7.10.4
More information about the pve-devel
mailing list