Merge branch 'develop' into VCL-1114_misc_small_web_updates
diff --git a/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm b/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
index a74d74b..3df350b 100644
--- a/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
+++ b/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
@@ -154,6 +154,7 @@
 
 =cut
 
+=head2 comment out this get_network_configuration to use version of function in Linux.pm
 sub get_network_configuration {
 	my $self = shift;
 	if (ref($self) !~ /VCL::Module/i) {
@@ -238,6 +239,7 @@
 	return $self->{network_configuration};
 		
 }
+=cut
 
 #//////////////////////////////////////////////////////////////////////////////
 
diff --git a/managementnode/lib/VCL/Module/OS/Windows.pm b/managementnode/lib/VCL/Module/OS/Windows.pm
index a6eac08..dde48d7 100644
--- a/managementnode/lib/VCL/Module/OS/Windows.pm
+++ b/managementnode/lib/VCL/Module/OS/Windows.pm
@@ -8353,6 +8353,7 @@
 
 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
 "NoAutoUpdate"=dword:00000001
+"AUOptions"=dword:00000001
 EOF
 
 	# Import the string into the registry
diff --git a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
index bee452d..6f2dea8 100644
--- a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
@@ -779,6 +779,44 @@
 		notify($ERRORS{'DEBUG'}, 0, "'$domain_name' domain is not running on $node_name");
 		return 1;
 	}
