1 package PVE
::QemuServer
; ## no critic
9 use PVE
::Storage
::Plugin
;
13 use PVE
::ReplicationConfig
;
18 my $activate_storage_possible = 1;
20 my $snapshot_possible;
21 my $vol_snapshot_possible = {};
22 my $vol_snapshot_delete_possible = {};
23 my $vol_snapshot_rollback_possible = {};
24 my $vol_snapshot_rollback_enabled = {};
25 my $vol_snapshot = {};
26 my $vol_snapshot_delete = {};
27 my $vol_snapshot_rollback = {};
31 my $save_vmstate_works;
36 sub mocked_volume_snapshot
{
37 my ($storecfg, $volid, $snapname) = @_;
38 die "Storage config not mocked! aborting\n"
39 if defined($storecfg);
40 die "volid undefined\n"
42 die "snapname undefined\n"
43 if !defined($snapname);
44 if ($vol_snapshot_possible->{$volid}) {
45 if (defined($vol_snapshot->{$volid})) {
46 $vol_snapshot->{$volid} .= ",$snapname";
48 $vol_snapshot->{$volid} = $snapname;
52 die "volume snapshot disabled\n";
56 sub mocked_volume_snapshot_delete
{
57 my ($storecfg, $volid, $snapname) = @_;
58 die "Storage config not mocked! aborting\n"
59 if defined($storecfg);
60 die "volid undefined\n"
62 die "snapname undefined\n"
63 if !defined($snapname);
64 if ($vol_snapshot_delete_possible->{$volid}) {
65 if (defined($vol_snapshot_delete->{$volid})) {
66 $vol_snapshot_delete->{$volid} .= ",$snapname";
68 $vol_snapshot_delete->{$volid} = $snapname;
72 die "volume snapshot delete disabled\n";
76 sub mocked_volume_snapshot_rollback
{
77 my ($storecfg, $volid, $snapname) = @_;
78 die "Storage config not mocked! aborting\n"
79 if defined($storecfg);
80 die "volid undefined\n"
82 die "snapname undefined\n"
83 if !defined($snapname);
84 if ($vol_snapshot_rollback_enabled->{$volid}) {
85 if (defined($vol_snapshot_rollback->{$volid})) {
86 $vol_snapshot_rollback->{$volid} .= ",$snapname";
88 $vol_snapshot_rollback->{$volid} = $snapname;
92 die "volume snapshot rollback disabled\n";
96 sub mocked_volume_rollback_is_possible
{
97 my ($storecfg, $volid, $snapname) = @_;
98 die "Storage config not mocked! aborting\n"
99 if defined($storecfg);
100 die "volid undefined\n"
102 die "snapname undefined\n"
103 if !defined($snapname);
104 return $vol_snapshot_rollback_possible->{$volid}
105 if ($vol_snapshot_rollback_possible->{$volid});
106 die "volume_rollback_is_possible failed\n";
109 sub mocked_activate_storage
{
110 my ($storecfg, $storeid) = @_;
111 die "Storage config not mocked! aborting\n"
112 if defined($storecfg);
113 die "storage activation failed\n"
114 if !$activate_storage_possible;
118 sub mocked_activate_volumes
{
119 my ($storecfg, $volumes) = @_;
120 die "Storage config not mocked! aborting\n"
121 if defined($storecfg);
122 die "wrong volume - fake vmstate expected!\n"
123 if ((scalar @$volumes != 1) || @$volumes[0] ne "somestorage:state-volume");
127 sub mocked_deactivate_volumes
{
128 my ($storecfg, $volumes) = @_;
129 die "Storage config not mocked! aborting\n"
130 if defined($storecfg);
131 die "wrong volume - fake vmstate expected!\n"
132 if ((scalar @$volumes != 1) || @$volumes[0] ne "somestorage:state-volume");
136 sub mocked_vdisk_free
{
137 my ($storecfg, $vmstate) = @_;
138 die "Storage config not mocked! aborting\n"
139 if defined($storecfg);
140 die "wrong vdisk - fake vmstate expected!\n"
141 if ($vmstate ne "somestorage:state-volume");
145 sub mocked_run_command
{
146 my ($cmd, %param) = @_;
148 if (my $ref = ref($cmd)) {
149 $cmdstring = PVE
::Tools
::cmd2string
($cmd);
150 if ($cmdstring =~ m/.*\/qemu-
(un
)?freeze
.*/) {
151 return 1 if $freeze_possible;
152 die "qemu-[un]freeze disabled\n";
154 if ($cmdstring =~ m/.*\/qemu-stop
.*--kill.*/) {
155 if ($stop_possible) {
163 die "unexpected run_command call: '$cmdstring', aborting\n";
169 my ($exp_fn, $real_fn) = @_;
172 $ret = system("diff -u '$exp_fn' '$real_fn'");
178 sub testcase_prepare
{
179 my ($vmid, $snapname, $save_vmstate, $comment, $exp_err) = @_;
180 subtest
"Preparing snapshot '$snapname' for vm '$vmid'" => sub {
184 PVE
::QemuConfig-
>__snapshot_prepare($vmid, $snapname, $save_vmstate, $comment);
186 is($@, $exp_err, "\$@ correct");
187 ok
(test_file
("snapshot-expected/prepare/qemu-server/$vmid.conf", "snapshot-working/prepare/qemu-server/$vmid.conf"), "config file correct");
191 sub testcase_commit
{
192 my ($vmid, $snapname, $exp_err) = @_;
193 subtest
"Committing snapshot '$snapname' for vm '$vmid'" => sub {
197 PVE
::QemuConfig-
>__snapshot_commit($vmid, $snapname);
199 is($@, $exp_err, "\$@ correct");
200 ok
(test_file
("snapshot-expected/commit/qemu-server/$vmid.conf", "snapshot-working/commit/qemu-server/$vmid.conf"), "config file correct");
204 sub testcase_create
{
205 my ($vmid, $snapname, $save_vmstate, $comment, $exp_err, $exp_vol_snap, $exp_vol_snap_delete) = @_;
206 subtest
"Creating snapshot '$snapname' for vm '$vmid'" => sub {
209 $vol_snapshot_delete = {};
210 $exp_vol_snap = {} if !defined($exp_vol_snap);
211 $exp_vol_snap_delete = {} if !defined($exp_vol_snap_delete);
214 PVE
::QemuConfig-
>snapshot_create($vmid, $snapname, $save_vmstate, $comment);
216 is($@, $exp_err, "\$@ correct");
217 is_deeply
($vol_snapshot, $exp_vol_snap, "created correct volume snapshots");
218 is_deeply
($vol_snapshot_delete, $exp_vol_snap_delete, "deleted correct volume snapshots");
219 ok
(test_file
("snapshot-expected/create/qemu-server/$vmid.conf", "snapshot-working/create/qemu-server/$vmid.conf"), "config file correct");
223 sub testcase_delete
{
224 my ($vmid, $snapname, $force, $exp_err, $exp_vol_snap_delete) = @_;
225 subtest
"Deleting snapshot '$snapname' of vm '$vmid'" => sub {
227 $vol_snapshot_delete = {};
228 $exp_vol_snap_delete = {} if !defined($exp_vol_snap_delete);
231 PVE
::QemuConfig-
>snapshot_delete($vmid, $snapname, $force);
233 is($@, $exp_err, "\$@ correct");
234 is_deeply
($vol_snapshot_delete, $exp_vol_snap_delete, "deleted correct volume snapshots");
235 ok
(test_file
("snapshot-expected/delete/qemu-server/$vmid.conf", "snapshot-working/delete/qemu-server/$vmid.conf"), "config file correct");
239 sub testcase_rollback
{
240 my ($vmid, $snapname, $exp_err, $exp_vol_snap_rollback) = @_;
241 subtest
"Rolling back to snapshot '$snapname' of vm '$vmid'" => sub {
243 $vol_snapshot_rollback = {};
245 $exp_vol_snap_rollback = {} if !defined($exp_vol_snap_rollback);
248 PVE
::QemuConfig-
>snapshot_rollback($vmid, $snapname);
250 is($@, $exp_err, "\$@ correct");
251 is_deeply
($vol_snapshot_rollback, $exp_vol_snap_rollback, "rolled back to correct volume snapshots");
252 ok
(test_file
("snapshot-expected/rollback/qemu-server/$vmid.conf", "snapshot-working/rollback/qemu-server/$vmid.conf"), "config file correct");
256 # BEGIN mocked PVE::QemuConfig methods
257 sub config_file_lock
{
258 return "snapshot-working/pve-test.lock";
261 sub cfs_config_path
{
262 my ($class, $vmid, $node) = @_;
264 $node = $nodename if !$node;
265 return "snapshot-working/$node/qemu-server/$vmid.conf";
269 my ($class, $vmid, $node) = @_;
271 my $filename = $class->cfs_config_path($vmid, $node);
273 my $raw = PVE
::Tools
::file_get_contents
($filename);
275 my $conf = PVE
::QemuServer
::parse_vm_config
($filename, $raw);
280 my ($class, $vmid, $conf) = @_;
282 my $filename = $class->cfs_config_path($vmid);
284 if ($conf->{snapshots
}) {
285 foreach my $snapname (keys %{$conf->{snapshots
}}) {
286 $conf->{snapshots
}->{$snapname}->{snaptime
} = "1234567890"
287 if $conf->{snapshots
}->{$snapname}->{snaptime
};
291 my $raw = PVE
::QemuServer
::write_vm_config
($filename, $conf);
293 PVE
::Tools
::file_set_contents
($filename, $raw);
297 my ($class, $feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
298 return $snapshot_possible;
301 sub __snapshot_save_vmstate
{
302 my ($class, $vmid, $conf, $snapname, $storecfg) = @_;
303 die "save_vmstate failed\n"
304 if !$save_vmstate_works;
306 my $snap = $conf->{snapshots
}->{$snapname};
307 $snap->{vmstate
} = "somestorage:state-volume";
308 $snap->{runningmachine
} = "somemachine"
311 sub assert_config_exists_on_node
{
312 my ($vmid, $node) = @_;
313 return -f cfs_config_path
("PVE::QemuConfig", $vmid, $node);
315 # END mocked PVE::QemuConfig methods
317 # BEGIN mocked PVE::QemuServer::Helpers methods
319 sub vm_running_locally
{
323 # END mocked PVE::QemuServer::Helpers methods
325 # BEGIN mocked PVE::QemuServer::Monitor methods
328 my ($vmid, $cmd) = @_;
330 my $exec = $cmd->{execute
};
331 if ($exec eq "guest-ping") {
332 die "guest-ping disabled\n"
333 if !$vm_mon->{guest_ping
};
336 if ($exec eq "guest-fsfreeze-freeze" || $exec eq "guest-fsfreeze-thaw") {
337 die "freeze disabled\n"
338 if !$freeze_possible;
341 if ($exec eq "savevm-start") {
342 die "savevm-start disabled\n"
343 if !$vm_mon->{savevm_start
};
346 if ($exec eq "savevm-end") {
347 die "savevm-end disabled\n"
348 if !$vm_mon->{savevm_end
};
351 if ($exec eq "query-savevm") {
353 "status" => "completed",
354 "bytes" => 1024*1024*1024,
355 "total-time" => 5000,
358 die "unexpected vm_qmp_command!\n";
361 # END mocked PVE::QemuServer::Monitor methods
363 # BEGIN redefine PVE::QemuServer methods
365 sub do_snapshots_with_qemu
{
370 my ($storecfg, $vmid, $params, $migrate_opts) = @_;
372 die "Storage config not mocked! aborting\n"
373 if defined($storecfg);
375 die "statefile and forcemachine must be both defined or undefined! aborting\n"
376 if defined($params->{statefile
}) xor defined($params->{forcemachine
});
382 my ($storecfg, $vmid, $skiplock, $nocheck, $timeout, $shutdown, $force, $keepActive, $migratedfrom) = @_;
390 sub set_migration_caps
{} # ignored
392 # END redefine PVE::QemuServer methods
394 PVE
::Tools
::run_command
("rm -rf snapshot-working");
395 PVE
::Tools
::run_command
("cp -a snapshot-input snapshot-working");
397 my $qemu_helpers_module = Test
::MockModule-
>new('PVE::QemuServer::Helpers');
398 $qemu_helpers_module->mock('vm_running_locally', \
&vm_running_locally
);
400 my $qemu_monitor_module = Test
::MockModule-
>new('PVE::QemuServer::Monitor');
401 $qemu_monitor_module->mock('qmp_cmd', \
&qmp_cmd
);
403 my $qemu_config_module = Test
::MockModule-
>new('PVE::QemuConfig');
404 $qemu_config_module->mock('config_file_lock', \
&config_file_lock
);
405 $qemu_config_module->mock('cfs_config_path', \
&cfs_config_path
);
406 $qemu_config_module->mock('load_config', \
&load_config
);
407 $qemu_config_module->mock('write_config', \
&write_config
);
408 $qemu_config_module->mock('has_feature', \
&has_feature
);
409 $qemu_config_module->mock('__snapshot_save_vmstate', \
&__snapshot_save_vmstate
);
410 $qemu_config_module->mock('assert_config_exists_on_node', \
&assert_config_exists_on_node
);
412 # ignore existing replication config
413 my $repl_config_module = Test
::MockModule-
>new('PVE::ReplicationConfig');
414 $repl_config_module->mock('new' => sub { return bless {}, "PVE::ReplicationConfig" });
415 $repl_config_module->mock('check_for_existing_jobs' => sub { return });
417 my $storage_module = Test
::MockModule-
>new('PVE::Storage');
418 $storage_module->mock('config', sub { return; });
419 $storage_module->mock('path', sub { return "/some/store/statefile/path"; });
420 $storage_module->mock('activate_storage', \
&mocked_activate_storage
);
421 $storage_module->mock('activate_volumes', \
&mocked_activate_volumes
);
422 $storage_module->mock('deactivate_volumes', \
&mocked_deactivate_volumes
);
423 $storage_module->mock('vdisk_free', \
&mocked_vdisk_free
);
424 $storage_module->mock('volume_snapshot', \
&mocked_volume_snapshot
);
425 $storage_module->mock('volume_snapshot_delete', \
&mocked_volume_snapshot_delete
);
426 $storage_module->mock('volume_snapshot_rollback', \
&mocked_volume_snapshot_rollback
);
427 $storage_module->mock('volume_rollback_is_possible', \
&mocked_volume_rollback_is_possible
);
430 $freeze_possible = 1;
431 $save_vmstate_works = 1;
434 printf("Running prepare tests\n");
436 $nodename = "prepare";
439 printf("Setting has_feature to return true\n");
441 $snapshot_possible = 1;
443 printf("Successful snapshot_prepare with no existing snapshots\n");
444 testcase_prepare
("101", "test", 0, "test comment", '');
446 printf("Successful snapshot_prepare with no existing snapshots, including vmstate\n");
447 testcase_prepare
("102", "test", 1, "test comment", '');
449 printf("Successful snapshot_prepare with one existing snapshot\n");
450 testcase_prepare
("103", "test2", 0, "test comment", "");
452 printf("Successful snapshot_prepare with one existing snapshot, including vmstate\n");
453 testcase_prepare
("104", "test2", 1, "test comment", "");
455 printf("Expected error for snapshot_prepare on locked container\n");
456 testcase_prepare
("200", "test", 0, "test comment", "VM is locked (snapshot)\n");
458 printf("Expected error for snapshot_prepare with duplicate snapshot name\n");
459 testcase_prepare
("201", "test", 0, "test comment", "snapshot name 'test' already used\n");
461 $save_vmstate_works = 0;
463 printf("Expected error for snapshot_prepare with failing save_vmstate\n");
464 testcase_prepare
("202", "test", 1, "test comment", "save_vmstate failed\n");
466 $save_vmstate_works = 1;
469 printf("Setting has_feature to return false\n");
471 $snapshot_possible = 0;
473 printf("Expected error for snapshot_prepare if snapshots not possible\n");
474 testcase_prepare
("300", "test", 0, "test comment", "snapshot feature is not available\n");
477 printf("Running commit tests\n");
479 $nodename = "commit";
482 printf("Setting has_feature to return true\n");
484 $snapshot_possible = 1;
486 printf("Successful snapshot_commit with one prepared snapshot\n");
487 testcase_commit
("101", "test", "");
489 printf("Successful snapshot_commit with one committed and one prepared snapshot\n");
490 testcase_commit
("102", "test2", "");
492 printf("Expected error for snapshot_commit with no snapshot lock\n");
493 testcase_commit
("201", "test", "missing snapshot lock\n");
495 printf("Expected error for snapshot_commit with invalid snapshot name\n");
496 testcase_commit
("202", "test", "snapshot 'test' does not exist\n");
498 printf("Expected error for snapshot_commit with invalid snapshot state\n");
499 testcase_commit
("203", "test", "wrong snapshot state\n");
501 $vol_snapshot_possible->{"local:snapshotable-disk-1"} = 1;
502 $vol_snapshot_possible->{"local:snapshotable-disk-2"} = 1;
503 $vol_snapshot_possible->{"local:snapshotable-disk-3"} = 1;
504 $vol_snapshot_delete_possible->{"local:snapshotable-disk-1"} = 1;
505 $vol_snapshot_delete_possible->{"local:snapshotable-disk-3"} = 1;
506 $vol_snapshot_rollback_enabled->{"local:snapshotable-disk-1"} = 1;
507 $vol_snapshot_rollback_enabled->{"local:snapshotable-disk-2"} = 1;
508 $vol_snapshot_rollback_enabled->{"local:snapshotable-disk-3"} = 1;
509 $vol_snapshot_rollback_possible->{"local:snapshotable-disk-1"} = 1;
510 $vol_snapshot_rollback_possible->{"local:snapshotable-disk-2"} = 1;
511 $vol_snapshot_rollback_possible->{"local:snapshotable-disk-3"} = 1;
512 $vol_snapshot_rollback_possible->{"local:snapshotable-disk-4"} = 1;
513 $vm_mon->{guest_ping
} = 1;
514 $vm_mon->{savevm_start
} = 1;
515 $vm_mon->{savevm_end
} = 1;
517 # possible, but fails
518 $vol_snapshot_rollback_possible->{"local:snapshotable-disk-4"} = 1;
522 #printf("Setting up Mocking for PVE::Tools\n");
523 #my $tools_module = Test::MockModule->new('PVE::Tools');
524 #$tools_module->mock('run_command' => \&mocked_run_command);
525 #printf("\trun_command() mocked\n");
527 $nodename = "create";
529 printf("Running create tests\n");
532 printf("Successful snapshot_create with no existing snapshots\n");
533 testcase_create
("101", "test", 0, "test comment", "", { "local:snapshotable-disk-1" => "test" });
535 printf("Successful snapshot_create with no existing snapshots, including vmstate\n");
536 testcase_create
("102", "test", 1, "test comment", "", { "local:snapshotable-disk-1" => "test" });
538 printf("Successful snapshot_create with one existing snapshots\n");
539 testcase_create
("103", "test2", 0, "test comment", "", { "local:snapshotable-disk-1" => "test2" });
541 printf("Successful snapshot_create with one existing snapshots, including vmstate\n");
542 testcase_create
("104", "test2", 1, "test comment", "", { "local:snapshotable-disk-1" => "test2" });
544 printf("Successful snapshot_create with multiple mps\n");
545 testcase_create
("105", "test", 0, "test comment", "", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-2" => "test", "local:snapshotable-disk-3" => "test" });
547 $freeze_possible = 0;
548 printf("Successful snapshot_create with no existing snapshots and broken freeze\n");
549 testcase_create
("106", "test", 1, "test comment", "", { "local:snapshotable-disk-1" => "test" });
550 $freeze_possible = 1;
552 printf("Expected error for snapshot_create when volume snapshot is not possible\n");
553 testcase_create
("201", "test", 0, "test comment", "volume snapshot disabled\n\n");
555 printf("Expected error for snapshot_create when volume snapshot is not possible for one drive\n");
556 testcase_create
("202", "test", 0, "test comment", "volume snapshot disabled\n\n", { "local:snapshotable-disk-1" => "test" }, { "local:snapshotable-disk-1" => "test" });
558 $vm_mon->{savevm_start
} = 0;
559 printf("Expected error for snapshot_create when QEMU mon command 'savevm-start' fails\n");
560 testcase_create
("203", "test", 0, "test comment", "savevm-start disabled\n\n");
561 $vm_mon->{savevm_start
} = 1;
563 printf("Successful snapshot_create with no existing snapshots but set machine type\n");
564 testcase_create
("301", "test", 1, "test comment", "", { "local:snapshotable-disk-1" => "test" });
566 $activate_storage_possible = 0;
568 printf("Expected error for snapshot_create when storage activation is not possible\n");
569 testcase_create
("303", "test", 1, "test comment", "storage activation failed\n\n");
571 $activate_storage_possible = 1;
573 $nodename = "delete";
575 printf("Running delete tests\n");
578 printf("Successful snapshot_delete of only existing snapshot\n");
579 testcase_delete
("101", "test", 0, "", { "local:snapshotable-disk-1" => "test" });
581 printf("Successful snapshot_delete of leaf snapshot\n");
582 testcase_delete
("102", "test2", 0, "", { "local:snapshotable-disk-1" => "test2" });
584 printf("Successful snapshot_delete of root snapshot\n");
585 testcase_delete
("103", "test", 0, "", { "local:snapshotable-disk-1" => "test" });
587 printf("Successful snapshot_delete of intermediate snapshot\n");
588 testcase_delete
("104", "test2", 0, "", { "local:snapshotable-disk-1" => "test2" });
590 printf("Successful snapshot_delete with broken volume_snapshot_delete and force=1\n");
591 testcase_delete
("105", "test", 1, "");
593 printf("Successful snapshot_delete with mp broken volume_snapshot_delete and force=1\n");
594 testcase_delete
("106", "test", 1, "", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-3" => "test" });
596 printf("Expected error when snapshot_delete fails with broken volume_snapshot_delete and force=0\n");
597 testcase_delete
("201", "test", 0, "volume snapshot delete disabled\n");
599 printf("Expected error when snapshot_delete fails with broken mp volume_snapshot_delete and force=0\n");
600 testcase_delete
("202", "test", 0, "volume snapshot delete disabled\n", { "local:snapshotable-disk-1" => "test" });
602 printf("Expected error for snapshot_delete with locked config\n");
603 testcase_delete
("203", "test", 0, "VM is locked (backup)\n");
605 $activate_storage_possible = 0;
607 printf("Expected error for snapshot_delete when storage activation is not possible\n");
608 testcase_delete
("204", "test", 0, "storage activation failed\n");
610 $activate_storage_possible = 1;
612 $nodename = "rollback";
614 printf("Running rollback tests\n");
619 printf("Successful snapshot_rollback to only existing snapshot\n");
620 testcase_rollback
("101", "test", "", { "local:snapshotable-disk-1" => "test" });
622 printf("Successful snapshot_rollback to leaf snapshot\n");
623 testcase_rollback
("102", "test2", "", { "local:snapshotable-disk-1" => "test2" });
625 printf("Successful snapshot_rollback to root snapshot\n");
626 testcase_rollback
("103", "test", "", { "local:snapshotable-disk-1" => "test" });
628 printf("Successful snapshot_rollback to intermediate snapshot\n");
629 testcase_rollback
("104", "test2", "", { "local:snapshotable-disk-1" => "test2" });
631 printf("Successful snapshot_rollback with multiple mp\n");
632 testcase_rollback
("105", "test", "", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-2" => "test", "local:snapshotable-disk-3" => "test" });
634 printf("Successful snapshot_rollback to only existing snapshot, with saved vmstate and machine config\n");
635 testcase_rollback
("106", "test", "", { "local:snapshotable-disk-1" => "test" });
637 printf("Expected error for snapshot_rollback with non-existing snapshot\n");
638 testcase_rollback
("201", "test2", "snapshot 'test2' does not exist\n");
640 printf("Expected error for snapshot_rollback if volume rollback not possible\n");
641 testcase_rollback
("202", "test", "volume_rollback_is_possible failed\n");
643 printf("Expected error for snapshot_rollback with incomplete snapshot\n");
644 testcase_rollback
("203", "test", "unable to rollback to incomplete snapshot (snapstate = delete)\n");
646 printf("Expected error for snapshot_rollback with lock\n");
647 testcase_rollback
("204", "test", "VM is locked (backup)\n");
651 printf("Expected error for snapshot_rollback with unkillable container\n");
652 testcase_rollback
("205", "test", "unable to rollback vm 205: vm is running\n");
656 printf("Expected error for snapshot_rollback with mp rollback_is_possible failure\n");
657 testcase_rollback
("206", "test", "volume_rollback_is_possible failed\n");
659 printf("Expected error for snapshot_rollback with mp rollback failure (results in inconsistent state)\n");
660 testcase_rollback
("207", "test", "volume snapshot rollback disabled\n", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-2" => "test" });
662 printf("Successful snapshot_rollback with saved vmstate and machine config only in snapshot\n");
663 testcase_rollback
("301", "test", "", { "local:snapshotable-disk-1" => "test" });
665 printf("Successful snapshot_rollback with saved vmstate and machine config and runningmachine \n");
666 testcase_rollback
("302", "test", "", { "local:snapshotable-disk-1" => "test" });
668 $activate_storage_possible = 0;
670 printf("Expected error for snapshot_rollback when storage activation is not possible\n");
671 testcase_rollback
("303", "test", "storage activation failed\n");
673 $activate_storage_possible = 1;