svn commit: r1096481 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
Author: arkurth Date: Mon Apr 25 13:52:04 2011 New Revision: 1096481 URL: http://svn.apache.org/viewvc?rev=1096481&view=rev Log: VCL-460 Updated the Windows 6.x activation subroutines to send critical notifications if KMS or MAK activation fails. Also added code to run_sysprep to replace the ProductKey line in the Unattend.xml file with the KMS activation key for the OS. Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm?rev=1096481&r1=1096480&r2=1096481&view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm Mon Apr 25 13:52:04 2011 @@ -259,14 +259,15 @@ sub activate { return 1; } - # Attempt to activate using KMS server - return 1 if $self->activate_kms(); - - # Attempt to activate using MAK product key - return 1 if $self->activate_mak(); - - notify($ERRORS{'WARNING'}, 0, "failed to activate Windows using MAK or KMS methods"); - return; + # Attempt to activate first using KMS server + # Attempt to activate using MAK if KMS fails or is not configured + if ($self->activate_kms() || $self->activate_mak()) { + return 1; + } + else { + notify($ERRORS{'CRITICAL'}, 0, "failed to activate Windows using MAK or KMS methods"); + return; + } } #/ @@ -304,7 +305,7 @@ sub activate_mak { notify($ERRORS{'DEBUG'}, 0, "installed MAK product key: $product_key"); } else { - notify($ERRORS{'WARNING'}, 0, "failed to install MAK product key: $product_key"); + notify($ERRORS{'CRITICAL'}, 0, "failed to install MAK product key: $product_key"); return; } @@ -314,7 +315,7 @@ sub activate_mak { return 1; } else { - notify($ERRORS{'WARNING'}, 0, "failed to activate Windows using MAK product key: $product_key"); + notify($ERRORS{'CRITICAL'}, 0, "failed to activate Windows using MAK product key: $product_key"); return; } } @@ -361,7 +362,7 @@ sub activate_kms { notify($ERRORS{'DEBUG'}, 0, "installed KMS client product key: $product_key"); } else { - notify($ERRORS{'WARNING'}, 0, "failed to install KMS client product key: $product_key"); + notify($ERRORS{'CRITICAL'}, 0, "failed to install KMS client product key: $product_key"); return; } @@ -381,12 +382,12 @@ sub activate_kms { return 1; } else { - notify($ERRORS{'WARNING'}, 0, "failed to activate Windows using KMS server: $kms_address:$kms_port"); + notify($ERRORS{'CRITICAL'}, 0, "failed to activate Windows using KMS server: $kms_address:$kms_port"); next; } } else { - notify($ERRORS{'WARNING'}, 0, "failed to set KMS server: $kms_address:$kms_port"); + notify($ERRORS{'CRITICAL'}, 0, "failed to set KMS server: $kms_address:$kms_port"); next; } } @@ -1455,6 +1456,9 @@ sub run_sysprep { my $node_configuration_directory = $self->get_node_configuration_directory(); + my $source_configuration_directory = eval '$' . ref($self) . '::SOURCE_CONFIGURATION_DIRECTORY'; + run_scp_command("$source_configuration_directory/Utilities/Sysprep/Unattend.xml", "$computer_node_name:$node_configuration_directory/Utilities/sysprep/Unattend.xml"); + # Delete existing Panther directory, contains Sysprep log files if (!$self->delete_file('C:/Windows/Panther')) { notify($ERRORS{'WARNING'}, 0, "unable to delete Panther directory, Sysprep will proceed"); @@ -1485,24 +1489,6 @@ sub run_sysprep { notify($ERRORS{'WARNING'}, 0, "unable to delete Sysprep_succeeded.tag log file, Sysprep will proceed"); } - # Delete existing MSDTC.LOG file - if (!$self->delete_file("$system32_path/MsDtc/MSTTC.LOG")) { - notify($ERRORS{'WARNING'}, 0, "unable to delete MSTTC.LOG file, Sysprep will proceed"); - } - - # Uninstall and reinstall MsDTC - my $msdtc_command = "$system32_path/msdtc.exe -uninstall ; $syste
svn commit: r1096497 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
Author: arkurth Date: Mon Apr 25 15:29:54 2011 New Revision: 1096497 URL: http://svn.apache.org/viewvc?rev=1096497&view=rev Log: VCL-461 Added enable_client_compatible_rdp_color_depth subroutine to Windows.pm and added call to this new subroutine to pre_capture(). VCL-462 Added call to dism.exe in clean_hard_drive subroutine to remove Windows 7 and 2008 service pack files when an image is captured. This reduces the size of the image by 1GB or more. Other Added log file path argument to 'netsh.exe reset' call in shutdown subroutine. This command fails if this isn't specified. Commented out call to disable_windows_defender in pre_capture. I added this a while ago but can't recall the reason why. Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1096497&r1=1096496&r2=1096497&view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Mon Apr 25 15:29:54 2011 @@ -389,15 +389,15 @@ sub pre_capture { notify($ERRORS{'WARNING'}, 0, "unable to disable IE configuration"); } -=item * - - Disable Windows Defender - -=cut - - if (!$self->disable_windows_defender()) { - notify($ERRORS{'WARNING'}, 0, "unable to disable Windows Defender"); - } +#=item * +# +# Disable Windows Defender +# +#=cut +# +# if (!$self->disable_windows_defender()) { +# notify($ERRORS{'WARNING'}, 0, "unable to disable Windows Defender"); +# } =item * @@ -440,6 +440,16 @@ sub pre_capture { if (!$self->enable_rdp_audio()) { notify($ERRORS{'WARNING'}, 0, "unable to enable RDP audio redirection"); } + +=item * + + Enable client-compatible color depth for RDP sessions + +=cut + + if (!$self->enable_client_compatible_rdp_color_depth()) { + notify($ERRORS{'WARNING'}, 0, "unable to enable client-compatible color depth for RDP sessions"); + } =item * @@ -1092,7 +1102,7 @@ sub delete_file { # Check if file exists before attempting to delete it if (!$self->file_exists($path_argument)) { - notify($ERRORS{'OK'}, 0, "failed not deleted because it does not exist: '$path_argument'"); + notify($ERRORS{'OK'}, 0, "file not deleted because it does not exist: '$path_argument'"); return 1; } @@ -3523,7 +3533,7 @@ sub shutdown { $shutdown_command .= "$system32_path/netsh.exe interface ip set dnsservers name=\\\"$private_interface_name\\\" source=dhcp & "; $shutdown_command .= "$system32_path/netsh.exe interface ip set address name=\\\"$public_interface_name\\\" source=dhcp & "; $shutdown_command .= "$system32_path/netsh.exe interface ip set dnsservers name=\\\"$public_interface_name\\\" source=dhcp & "; - $shutdown_command .= "$system32_path/netsh.exe interface ip reset & "; + $shutdown_command .= "$system32_path/netsh.exe interface ip reset $NODE_CONFIGURATION_DIRECTORY/Logs/ipreset.log & "; $shutdown_command .= "$system32_path/ipconfig.exe /release & "; $shutdown_command .= "$system32_path/ipconfig.exe /flushdns & "; $shutdown_command .= "$system32_path/arp.exe -d * & "; @@ -6424,6 +6434,30 @@ sub clean_hard_drive { my $computer_node_name = $self->data->get_computer_node_name(); my $system32_path= $self->get_system32_path() || return; + # Run dism.exe + # The dism.exe file may not be present + my $dism_command = "$system32_path/dism.exe /online /cleanup-image /spsuperseded"; + my ($dism_exit_status, $dism_output) = run_ssh_command($computer_node_name, $management_node_keys, $dism_command, '', '', 1); + if (!defined($dism_output)) { + notify($ERRORS{'WARNING'}, 0, "failed to run ssh command to run dism.exe"); + return; + } + elsif (grep(/not found|no such file/i, @$dism_output)) { + notify($ERRORS{'OK'}, 0, "dism.exe is not present on $computer_node_name"); + } + elsif (grep(/No service pack backup files/i, @$dism_output)) { + notify($ERRORS{'DEBUG'}, 0, "dism.exe did not find any service pack files to remove"); + } + elsif (grep(/spsuperseded option is not recognized/i, @$dism_output)) { + notify($ERRORS{'DEBUG'}, 0, "dism.exe is not able to remove service pack files for the OS version"); + } + elsif (grep(/operation completed successfully/i, @$dism_output)) { + notify($ERRORS{'OK'}, 0, "ran dism.exe, output:\n" . j
svn commit: r1096498 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
Author: arkurth Date: Mon Apr 25 15:30:50 2011 New Revision: 1096498 URL: http://svn.apache.org/viewvc?rev=1096498&view=rev Log: VCL-450 Added default minimum memory sizes for each OS/architecture which requires more than 512 MB of RAM in the %VM_OS_CONFIGURATION hash. Updated get_vm_ram to use this value. Added code to capture subroutine to save the vmx file used on the VM being captured along with the vmdk files. This vmx file can later be used as a reference. Added get_reference_vmx_file_name, get_reference_vmx_file_path, and get_reference_vmx_info subroutines. Updated copy_vmdk to also copy the reference vmx file when copying a vmdk. Updated get_vmdk_parameter_value to allow it to retrieve a parameter from the vmdk file if it resides on the VM host. It previously only checked the files on the management node. Updated get_vm_disk_adapter_type and get_vm_virtual_hardware_version to try to first retrieve the type from the reference vmx file. This should allow VMs using the LSI SAS adapter type to work correctly. Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1096498&r1=1096497&r2=1096498&view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Mon Apr 25 15:30:50 2011 @@ -87,17 +87,17 @@ our %VM_OS_CONFIGURATION = ( "scsi-virtualDev" => "lsiLogic", }, # Windows configurations: - "xp-x86" => { + "winxp-x86" => { "guestOS" => "winXPPro", "ethernet-virtualDev" => "vlance", "scsi-virtualDev" => "busLogic", }, - "xp-x86_64" => { + "winxp-x86_64" => { "guestOS" => "winXPPro-64", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", }, - "vista-x86" => { + "winvista-x86" => { "guestOS" => "winvista", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", @@ -109,34 +109,35 @@ our %VM_OS_CONFIGURATION = ( "scsi-virtualDev" => "lsiLogic", "memsize" => 1024, }, - "7-x86" => { + "win7-x86" => { "guestOS" => "windows7", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", "memsize" => 1024, }, - "7-x86_64" => { + "win7-x86_64" => { "guestOS" => "windows7-64", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", "memsize" => 2048, }, - "2003-x86" => { + "win2003-x86" => { "guestOS" => "winNetEnterprise", "ethernet-virtualDev" => "vlance", "scsi-virtualDev" => "lsiLogic", }, - "2003-x86_64" => { + "win2003-x86_64" => { "guestOS" => "winNetEnterprise-64", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", + "memsize" => 1024, }, - "2008-x86" => { + "win2008-x86" => { "guestOS" => "winServer2008Enterprise-32", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", }, - "2008-x86_64" => { + "win2008-x86_64" => { "guestOS" => "winServer2008Enterprise-64", "ethernet-virtualDev" => "e1000", "scsi-virtualDev" => "lsiLogic", @@ -469,7 +470,7 @@ sub capture { notify($ERRORS{'WARNING'}, 0, "failed to determine the vmx file path actively being used by VM $computer_name"); return; } - + # Set the vmx file path in this object so that it overrides the default value that would normally be constructed if (!$self->set_vmx_file_path($vmx_file_path_original)) { notify($ERRORS{'WARNING'}, 0, "failed to set the vmx file to the path that was determined to be in use by VM $computer_name being captured: $vmx_file_path_original"); @@ -535,6 +536,11 @@ sub capture { my $vmdk_directory_path_renamed = "$vmdk_base_directory_path/$image_name"; my $vmdk_file_path_renamed = "$vmdk_directory_path_renamed/$image_name.vmdk"; + # Construct the path of the reference vmx file to be saved with the vmdk + # The .vmx file is only saved so that it can be referenced later + my $reference_vmx_file_name = $self->get_reference_vmx_file_name(); + my $vmx_file_path_renamed
svn commit: r1096563 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
Author: arkurth Date: Mon Apr 25 19:00:31 2011 New Revision: 1096563 URL: http://svn.apache.org/viewvc?rev=1096563&view=rev Log: VCL-450 Removed code from capture subroutine which copies the reference vmx file after copy_vmdk is called because copy_vmdk handles this task. Moved $reservation_password declaration in prepare_vmx to a commented-out section later on. This section is the only place it's used and the declaration was causing warnings to appear in the log file if the password wasn't initialized. Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1096563&r1=1096562&r2=1096563&view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Mon Apr 25 19:00:31 2011 @@ -616,15 +616,7 @@ sub capture { # Files can be copied directly to the image repository and converted while they are copied my $repository_vmdk_file_path = $self->get_repository_vmdk_file_path(); if ($self->copy_vmdk($vmdk_file_path_renamed, $repository_vmdk_file_path, '2gbsparse')) { - - # Copy the reference vmx file of the VM being captured to the vmdk directory - my $repository_vmx_file_path = "$repository_directory_path/$image_name.vmx"; - if ($self->vmhost_os->copy_file($vmx_file_path_renamed, $repository_vmx_file_path)) { - $repository_copy_successful = 1; - } - else { - notify($ERRORS{'WARNING'}, 0, "failed to copy the reference vmx file to the repository mounted on the VM host after the VM was powered off: '$vmx_file_path_renamed' --> '$repository_vmx_file_path'"); - } + $repository_copy_successful = 1; } else { notify($ERRORS{'WARNING'}, 0, "failed to copy the vmdk files to the repository mounted on the VM host after the VM was powered off: '$vmdk_file_path_renamed' --> '$repository_vmdk_file_path'"); @@ -1492,7 +1484,6 @@ sub prepare_vmx { my $vm_persistent= $self->is_vm_persistent(); my $guest_os = $self->get_vm_guest_os() || return; my $vmware_product_name = $self->get_vmhost_product_name(); - my $reservation_password = $self->data->get_reservation_password(); # Create the .vmx directory on the host if (!$self->vmhost_os->create_directory($vmx_directory_path)) { @@ -1626,6 +1617,7 @@ sub prepare_vmx { "mainMem.useNamedFile" => "FALSE", ); + #my $reservation_password = $self->data->get_reservation_password(); #if (defined($reservation_password)) { # my $vnc_port = ($computer_id + 1); # notify($ERRORS{'DEBUG'}, 0, "vnc access will be enabled, port: $vnc_port, password: $reservation_password");