+	elsif (grep(/SIGKILL: Device or resource busy/i, @$output)) {
+		notify($ERRORS{'DEBUG'}, 0, "Failed to stop '$domain_name' domain; \"SIGKILL: Device or resource busy\" encountered, waiting 30 seconds and trying again");
+		# libvirt could not kill VM, wait and try again
+		sleep 30;
+		my $command2 = "virsh -q list --all";
+		($exit_status, $output) = $self->vmhost_os->execute($command2);
+		my ($id, $name, $state);
+		for my $line (@$output) {
+			($id, $name, $state) = $line =~ /^\s*([\d\-]+)\s+(.+?)\s+(\w+|shut off|in shutdown)$/g;
+			next if (!defined($id));
+			last if ($name eq $domain_name);
+		}
+		if ($name ne $domain_name) {
+			notify($ERRORS{'WARNING'}, 0, "2nd try: $domain_name not found when running 'virsh list' on $node_name");
+			return;
+		}
+		if ($id eq '-') {
+			notify($ERRORS{'DEBUG'}, 0, "'$domain_name' domain now stopped");
+			return 1;
+		}
+		($exit_status, $output) = $self->vmhost_os->execute($command);
+		if (!defined($output)) {
+			notify($ERRORS{'WARNING'}, 0, "2nd try: failed to execute virsh command to destroy '$domain_name' domain on $node_name");
+			return;
+		}
+		elsif ($exit_status eq '0') {
+			notify($ERRORS{'OK'}, 0, "2nd try: destroyed '$domain_name' domain on $node_name");
+			return 1;
+		}
+		elsif (grep(/domain is not running/i, @$output)) {
+			notify($ERRORS{'DEBUG'}, 0, "2nd try: '$domain_name' domain is not running on $node_name");
+			return 1;
+		}
+		else {
+			notify($ERRORS{'WARNING'}, 0, "2nd try: failed to destroy '$domain_name' domain on $node_name\ncommand: $command\nexit status: $exit_status\noutput:\n" . join("\n", @$output));
+			return;
+		}
+	}
 	else {
 		notify($ERRORS{'WARNING'}, 0, "failed to destroy '$domain_name' domain on $node_name\ncommand: $command\nexit status: $exit_status\noutput:\n" . join("\n", @$output));
 		return;
@@ -1738,7 +1776,7 @@
 	my $image_type = $self->data->get_vmhost_datastore_imagetype_name();
 	my $vmhost_vmpath = $self->data->get_vmhost_profile_vmpath();
 	my $add_disk_cache = 0;
-	if (! $self->os->nathost_os->is_file_on_local_disk($vmhost_vmpath)) {
+	if (! $self->vmhost_os->is_file_on_local_disk($vmhost_vmpath)) {
 		# set disk cache to none if vmpath on NFS so live migration will work
 		$add_disk_cache = 1;
 	}
diff --git a/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm b/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm
index e57cabd..decfb4d 100644
--- a/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm
@@ -599,6 +599,14 @@
 		$source_file_paths_string = '"' . join('" "', @source_file_paths) . '"';
 	#}
 	
+	my $parent_file = $source_file_name;
+	$parent_file =~ s/-s[0-9]{3}//;
+	$parent_file = $parent_file . ".vmdk";
+	if ($self->vmhost_os->file_exists("$source_directory_path$parent_file")) {
+		$source_file_paths_string = "$source_directory_path$parent_file";
+		notify($ERRORS{'DEBUG'}, 0, "changing source_file_paths_string from multiple files to $source_directory_path$parent_file");
+	}
+	
 	my $options = '';
 	# VCL-911: If copying to the repository, save the image qcow2 version 0.10, the traditional image format that can be read by any QEMU since 0.10
 	my $repository_image_file_path = $self->get_repository_image_file_path();
@@ -621,7 +629,9 @@
 	
 	my $start_time = time;
 	my ($exit_status, $output) = $self->vmhost_os->execute($command, 0, 7200);
-	if (defined($output) && grep(/Unknown option.*compat/, @$output)) {
+	if (defined($output) &&
+	   (grep(/Unknown option.*compat/, @$output) ||
+	   grep(/Invalid parameter.*compat/, @$output))) {
 		# Check for older versions which don't support '-o compat=':
 		#    Unknown option 'compat'
 		#    qemu-img: Invalid options for file format 'qcow2'.
diff --git a/vcl-install.sh b/vcl-install.sh
index 89bd375..db59978 100755
--- a/vcl-install.sh
+++ b/vcl-install.sh
@@ -433,7 +433,7 @@
 	
 	salt=$(random_string 8)
 	#echo "Password salt: $salt"
-	passhash=$(echo -n $password$salt | sha512sum | awk '{print $1}')
+	passhash=$(echo -n $password$salt | sha1sum | awk '{print $1}')
 	#echo "Password hash: $passhash"
 	mysql -e "UPDATE localauth SET passhash = '$passhash', salt = '$salt', lastupdated = NOW() WHERE localauth.userid = (SELECT id FROM user WHERE unityid = '$username');" vcl
 	if [ $? -ne 0 ]; then
diff --git a/web/.ht-inc/utils.php b/web/.ht-inc/utils.php
index 677ad54..aaf3cbd 100644
--- a/web/.ht-inc/utils.php
+++ b/web/.ht-inc/utils.php
@@ -12640,7 +12640,7 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function xmlrpccall() {
-	global $xmlrpc_handle, $HTTP_RAW_POST_DATA, $user;
+	global $xmlrpc_handle, $user;
 	# create xmlrpc handle
 	$xmlrpc_handle = xmlrpc_server_create();
 	# register functions available via rpc calls
@@ -12694,7 +12694,8 @@
 	xmlrpc_server_register_method($xmlrpc_handle, "XMLRPCfinishBaseImageCapture", "xmlRPChandler");
 	xmlrpc_server_register_method($xmlrpc_handle, "XMLRPCcheckCryptSecrets", "xmlRPChandler");
 
-	print xmlrpc_server_call_method($xmlrpc_handle, $HTTP_RAW_POST_DATA, '');
+	$raw_post_data = file_get_contents("php://input");
+	print xmlrpc_server_call_method($xmlrpc_handle, $raw_post_data, '');
 	xmlrpc_server_destroy($xmlrpc_handle);
 	cleanSemaphore();
 	dbDisconnect();
@@ -12709,13 +12710,14 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function xmlrpcgetaffiliations() {
-	global $xmlrpc_handle, $HTTP_RAW_POST_DATA;
+	global $xmlrpc_handle;
 	# create xmlrpc handle
 	$xmlrpc_handle = xmlrpc_server_create();
 	# register functions available via rpc calls
 	xmlrpc_server_register_method($xmlrpc_handle, "XMLRPCaffiliations", "xmlRPChandler");
 
-	print xmlrpc_server_call_method($xmlrpc_handle, $HTTP_RAW_POST_DATA, '');
+	$raw_post_data = file_get_contents("php://input");
+	print xmlrpc_server_call_method($xmlrpc_handle, $raw_post_data, '');
 	xmlrpc_server_destroy($xmlrpc_handle);
 	dbDisconnect();
 	exit;