1 package PVE
::VZDump
::QemuServer
;
12 use PVE
::Cluster
qw(cfs_read_file);
17 use PVE
::Storage
::Plugin
;
18 use PVE
::Storage
::PBSPlugin
;
25 use PVE
::QemuServer
::Machine
;
26 use PVE
::QemuServer
::Monitor
qw(mon_cmd);
28 use base qw
(PVE
::VZDump
::Plugin
);
31 my ($class, $vzdump) = @_;
33 PVE
::VZDump
::check_bin
('qm');
35 my $self = bless { vzdump
=> $vzdump }, $class;
37 $self->{vmlist
} = PVE
::QemuServer
::vzlist
();
38 $self->{storecfg
} = PVE
::Storage
::config
();
49 return [ keys %{$self->{vmlist
}} ];
53 my ($self, $task, $vmid, $mode) = @_;
57 my $conf = $self->{vmlist
}->{$vmid} = PVE
::QemuConfig-
>load_config($vmid);
59 $self->loginfo("VM Name: $conf->{name}")
60 if defined($conf->{name
});
62 $self->{vm_was_running
} = 1;
63 if (!PVE
::QemuServer
::check_running
($vmid)) {
64 $self->{vm_was_running
} = 0;
67 $task->{hostname
} = $conf->{name
};
69 my $hostname = PVE
::INotify
::nodename
();
73 my $backup_volumes = PVE
::QemuConfig-
>get_backup_volumes($conf);
75 foreach my $volume (@{$backup_volumes}) {
76 my $name = $volume->{key
};
77 my $volume_config = $volume->{volume_config
};
78 my $volid = $volume_config->{file
};
80 if (!$volume->{included
}) {
81 $self->loginfo("exclude disk '$name' '$volid' ($volume->{reason})");
83 } elsif ($self->{vm_was_running
} && $volume_config->{iothread
}) {
84 if (!PVE
::QemuServer
::Machine
::runs_at_least_qemu_version
($vmid, 4, 0, 1)) {
85 die "disk '$name' '$volid' (iothread=on) can't use backup feature with running QEMU " .
86 "version < 4.0.1! Either set backup=no for this drive or upgrade QEMU and restart VM\n";
89 my $log = "include disk '$name' '$volid'";
90 if (defined(my $size = $volume_config->{size
})) {
91 my $readable_size = PVE
::JSONSchema
::format_size
($size);
92 $log .= " $readable_size";
97 my ($storeid, $volname) = PVE
::Storage
::parse_volume_id
($volid, 1);
98 push @$vollist, $volid if $storeid;
99 $drivehash->{$name} = $volume->{volume_config
};
102 PVE
::Storage
::activate_volumes
($self->{storecfg
}, $vollist);
104 foreach my $ds (sort keys %$drivehash) {
105 my $drive = $drivehash->{$ds};
107 my $volid = $drive->{file
};
108 my ($storeid, $volname) = PVE
::Storage
::parse_volume_id
($volid, 1);
112 $path = PVE
::Storage
::path
($self->{storecfg
}, $volid);
116 my ($size, $format) = eval { PVE
::Storage
::volume_size_info
($self->{storecfg
}, $volid, 5) };
117 die "no such volume '$volid'\n" if $@;
125 qmdevice
=> "drive-$ds",
129 $diskinfo->{type
} = 'block';
131 $diskinfo->{type
} = 'file';
134 push @{$task->{disks
}}, $diskinfo;
139 my ($self, $vmid) = @_;
141 my $running = PVE
::QemuServer
::check_running
($vmid) ?
1 : 0;
143 return wantarray ?
($running, $running ?
'running' : 'stopped') : $running;
147 my ($self, $vmid) = @_;
149 PVE
::QemuConfig-
>set_lock($vmid, 'backup');
153 my ($self, $vmid) = @_;
155 PVE
::QemuConfig-
>remove_lock($vmid, 'backup');
159 my ($self, $task, $vmid) = @_;
161 my $opts = $self->{vzdump
}->{opts
};
163 my $wait = $opts->{stopwait
} * 60;
164 # send shutdown and wait
165 $self->cmd ("qm shutdown $vmid --skiplock --keepActive --timeout $wait");
169 my ($self, $task, $vmid) = @_;
171 $self->cmd ("qm start $vmid --skiplock");
175 my ($self, $task, $vmid) = @_;
177 $self->cmd ("qm suspend $vmid --skiplock");
181 my ($self, $task, $vmid) = @_;
183 $self->cmd ("qm resume $vmid --skiplock");
187 my ($self, $task, $vmid) = @_;
189 my $conffile = PVE
::QemuConfig-
>config_file($vmid);
191 my $outfile = "$task->{tmpdir}/qemu-server.conf";
192 my $firewall_src = "/etc/pve/firewall/$vmid.fw";
193 my $firewall_dest = "$task->{tmpdir}/qemu-server.fw";
195 my $outfd = IO
::File-
>new (">$outfile") ||
196 die "unable to open '$outfile'";
197 my $conffd = IO
::File-
>new ($conffile, 'r') ||
198 die "unable open '$conffile'";
202 while (defined (my $line = <$conffd>)) {
203 next if $line =~ m/^\#vzdump\#/; # just to be sure
204 next if $line =~ m/^\#qmdump\#/; # just to be sure
205 if ($line =~ m/^\[(.*)\]\s*$/) {
206 if ($1 =~ m/PENDING/i) {
212 next if $found_snapshot || $found_pending; # skip all snapshots and pending changes config data
214 if ($line =~ m/^unused\d+:\s*(\S+)\s*/) {
215 $self->loginfo("skip unused drive '$1' (not included into backup)");
218 next if $line =~ m/^lock:/ || $line =~ m/^parent:/;
223 foreach my $di (@{$task->{disks
}}) {
224 if ($di->{type
} eq 'block' || $di->{type
} eq 'file') {
225 my $storeid = $di->{storeid
} || '';
226 my $format = $di->{format
} || '';
227 print $outfd "#qmdump#map:$di->{virtdev}:$di->{qmdevice}:$storeid:$format:\n";
229 die "internal error";
233 if ($found_snapshot) {
234 $self->loginfo("snapshots found (not included into backup)");
236 if ($found_pending) {
237 $self->loginfo("pending configuration changes found (not included into backup)");
240 PVE
::Tools
::file_copy
($firewall_src, $firewall_dest) if -f
$firewall_src;
244 my ($self, $task, $vmid, $filename, $comp) = @_;
246 my $opts = $self->{vzdump
}->{opts
};
247 my $scfg = $opts->{scfg
};
249 if ($self->{vzdump
}->{opts
}->{pbs
}) {
250 $self->archive_pbs($task, $vmid);
252 $self->archive_vma($task, $vmid, $filename, $comp);
256 # number, [precision=1]
258 return sprintf( "%." . ( $_[1] || 1 ) . "f", $_[0] );
260 my sub bytes_to_human
{
261 my ($bytes, $precission) = @_;
263 return $num2str->($bytes, $precission) . ' B' if $bytes < 1024;
264 my $kb = $bytes/1024;
266 return $num2str->($kb, $precission) . " KiB" if $kb < 1024;
269 return $num2str->($mb, $precission) . " MiB" if $mb < 1024;
272 return $num2str->($gb, $precission) . " GiB" if $gb < 1024;
275 return $num2str->($tb, $precission) . " TiB";
277 my sub duration_to_human
{
280 return sprintf('%2ds', $seconds) if $seconds < 60;
281 my $minutes = $seconds / 60;
282 $seconds = $seconds % 60;
284 return sprintf('%2dm %2ds', $minutes, $seconds) if $minutes < 60;
285 my $hours = $minutes / 60;
286 $minutes = $minutes % 60;
288 return sprintf('%2dh %2dm %2ds', $hours, $minutes, $seconds) if $hours < 24;
289 my $days = $hours / 24;
290 $hours = $hours % 24;
292 return sprintf('%2dd %2dh %2dm', $days, $hours, $minutes);
295 my $bitmap_action_to_human = sub {
296 my ($self, $info) = @_;
298 my $action = $info->{action
};
300 if ($action eq "not-used") {
301 return "disabled (no support)" if $self->{vm_was_running
};
302 return "disabled (VM not running)";
303 } elsif ($action eq "not-used-removed") {
304 return "disabled (old bitmap cleared)";
305 } elsif ($action eq "new") {
306 return "created new";
307 } elsif ($action eq "used") {
308 if ($info->{dirty
} == 0) {
309 return "OK (drive clean)";
311 my $size = bytes_to_human
($info->{size
});
312 my $dirty = bytes_to_human
($info->{dirty
});
313 return "OK ($dirty of $size dirty)";
315 } elsif ($action eq "invalid") {
316 return "existing bitmap was invalid and has been cleared";
322 my $query_backup_status_loop = sub {
323 my ($self, $vmid, $job_uuid, $qemu_support) = @_;
325 my $starttime = time ();
326 my $last_time = $starttime;
327 my ($last_percent, $last_total, $last_target, $last_zero, $last_transferred) = (-1, 0, 0, 0, 0);
328 my ($transferred, $reused);
331 my ($mb, $delta) = @_;
332 return "0 B/s" if $mb <= 0;
333 my $bw = int(($mb / $delta));
334 return bytes_to_human
($bw) . "/s";
339 my $has_query_bitmap = $qemu_support && $qemu_support->{'query-bitmap-info'};
340 if ($has_query_bitmap) {
342 my $bitmap_info = mon_cmd
($vmid, 'query-pbs-bitmap-info');
343 foreach my $info (sort { $a->{drive
} cmp $b->{drive
} } @$bitmap_info) {
344 my $text = $bitmap_action_to_human->($self, $info);
345 my $drive = $info->{drive
};
346 $drive =~ s/^drive-//; # for consistency
347 $self->loginfo("$drive: dirty-bitmap status: $text");
348 $target += $info->{dirty
};
349 $total += $info->{size
};
350 $last_reused += $info->{size
} - $info->{dirty
};
352 if ($target < $total) {
353 my $total_h = bytes_to_human
($total);
354 my $target_h = bytes_to_human
($target);
355 $self->loginfo("using fast incremental mode (dirty-bitmap), $target_h dirty of $total_h total");
361 my $status = mon_cmd
($vmid, 'query-backup');
363 my $total = $status->{total
} || 0;
364 my $dirty = $status->{dirty
};
365 $target = (defined($dirty) && $dirty < $total) ?
$dirty : $total if !$has_query_bitmap;
366 $transferred = $status->{transferred
} || 0;
367 $reused = $status->{reused
};
368 my $percent = $target ?
int(($transferred * 100)/$target) : 100;
369 my $zero = $status->{'zero-bytes'} || 0;
371 die "got unexpected uuid\n" if !$status->{uuid
} || ($status->{uuid
} ne $job_uuid);
374 my $duration = $ctime - $starttime;
376 my $rbytes = $transferred - $last_transferred;
379 # reused includes zero bytes for PBS
380 $wbytes = $rbytes - ($reused - $last_reused);
382 $wbytes = $rbytes - ($zero - $last_zero);
385 my $timediff = ($ctime - $last_time) || 1; # fixme
386 my $mbps_read = $get_mbps->($rbytes, $timediff);
387 my $mbps_write = $get_mbps->($wbytes, $timediff);
388 my $target_h = bytes_to_human
($target);
389 my $transferred_h = bytes_to_human
($transferred);
391 if (!$has_query_bitmap && $first_round && $target != $total) { # FIXME: remove with PVE 7.0
392 my $total_h = bytes_to_human
($total);
393 $self->loginfo("using fast incremental mode (dirty-bitmap), $target_h dirty of $total_h total");
396 my $statusline = sprintf("%3d%% ($transferred_h of $target_h) in %s"
397 .", read: $mbps_read, write: $mbps_write", $percent, duration_to_human
($duration));
399 my $res = $status->{status
} || 'unknown';
400 if ($res ne 'active') {
401 $self->loginfo($statusline);
402 if ($res ne 'done') {
403 die (($status->{errmsg
} || "unknown error") . "\n") if $res eq 'error';
404 die "got unexpected status '$res'\n";
406 $last_target = $target if $target;
407 $last_total = $total if $total;
408 $last_zero = $zero if $zero;
409 $last_transferred = $transferred if $transferred;
412 if ($percent != $last_percent && ($timediff > 2)) {
413 $self->loginfo($statusline);
414 $last_percent = $percent;
415 $last_target = $target if $target;
416 $last_total = $total if $total;
417 $last_zero = $zero if $zero;
418 $last_transferred = $transferred if $transferred;
420 $last_reused = $reused;
423 $first_round = 0 if $first_round;
426 my $duration = time() - $starttime;
429 my $zero_per = $last_target ?
int(($last_zero * 100)/$last_target) : 0;
430 my $zero_h = bytes_to_human
($last_zero, 2);
431 $self->loginfo("backup is sparse: $zero_h (${zero_per}%) total zero data");
434 my $reused_h = bytes_to_human
($reused, 2);
435 my $reuse_per = int($reused * 100 / $last_total);
436 $self->loginfo("backup was done incrementally, reused $reused_h (${reuse_per}%)");
439 my $transferred_h = bytes_to_human
($transferred, 2);
441 my $mbps = $get_mbps->($transferred, $duration);
442 $self->loginfo("transferred $transferred_h in $duration seconds ($mbps)");
444 $self->loginfo("transferred $transferred_h in <1 seconds");
449 total
=> $last_total,
455 my ($self, $task, $vmid) = @_;
457 my $conffile = "$task->{tmpdir}/qemu-server.conf";
458 my $firewall = "$task->{tmpdir}/qemu-server.fw";
460 my $opts = $self->{vzdump
}->{opts
};
461 my $scfg = $opts->{scfg
};
463 my $starttime = time();
465 my $server = $scfg->{server
};
466 my $datastore = $scfg->{datastore
};
467 my $username = $scfg->{username
} // 'root@pam';
468 my $fingerprint = $scfg->{fingerprint
};
470 my $repo = "$username\@$server:$datastore";
471 my $password = PVE
::Storage
::PBSPlugin
::pbs_get_password
($scfg, $opts->{storage
});
472 my $keyfile = PVE
::Storage
::PBSPlugin
::pbs_encryption_key_file_name
($scfg, $opts->{storage
});
474 my $diskcount = scalar(@{$task->{disks
}});
475 if (PVE
::QemuConfig-
>is_template($self->{vmlist
}->{$vmid}) || !$diskcount) {
477 # FIXME: accumulate disk sizes to use for backup job (email) log
478 foreach my $di (@{$task->{disks
}}) {
479 if ($di->{type
} eq 'block' || $di->{type
} eq 'file') {
480 push @pathlist, "$di->{qmdevice}.img:$di->{path}";
482 die "implement me (type $di->{type})";
487 $self->loginfo("backup contains no disks");
490 local $ENV{PBS_PASSWORD
} = $password;
491 local $ENV{PBS_FINGERPRINT
} = $fingerprint if defined($fingerprint);
493 '/usr/bin/proxmox-backup-client',
495 '--repository', $repo,
496 '--backup-type', 'vm',
497 '--backup-id', "$vmid",
498 '--backup-time', $task->{backup_time
},
501 push @$cmd, "qemu-server.conf:$conffile";
502 push @$cmd, "fw.conf:$firewall" if -e
$firewall;
503 push @$cmd, @pathlist if scalar(@pathlist);
505 $self->loginfo("starting template backup");
506 $self->loginfo(join(' ', @$cmd));
513 # get list early so we die on unkown drive types before doing anything
514 my $devlist = _get_task_devlist
($task);
516 $self->enforce_vm_running_for_backup($vmid);
520 $SIG{INT
} = $SIG{TERM
} = $SIG{QUIT
} = $SIG{HUP
} = $SIG{PIPE
} = sub {
521 die "interrupted by signal\n";
524 my $qemu_support = eval { mon_cmd
($vmid, "query-proxmox-support") };
525 if (!$qemu_support) {
526 die "PBS backups are not supported by the running QEMU version. Please make "
527 . "sure you've installed the latest version and the VM has been restarted.\n";
530 my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
534 'backup-file' => $repo,
535 'backup-id' => "$vmid",
536 'backup-time' => $task->{backup_time
},
537 password
=> $password,
539 'config-file' => $conffile,
541 $params->{speed
} = $opts->{bwlimit
}*1024 if $opts->{bwlimit
};
542 $params->{fingerprint
} = $fingerprint if defined($fingerprint);
543 $params->{'firewall-file'} = $firewall if -e
$firewall;
545 $self->loginfo("enabling encryption");
546 $params->{keyfile
} = $keyfile;
547 $params->{encrypt
} = JSON
::true
;
549 $params->{encrypt
} = JSON
::false
;
552 $params->{'use-dirty-bitmap'} = JSON
::true
553 if $qemu_support->{'pbs-dirty-bitmap'} && $self->{vm_was_running
};
555 $params->{timeout
} = 60; # give some time to connect to the backup server
557 my $res = eval { mon_cmd
($vmid, "backup", %$params) };
559 $backup_job_uuid = $res->{UUID
} if $res;
562 $self->qga_fs_thaw($vmid);
565 die $qmperr if $qmperr;
566 die "got no uuid for backup task\n" if !defined($backup_job_uuid);
568 $self->loginfo("started backup task '$backup_job_uuid'");
570 $self->resume_vm_after_job_start($task, $vmid);
572 my $stat = $query_backup_status_loop->($self, $vmid, $backup_job_uuid, $qemu_support);
573 $task->{size
} = $stat->{total
};
578 $self->mon_backup_cancel($vmid) if defined($backup_job_uuid);
580 $self->restore_vm_power_state($vmid);
585 my $fork_compressor_pipe = sub {
586 my ($self, $comp, $outfileno) = @_;
588 my @pipefd = POSIX
::pipe();
590 die "unable to fork worker - $!" if !defined($cpid) || $cpid < 0;
593 POSIX
::close($pipefd[1]);
595 my $fd = fileno(STDIN
);
597 POSIX
::close(0) if $fd != 0;
598 die "unable to redirect STDIN - $!"
599 if !open(STDIN
, "<&", $pipefd[0]);
602 $fd = fileno(STDOUT
);
604 POSIX
::close (1) if $fd != 1;
606 die "unable to redirect STDOUT - $!"
607 if !open(STDOUT
, ">&", $outfileno);
610 die "fork compressor '$comp' failed\n";
619 POSIX
::close($pipefd[0]);
620 $outfileno = $pipefd[1];
623 return ($cpid, $outfileno);
627 my ($self, $task, $vmid, $filename, $comp) = @_;
629 my $conffile = "$task->{tmpdir}/qemu-server.conf";
630 my $firewall = "$task->{tmpdir}/qemu-server.fw";
632 my $opts = $self->{vzdump
}->{opts
};
634 my $starttime = time();
637 if ($opts->{bwlimit
}) {
638 $speed = $opts->{bwlimit
}*1024;
641 my $diskcount = scalar(@{$task->{disks
}});
642 if (PVE
::QemuConfig-
>is_template($self->{vmlist
}->{$vmid}) || !$diskcount) {
644 foreach my $di (@{$task->{disks
}}) {
645 if ($di->{type
} eq 'block' || $di->{type
} eq 'file') {
646 push @pathlist, "$di->{qmdevice}=$di->{path}";
653 $self->loginfo("backup contains no disks");
658 $outcmd = "exec:$comp";
660 $outcmd = "exec:cat";
663 $outcmd .= " > $filename" if !$opts->{stdout
};
665 my $cmd = ['/usr/bin/vma', 'create', '-v', '-c', $conffile];
666 push @$cmd, '-c', $firewall if -e
$firewall;
667 push @$cmd, $outcmd, @pathlist;
669 $self->loginfo("starting template backup");
670 $self->loginfo(join(' ', @$cmd));
672 if ($opts->{stdout
}) {
673 $self->cmd($cmd, output
=> ">&" . fileno($opts->{stdout
}));
681 my $devlist = _get_task_devlist
($task);
683 $self->enforce_vm_running_for_backup($vmid);
689 $SIG{INT
} = $SIG{TERM
} = $SIG{QUIT
} = $SIG{HUP
} = $SIG{PIPE
} = sub {
690 die "interrupted by signal\n";
694 if ($opts->{stdout
}) {
695 $outfh = $opts->{stdout
};
697 $outfh = IO
::File-
>new($filename, "w") ||
698 die "unable to open file '$filename' - $!\n";
700 my $outfileno = fileno($outfh);
703 ($cpid, $outfileno) = $fork_compressor_pipe->($self, $comp, $outfileno);
706 my $qmpclient = PVE
::QMPClient-
>new();
707 my $backup_cb = sub {
708 my ($vmid, $resp) = @_;
709 $backup_job_uuid = $resp->{return}->{UUID
};
711 my $add_fd_cb = sub {
712 my ($vmid, $resp) = @_;
715 'backup-file' => "/dev/fdname/backup",
717 'config-file' => $conffile,
720 $params->{'firewall-file'} = $firewall if -e
$firewall;
722 $qmpclient->queue_cmd($vmid, $backup_cb, 'backup', %$params);
725 $qmpclient->queue_cmd($vmid, $add_fd_cb, 'getfd', fd
=> $outfileno, fdname
=> "backup");
727 my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
729 eval { $qmpclient->queue_execute(30) };
733 $self->qga_fs_thaw($vmid);
736 die $qmperr if $qmperr;
737 die $qmpclient->{errors
}->{$vmid} if $qmpclient->{errors
}->{$vmid};
740 POSIX
::close($outfileno) == 0 ||
741 die "close output file handle failed\n";
744 die "got no uuid for backup task\n" if !defined($backup_job_uuid);
746 $self->loginfo("started backup task '$backup_job_uuid'");
748 $self->resume_vm_after_job_start($task, $vmid);
750 $query_backup_status_loop->($self, $vmid, $backup_job_uuid);
755 $self->mon_backup_cancel($vmid) if defined($backup_job_uuid);
758 $self->restore_vm_power_state($vmid);
768 if ($cpid && (waitpid($cpid, 0) > 0)) {
771 my $signal = $stat & 127;
772 if ($ec || $signal) {
773 die "$comp failed - wrong exit status $ec" .
774 ($signal ?
" (signal $signal)\n" : "\n");
779 sub _get_task_devlist
{
783 foreach my $di (@{$task->{disks
}}) {
784 if ($di->{type
} eq 'block' || $di->{type
} eq 'file') {
785 $devlist .= ',' if $devlist;
786 $devlist .= $di->{qmdevice
};
788 die "implement me (type '$di->{type}')";
795 my ($self, $task, $vmid) = @_;
796 return if !$self->{vmlist
}->{$vmid}->{agent
} || $task->{mode
} eq 'stop' || !$self->{vm_was_running
};
798 if (!PVE
::QemuServer
::qga_check_running
($vmid, 1)) {
799 $self->loginfo("skipping guest-agent 'fs-freeze', agent configured but not running?");
803 $self->loginfo("issuing guest-agent 'fs-freeze' command");
804 eval { mon_cmd
($vmid, "guest-fsfreeze-freeze") };
805 $self->logerr($@) if $@;
807 return 1; # even on mon command error, ensure we always thaw again
810 # only call if fs_freeze return 1
812 my ($self, $vmid) = @_;
814 $self->loginfo("issuing guest-agent 'fs-thaw' command");
815 eval { mon_cmd
($vmid, "guest-fsfreeze-thaw") };
816 $self->logerr($@) if $@;
819 # we need a running QEMU/KVM process for backup, starts a paused (prelaunch)
820 # one if VM isn't already running
821 sub enforce_vm_running_for_backup
{
822 my ($self, $vmid) = @_;
824 if (PVE
::QemuServer
::check_running
($vmid)) {
825 $self->{vm_was_running
} = 1;
830 $self->loginfo("starting kvm to execute backup task");
831 # start with skiplock
836 PVE
::QemuServer
::vm_start
($self->{storecfg
}, $vmid, $params);
841 # resume VM againe once we got in a clear state (stop mode backup of running VM)
842 sub resume_vm_after_job_start
{
843 my ($self, $task, $vmid) = @_;
845 return if !$self->{vm_was_running
};
847 if (my $stoptime = $task->{vmstoptime
}) {
848 my $delay = time() - $task->{vmstoptime
};
849 $task->{vmstoptime
} = undef; # avoid printing 'online after ..' twice
850 $self->loginfo("resuming VM again after $delay seconds");
852 $self->loginfo("resuming VM again");
854 mon_cmd
($vmid, 'cont');
857 # stop again if VM was not running before
858 sub restore_vm_power_state
{
859 my ($self, $vmid) = @_;
861 # we always let VMs keep running
862 return if $self->{vm_was_running
};
865 my $resp = mon_cmd
($vmid, 'query-status');
866 my $status = $resp && $resp->{status
} ?
$resp->{status
} : 'unknown';
867 if ($status eq 'prelaunch') {
868 $self->loginfo("stopping kvm after backup task");
869 PVE
::QemuServer
::vm_stop
($self->{storecfg
}, $vmid, 1);
871 $self->loginfo("kvm status changed after backup ('$status') - keep VM running");
877 sub mon_backup_cancel
{
878 my ($self, $vmid) = @_;
880 $self->loginfo("aborting backup job");
881 eval { mon_cmd
($vmid, 'backup-cancel') };
882 $self->logerr($@) if $@;
886 my ($self, $task, $vmid) = @_;
892 my ($self, $task, $vmid) = @_;