]> git.proxmox.com Git - qemu-server.git/blob - PVE/VZDump/QemuServer.pm
9ca745f69e4ca6e1ef9cd7ce4aeabbeb851a78b3
[qemu-server.git] / PVE / VZDump / QemuServer.pm
1 package PVE::VZDump::QemuServer;
2
3 use strict;
4 use warnings;
5
6 use File::Basename;
7 use File::Path;
8 use IO::File;
9 use IPC::Open3;
10
11 use PVE::Cluster qw(cfs_read_file);
12 use PVE::INotify;
13 use PVE::IPCC;
14 use PVE::JSONSchema;
15 use PVE::QMPClient;
16 use PVE::Storage::Plugin;
17 use PVE::Storage::PBSPlugin;
18 use PVE::Storage;
19 use PVE::Tools;
20 use PVE::VZDump;
21
22 use PVE::QemuServer;
23 use PVE::QemuServer::Machine;
24 use PVE::QemuServer::Monitor qw(mon_cmd);
25
26 use base qw (PVE::VZDump::Plugin);
27
28 sub new {
29 my ($class, $vzdump) = @_;
30
31 PVE::VZDump::check_bin('qm');
32
33 my $self = bless { vzdump => $vzdump }, $class;
34
35 $self->{vmlist} = PVE::QemuServer::vzlist();
36 $self->{storecfg} = PVE::Storage::config();
37
38 return $self;
39 };
40
41 sub type {
42 return 'qemu';
43 }
44
45 sub vmlist {
46 my ($self) = @_;
47 return [ keys %{$self->{vmlist}} ];
48 }
49
50 sub prepare {
51 my ($self, $task, $vmid, $mode) = @_;
52
53 $task->{disks} = [];
54
55 my $conf = $self->{vmlist}->{$vmid} = PVE::QemuConfig->load_config($vmid);
56
57 $self->loginfo("VM Name: $conf->{name}")
58 if defined($conf->{name});
59
60 $self->{vm_was_running} = 1;
61 if (!PVE::QemuServer::check_running($vmid)) {
62 $self->{vm_was_running} = 0;
63 }
64
65 $task->{hostname} = $conf->{name};
66
67 my $hostname = PVE::INotify::nodename();
68
69 my $vollist = [];
70 my $drivehash = {};
71 PVE::QemuServer::foreach_drive($conf, sub {
72 my ($ds, $drive) = @_;
73
74 return if PVE::QemuServer::drive_is_cdrom($drive);
75
76 my $volid = $drive->{file};
77
78 if (defined($drive->{backup}) && !$drive->{backup}) {
79 $self->loginfo("exclude disk '$ds' '$volid' (backup=no)");
80 return;
81 } elsif ($self->{vm_was_running} && $drive->{iothread}) {
82 if (!PVE::QemuServer::Machine::runs_at_least_qemu_version($vmid, 4, 0, 1)) {
83 die "disk '$ds' '$volid' (iothread=on) can't use backup feature with running QEMU " .
84 "version < 4.0.1! Either set backup=no for this drive or upgrade QEMU and restart VM\n";
85 }
86 } elsif ($ds =~ m/^efidisk/ && (!defined($conf->{bios}) || $conf->{bios} ne 'ovmf')) {
87 $self->loginfo("excluding '$ds' (efidisks can only be backed up when BIOS is set to 'ovmf')");
88 return;
89 } else {
90 my $log = "include disk '$ds' '$volid'";
91 if (defined $drive->{size}) {
92 my $readable_size = PVE::JSONSchema::format_size($drive->{size});
93 $log .= " $readable_size";
94 }
95 $self->loginfo($log);
96 }
97
98 my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
99 push @$vollist, $volid if $storeid;
100 $drivehash->{$ds} = $drive;
101 });
102
103 PVE::Storage::activate_volumes($self->{storecfg}, $vollist);
104
105 foreach my $ds (sort keys %$drivehash) {
106 my $drive = $drivehash->{$ds};
107
108 my $volid = $drive->{file};
109 my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
110
111 my $path = $volid;
112 if ($storeid) {
113 $path = PVE::Storage::path($self->{storecfg}, $volid);
114 }
115 next if !$path;
116
117 my ($size, $format) = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) };
118 die "no such volume '$volid'\n" if $@;
119
120 my $diskinfo = {
121 path => $path,
122 volid => $volid,
123 storeid => $storeid,
124 format => $format,
125 virtdev => $ds,
126 qmdevice => "drive-$ds",
127 };
128
129 if (-b $path) {
130 $diskinfo->{type} = 'block';
131 } else {
132 $diskinfo->{type} = 'file';
133 }
134
135 push @{$task->{disks}}, $diskinfo;
136 }
137 }
138
139 sub vm_status {
140 my ($self, $vmid) = @_;
141
142 my $running = PVE::QemuServer::check_running($vmid) ? 1 : 0;
143
144 return wantarray ? ($running, $running ? 'running' : 'stopped') : $running;
145 }
146
147 sub lock_vm {
148 my ($self, $vmid) = @_;
149
150 PVE::QemuConfig->set_lock($vmid, 'backup');
151 }
152
153 sub unlock_vm {
154 my ($self, $vmid) = @_;
155
156 PVE::QemuConfig->remove_lock($vmid, 'backup');
157 }
158
159 sub stop_vm {
160 my ($self, $task, $vmid) = @_;
161
162 my $opts = $self->{vzdump}->{opts};
163
164 my $wait = $opts->{stopwait} * 60;
165 # send shutdown and wait
166 $self->cmd ("qm shutdown $vmid --skiplock --keepActive --timeout $wait");
167 }
168
169 sub start_vm {
170 my ($self, $task, $vmid) = @_;
171
172 $self->cmd ("qm start $vmid --skiplock");
173 }
174
175 sub suspend_vm {
176 my ($self, $task, $vmid) = @_;
177
178 $self->cmd ("qm suspend $vmid --skiplock");
179 }
180
181 sub resume_vm {
182 my ($self, $task, $vmid) = @_;
183
184 $self->cmd ("qm resume $vmid --skiplock");
185 }
186
187 sub assemble {
188 my ($self, $task, $vmid) = @_;
189
190 my $conffile = PVE::QemuConfig->config_file($vmid);
191
192 my $outfile = "$task->{tmpdir}/qemu-server.conf";
193 my $firewall_src = "/etc/pve/firewall/$vmid.fw";
194 my $firewall_dest = "$task->{tmpdir}/qemu-server.fw";
195
196 my $outfd = IO::File->new (">$outfile") ||
197 die "unable to open '$outfile'";
198 my $conffd = IO::File->new ($conffile, 'r') ||
199 die "unable open '$conffile'";
200
201 my $found_snapshot;
202 my $found_pending;
203 while (defined (my $line = <$conffd>)) {
204 next if $line =~ m/^\#vzdump\#/; # just to be sure
205 next if $line =~ m/^\#qmdump\#/; # just to be sure
206 if ($line =~ m/^\[(.*)\]\s*$/) {
207 if ($1 =~ m/PENDING/i) {
208 $found_pending = 1;
209 } else {
210 $found_snapshot = 1;
211 }
212 next; # skip all snapshots and pending changes config data
213 }
214
215 if ($line =~ m/^unused\d+:\s*(\S+)\s*/) {
216 $self->loginfo("skip unused drive '$1' (not included into backup)");
217 next;
218 }
219 next if $line =~ m/^lock:/ || $line =~ m/^parent:/;
220
221 print $outfd $line;
222 }
223
224 foreach my $di (@{$task->{disks}}) {
225 if ($di->{type} eq 'block' || $di->{type} eq 'file') {
226 my $storeid = $di->{storeid} || '';
227 my $format = $di->{format} || '';
228 print $outfd "#qmdump#map:$di->{virtdev}:$di->{qmdevice}:$storeid:$format:\n";
229 } else {
230 die "internal error";
231 }
232 }
233
234 if ($found_snapshot) {
235 $self->loginfo("snapshots found (not included into backup)");
236 }
237 if ($found_pending) {
238 $self->loginfo("pending configuration changes found (not included into backup)");
239 }
240
241 PVE::Tools::file_copy($firewall_src, $firewall_dest) if -f $firewall_src;
242 }
243
244 sub archive {
245 my ($self, $task, $vmid, $filename, $comp) = @_;
246
247 my $opts = $self->{vzdump}->{opts};
248 my $scfg = $opts->{scfg};
249
250 if ($scfg->{type} eq 'pbs') {
251 $self->archive_pbs($task, $vmid);
252 } else {
253 $self->archive_vma($task, $vmid, $filename, $comp);
254 }
255 }
256
257 my $query_backup_status_loop = sub {
258 my ($self, $vmid, $job_uuid) = @_;
259
260 my $starttime = time ();
261 my $last_time = $starttime;
262 my ($last_percent, $last_total, $last_zero, $last_transferred) = (-1, 0, 0, 0);
263 my $transferred;
264
265 my $get_mbps = sub {
266 my ($mb, $delta) = @_;
267 return ($mb > 0) ? int(($mb / $delta) / (1000 * 1000)) : 0;
268 };
269
270 while(1) {
271 my $status = mon_cmd($vmid, 'query-backup');
272
273 my $total = $status->{total} || 0;
274 $transferred = $status->{transferred} || 0;
275 my $percent = $total ? int(($transferred * 100)/$total) : 0;
276 my $zero = $status->{'zero-bytes'} || 0;
277 my $zero_per = $total ? int(($zero * 100)/$total) : 0;
278
279 die "got unexpected uuid\n" if !$status->{uuid} || ($status->{uuid} ne $job_uuid);
280
281 my $ctime = time();
282 my $duration = $ctime - $starttime;
283
284 my $rbytes = $transferred - $last_transferred;
285 my $wbytes = $rbytes - ($zero - $last_zero);
286
287 my $timediff = ($ctime - $last_time) || 1; # fixme
288 my $mbps_read = $get_mbps->($rbytes, $timediff);
289 my $mbps_write = $get_mbps->($wbytes, $timediff);
290
291 my $statusline = "status: $percent% ($transferred/$total), sparse ${zero_per}% ($zero), duration $duration, read/write $mbps_read/$mbps_write MB/s";
292
293 my $res = $status->{status} || 'unknown';
294 if ($res ne 'active') {
295 $self->loginfo($statusline);
296 if ($res ne 'done') {
297 die (($status->{errmsg} || "unknown error") . "\n") if $res eq 'error';
298 die "got unexpected status '$res'\n";
299 } elsif ($total != $transferred) {
300 die "got wrong number of transfered bytes ($total != $transferred)\n";
301 }
302 last;
303 }
304 if ($percent != $last_percent && ($timediff > 2)) {
305 $self->loginfo($statusline);
306 $last_percent = $percent;
307 $last_total = $total if $total;
308 $last_zero = $zero if $zero;
309 $last_transferred = $transferred if $transferred;
310 $last_time = $ctime;
311 }
312 sleep(1);
313 }
314
315 my $duration = time() - $starttime;
316 if ($transferred && $duration) {
317 my $mb = int($transferred / (1000 * 1000));
318 my $mbps = $get_mbps->($transferred, $duration);
319 $self->loginfo("transferred $mb MB in $duration seconds ($mbps MB/s)");
320 }
321 };
322
323 sub archive_pbs {
324 my ($self, $task, $vmid) = @_;
325
326 my $conffile = "$task->{tmpdir}/qemu-server.conf";
327 my $firewall = "$task->{tmpdir}/qemu-server.fw";
328
329 my $opts = $self->{vzdump}->{opts};
330
331 my $scfg = $opts->{scfg};
332
333 my $starttime = time();
334
335 my $diskcount = scalar(@{$task->{disks}});
336
337 my $server = $scfg->{server};
338 my $datastore = $scfg->{datastore};
339 my $username = $scfg->{username} // 'root@pam';
340 my $fingerprint = $scfg->{fingerprint};
341
342 my $repo = "$username\@$server:$datastore";
343 my $password = PVE::Storage::PBSPlugin::pbs_get_password($scfg, $opts->{storage});
344
345 if (PVE::QemuConfig->is_template($self->{vmlist}->{$vmid}) || !$diskcount) {
346 my @pathlist;
347 foreach my $di (@{$task->{disks}}) {
348 if ($di->{type} eq 'block' || $di->{type} eq 'file') {
349 push @pathlist, "$di->{qmdevice}.img:$di->{path}";
350 } else {
351 die "implement me";
352 }
353 }
354
355 if (!$diskcount) {
356 $self->loginfo("backup contains no disks");
357 }
358
359 local $ENV{PBS_PASSWORD} = $password;
360 my $cmd = [
361 '/usr/bin/proxmox-backup-client',
362 'backup',
363 '--repository', $repo,
364 '--backup-type', 'vm',
365 '--backup-id', "$vmid",
366 '--backup-time', $task->{backup_time},
367 ];
368
369 push @$cmd, '--fingerprint', $fingerprint if defined($fingerprint);
370
371 push @$cmd, "qemu-server.conf:$conffile";
372 push @$cmd, "fw.conf:$firewall" if -e $firewall;
373 push @$cmd, @pathlist if scalar(@pathlist);
374
375 $self->loginfo("starting template backup");
376 $self->loginfo(join(' ', @$cmd));
377
378 $self->cmd($cmd);
379
380 return;
381 }
382
383 # get list early so we die on unkown drive types before doing anything
384 my $devlist = _get_task_devlist($task);
385
386 my ($stop_after_backup, $resume_on_backup) = $self->handle_vm_powerstate($vmid);
387 $self->enforce_vm_running_for_backup($vmid);
388
389 my $backup_job_uuid;
390
391 my $interrupt_msg = "interrupted by signal\n";
392 eval {
393 $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
394 die $interrupt_msg;
395 };
396
397 my $fs_frozen = $self->qga_fs_freeze($vmid);
398
399 eval {
400
401 my $params = {
402 format => "pbs",
403 'backup-file' => $repo,
404 'backup-id' => "$vmid",
405 'backup-time' => $task->{backup_time},
406 password => $password,
407 devlist => $devlist,
408 'config-file' => $conffile,
409 };
410 $params->{fingerprint} = $fingerprint if defined($fingerprint);
411 $params->{'firewall-file'} = $firewall if -e $firewall;
412 my $res = mon_cmd($vmid, "backup", %$params);
413 $backup_job_uuid = $res->{UUID};
414 };
415
416 my $qmperr = $@;
417
418 if ($fs_frozen) {
419 $self->qga_fs_thaw($vmid);
420 }
421
422 die $qmperr if $qmperr;
423 die "got no uuid for backup task\n" if !defined($backup_job_uuid);
424
425 $self->loginfo("started backup task '$backup_job_uuid'");
426
427 $self->resume_vm_after_job_start($task, $vmid);
428
429 $query_backup_status_loop->($self, $vmid, $backup_job_uuid);
430 };
431 my $err = $@;
432 if ($err) {
433 $self->logerr($err);
434 $self->mon_backup_cancel($vmid) if defined($backup_job_uuid);
435 }
436 $self->restore_vm_power_state($vmid);
437
438 die $err if $err;
439 }
440
441 my $fork_compressor_pipe = sub {
442 my ($self, $comp, $outfileno) = @_;
443
444 my @pipefd = POSIX::pipe();
445 my $cpid = fork();
446 die "unable to fork worker - $!" if !defined($cpid) || $cpid < 0;
447 if ($cpid == 0) {
448 eval {
449 POSIX::close($pipefd[1]);
450 # redirect STDIN
451 my $fd = fileno(STDIN);
452 close STDIN;
453 POSIX::close(0) if $fd != 0;
454 die "unable to redirect STDIN - $!"
455 if !open(STDIN, "<&", $pipefd[0]);
456
457 # redirect STDOUT
458 $fd = fileno(STDOUT);
459 close STDOUT;
460 POSIX::close (1) if $fd != 1;
461
462 die "unable to redirect STDOUT - $!"
463 if !open(STDOUT, ">&", $outfileno);
464
465 exec($comp);
466 die "fork compressor '$comp' failed\n";
467 };
468 if (my $err = $@) {
469 $self->logerr($err);
470 POSIX::_exit(1);
471 }
472 POSIX::_exit(0);
473 kill(-9, $$);
474 } else {
475 POSIX::close($pipefd[0]);
476 $outfileno = $pipefd[1];
477 }
478
479 return ($cpid, $outfileno);
480 };
481
482 sub archive_vma {
483 my ($self, $task, $vmid, $filename, $comp) = @_;
484
485 my $conffile = "$task->{tmpdir}/qemu-server.conf";
486 my $firewall = "$task->{tmpdir}/qemu-server.fw";
487
488 my $opts = $self->{vzdump}->{opts};
489
490 my $starttime = time();
491
492 my $speed = 0;
493 if ($opts->{bwlimit}) {
494 $speed = $opts->{bwlimit}*1024;
495 }
496
497 my $diskcount = scalar(@{$task->{disks}});
498
499 if (PVE::QemuConfig->is_template($self->{vmlist}->{$vmid}) || !$diskcount) {
500 my @pathlist;
501 foreach my $di (@{$task->{disks}}) {
502 if ($di->{type} eq 'block' || $di->{type} eq 'file') {
503 push @pathlist, "$di->{qmdevice}=$di->{path}";
504 } else {
505 die "implement me";
506 }
507 }
508
509 if (!$diskcount) {
510 $self->loginfo("backup contains no disks");
511 }
512
513 my $outcmd;
514 if ($comp) {
515 $outcmd = "exec:$comp";
516 } else {
517 $outcmd = "exec:cat";
518 }
519
520 $outcmd .= " > $filename" if !$opts->{stdout};
521
522 my $cmd = ['/usr/bin/vma', 'create', '-v', '-c', $conffile];
523 push @$cmd, '-c', $firewall if -e $firewall;
524 push @$cmd, $outcmd, @pathlist;
525
526 $self->loginfo("starting template backup");
527 $self->loginfo(join(' ', @$cmd));
528
529 if ($opts->{stdout}) {
530 $self->cmd($cmd, output => ">&=" . fileno($opts->{stdout}));
531 } else {
532 $self->cmd($cmd);
533 }
534
535 return;
536 }
537
538 my $devlist = _get_task_devlist($task);
539
540 $self->enforce_vm_running_for_backup($vmid);
541
542 my $cpid;
543 my $backup_job_uuid;
544
545 my $interrupt_msg = "interrupted by signal\n";
546 eval {
547 $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
548 die $interrupt_msg;
549 };
550
551 my $qmpclient = PVE::QMPClient->new();
552
553 my $backup_cb = sub {
554 my ($vmid, $resp) = @_;
555 $backup_job_uuid = $resp->{return}->{UUID};
556 };
557
558 my $outfh;
559 if ($opts->{stdout}) {
560 $outfh = $opts->{stdout};
561 } else {
562 $outfh = IO::File->new($filename, "w") ||
563 die "unable to open file '$filename' - $!\n";
564 }
565 my $outfileno = fileno($outfh);
566
567 if ($comp) {
568 ($cpid, $outfileno) = $fork_compressor_pipe->($self, $comp, $outfileno);
569 }
570
571 my $add_fd_cb = sub {
572 my ($vmid, $resp) = @_;
573
574 my $params = {
575 'backup-file' => "/dev/fdname/backup",
576 speed => $speed,
577 'config-file' => $conffile,
578 devlist => $devlist
579 };
580
581 $params->{'firewall-file'} = $firewall if -e $firewall;
582 $qmpclient->queue_cmd($vmid, $backup_cb, 'backup', %$params);
583 };
584
585 $qmpclient->queue_cmd($vmid, $add_fd_cb, 'getfd',
586 fd => $outfileno, fdname => "backup");
587
588 my $fs_frozen = $self->qga_fs_freeze($vmid);
589
590 eval { $qmpclient->queue_execute(30) };
591 my $qmperr = $@;
592
593 if ($fs_frozen) {
594 $self->qga_fs_thaw($vmid);
595 }
596 die $qmperr if $qmperr;
597 die $qmpclient->{errors}->{$vmid} if $qmpclient->{errors}->{$vmid};
598
599 if ($cpid) {
600 POSIX::close($outfileno) == 0 ||
601 die "close output file handle failed\n";
602 }
603
604 die "got no uuid for backup task\n" if !defined($backup_job_uuid);
605
606 $self->loginfo("started backup task '$backup_job_uuid'");
607
608 $self->resume_vm_after_job_start($task, $vmid);
609
610 $query_backup_status_loop->($self, $vmid, $backup_job_uuid);
611 };
612 my $err = $@;
613 if ($err) {
614 $self->logerr($err);
615 $self->mon_backup_cancel($vmid) if defined($backup_job_uuid);
616 }
617
618 $self->restore_vm_power_state($vmid);
619
620 if ($err) {
621 if ($cpid) {
622 kill(9, $cpid);
623 waitpid($cpid, 0);
624 }
625 die $err;
626 }
627
628 if ($cpid && (waitpid($cpid, 0) > 0)) {
629 my $stat = $?;
630 my $ec = $stat >> 8;
631 my $signal = $stat & 127;
632 if ($ec || $signal) {
633 die "$comp failed - wrong exit status $ec" .
634 ($signal ? " (signal $signal)\n" : "\n");
635 }
636 }
637 }
638
639 sub _get_task_devlist {
640 my ($task) = @_;
641
642 my $devlist = '';
643 foreach my $di (@{$task->{disks}}) {
644 if ($di->{type} eq 'block' || $di->{type} eq 'file') {
645 $devlist .= ',' if $devlist;
646 $devlist .= $di->{qmdevice};
647 } else {
648 die "implement me (type '$di->{type}')";
649 }
650 }
651 return $devlist;
652 }
653
654 sub qga_fs_freeze {
655 my ($self, $vmid) = @_;
656 return if !$self->{vmlist}->{$vmid}->{agent} || !$self->{vm_was_running};
657
658 if (!PVE::QemuServer::qga_check_running($vmid, 1)) {
659 $self->loginfo("skipping guest-agent 'fs-freeze', agent configured but not running?");
660 return;
661 }
662
663 $self->loginfo("issuing guest-agent 'fs-freeze' command");
664 eval { mon_cmd($vmid, "guest-fsfreeze-freeze") };
665 $self->logerr($@) if $@;
666
667 return 1; # even on mon command error, ensure we always thaw again
668 }
669
670 # only call if fs_freeze return 1
671 sub qga_fs_thaw {
672 my ($self, $vmid) = @_;
673
674 $self->loginfo("issuing guest-agent 'fs-thaw' command");
675 eval { mon_cmd($vmid, "guest-fsfreeze-thaw") };
676 $self->logerr($@) if $@;
677 }
678
679 # we need a running QEMU/KVM process for backup, starts a paused (prelaunch)
680 # one if VM isn't already running
681 sub enforce_vm_running_for_backup {
682 my ($self, $vmid) = @_;
683
684 if (PVE::QemuServer::check_running($vmid)) {
685 $self->{vm_was_running} = 1;
686 return;
687 }
688
689 eval {
690 $self->loginfo("starting kvm to execute backup task");
691 # start with skiplock
692 PVE::QemuServer::vm_start($self->{storecfg}, $vmid, undef, 1, undef, 1);
693 };
694 die $@ if $@;
695 }
696
697 # resume VM againe once we got in a clear state (stop mode backup of running VM)
698 sub resume_vm_after_job_start {
699 my ($self, $task, $vmid) = @_;
700
701 return if !$self->{vm_was_running};
702
703 if (my $stoptime = $task->{vmstoptime}) {
704 my $delay = time() - $task->{vmstoptime};
705 $task->{vmstoptime} = undef; # avoid printing 'online after ..' twice
706 $self->loginfo("resuming VM again after $delay seconds");
707 } else {
708 $self->loginfo("resuming VM again");
709 }
710 mon_cmd($vmid, 'cont');
711 }
712
713 # stop again if VM was not running before
714 sub restore_vm_power_state {
715 my ($self, $vmid) = @_;
716
717 # we always let VMs keep running
718 return if $self->{vm_was_running};
719
720 eval {
721 my $resp = mon_cmd($vmid, 'query-status');
722 my $status = $resp && $resp->{status} ? $resp->{status} : 'unknown';
723 if ($status eq 'prelaunch') {
724 $self->loginfo("stopping kvm after backup task");
725 PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1);
726 } else {
727 $self->loginfo("kvm status changed after backup ('$status') - keep VM running");
728 }
729 };
730 warn $@ if $@;
731 }
732
733 sub mon_backup_cancel {
734 my ($self, $vmid) = @_;
735
736 $self->loginfo("aborting backup job");
737 eval { mon_cmd($vmid, 'backup-cancel') };
738 $self->logerr($@) if $@;
739 }
740
741 sub snapshot {
742 my ($self, $task, $vmid) = @_;
743
744 # nothing to do
745 }
746
747 sub cleanup {
748 my ($self, $task, $vmid) = @_;
749
750 # nothing to do ?
751 }
752
753 1;