use PVE::QemuServer;
use PVE::QemuConfig;
use PVE::Tools;
+use PVE::ReplicationConfig;
use Test::MockModule;
use Test::More;
my $snap = $conf->{snapshots}->{$snapname};
$snap->{vmstate} = "somestorage:state-volume";
- $snap->{machine} = "somemachine";
+ $snap->{runningmachine} = "somemachine"
}
# END mocked PVE::QemuConfig methods
$qemu_config_module->mock('has_feature', \&has_feature);
$qemu_config_module->mock('__snapshot_save_vmstate', \&__snapshot_save_vmstate);
+# ignore existing replication config
+my $repl_config_module = new Test::MockModule('PVE::ReplicationConfig');
+$repl_config_module->mock('check_for_existing_jobs' => sub { return undef });
+
$running = 1;
$freeze_possible = 1;
$save_vmstate_works = 1;
testcase_create("203", "test", 0, "test comment", "savevm-start disabled\n\n");
$vm_mon->{savevm_start} = 1;
+printf("Successful snapshot_create with no existing snapshots but set machine type\n");
+testcase_create("301", "test", 1, "test comment", "", { "local:snapshotable-disk-1" => "test" });
$nodename = "delete";
printf("\n");
printf("Expected error for snapshot_rollback with mp rollback failure (results in inconsistent state)\n");
testcase_rollback("207", "test", "volume snapshot rollback disabled\n", { "local:snapshotable-disk-1" => "test", "local:snapshotable-disk-2" => "test" });
+printf("Successful snapshot_rollback with saved vmstate and machine config only in snapshot\n");
+testcase_rollback("301", "test", "", { "local:snapshotable-disk-1" => "test" });
+
+printf("Successful snapshot_rollback with saved vmstate and machine config and runningmachine \n");
+testcase_rollback("302", "test", "", { "local:snapshotable-disk-1" => "test" });
+
done_testing();