summaryrefslogtreecommitdiff
path: root/source4/script/tests/win/vm_load_snapshot.pl
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-08-24 04:14:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:38 -0500
commite5f7da55ef778fdd904d6ff2a54d3d5e02debc17 (patch)
tree734d71dd6dc809f14560502ba5fa82138c4d660e /source4/script/tests/win/vm_load_snapshot.pl
parentb075bb842d6665be3212ddf93d4ccb98472f341a (diff)
downloadsamba-e5f7da55ef778fdd904d6ff2a54d3d5e02debc17.tar.gz
samba-e5f7da55ef778fdd904d6ff2a54d3d5e02debc17.tar.bz2
samba-e5f7da55ef778fdd904d6ff2a54d3d5e02debc17.zip
r17768: This merges in the current version of Brad Henry's windows testing
framework patch. There are some issues with the patch that I will discuss in a separate email to the list, but given the low (zero?) impact of the patch as it is, I think its better to integrate it now, then let Brad send some minor update patches later (This used to be commit 7232da0436ff1d84e419d268fee31a095bbb88b7)
Diffstat (limited to 'source4/script/tests/win/vm_load_snapshot.pl')
-rw-r--r--source4/script/tests/win/vm_load_snapshot.pl46
1 files changed, 46 insertions, 0 deletions
diff --git a/source4/script/tests/win/vm_load_snapshot.pl b/source4/script/tests/win/vm_load_snapshot.pl
new file mode 100644
index 0000000000..e8ba9b39cf
--- /dev/null
+++ b/source4/script/tests/win/vm_load_snapshot.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+
+# A perl script to connect to a VMware server and revert a VM snapshot.
+# Copyright Brad Henry <brad@samba.org> 2006
+# Released under the GNU GPL v2 or later.
+
+use VMHost;
+
+sub check_error {
+my $vm = VMHost;
+ my $custom_err_str = "";
+ ($vm, $custom_err_str) = @_;
+
+ my ($err_code, $err_str) = $vm->error;
+ if ($err_code != 0) {
+ undef $vm;
+ die $custom_err_str . "Returned $err_code: $err_str.\n";
+ }
+}
+
+# Read in parameters from environment.
+my $vm_cfg_path = $ENV{'VM_CFG_PATH'};
+my $host_server_name = $ENV{'HOST_SERVER_NAME'};
+my $host_server_port = $ENV{'HOST_SERVER_PORT'};
+if (!defined($host_server_port)) {
+ $host_server_port = 902;
+}
+
+my $host_username = $ENV{'HOST_USERNAME'};
+my $host_password = $ENV{'HOST_PASSWORD'};
+my $guest_admin_username = $ENV{'GUEST_ADMIN_USERNAME'};
+my $guest_admin_password = $ENV{'GUEST_ADMIN_PASSWORD'};
+
+my $vm = VMHost;
+
+$vm->host_connect($host_server_name, $host_server_port, $host_username,
+ $host_password, $vm_cfg_path, $guest_admin_username,
+ $guest_admin_password);
+check_error($vm, "Error in \$vm->host_connect().\n");
+
+$vm->revert_snapshot();
+check_error($vm, "Error in \$vm->revert_snapshot().\n");
+
+undef $vm;
+
+exit 0;