You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2014/12/10 00:56:56 UTC
svn commit: r1644246 [2/2] - in /vcl/trunk/managementnode/lib/VCL: ./
Module/ Module/OS/ Module/OS/Linux/ Module/OS/Windows/ Module/Predictive/
Module/Provisioning/ Module/Provisioning/VMware/
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Tue Dec 9 23:56:55 2014
@@ -2544,11 +2544,6 @@ sub reg_query {
$data = $self->reg_query_convert_data($type, $data);
- #notify($ERRORS{'DEBUG'}, 0, "line: " . string_to_ascii($line) . "\n" .
- #"value: " . string_to_ascii($value) . "\n" .
- #"data: " . string_to_ascii($data)
- #);
-
if (!defined($key) || !defined($value) || !defined($data) || !defined($type)) {
my $message = "some registry data is undefined:\n";
$message .= "line: '$line'\n";
@@ -4466,10 +4461,10 @@ sub get_firewall_configuration {
}
}
elsif (!defined($previous_protocol) ||
- !defined($previous_port) ||
- !defined($firewall_configuration->{$previous_protocol}) ||
- !defined($firewall_configuration->{$previous_protocol}{$previous_port})
- ) {
+ !defined($previous_port) ||
+ !defined($firewall_configuration->{$previous_protocol}) ||
+ !defined($firewall_configuration->{$previous_protocol}{$previous_port})
+ ) {
next;
}
elsif (my ($scope) = $line =~ /Scope:\s+(.+)/ig) {
@@ -4890,10 +4885,10 @@ sub _enable_firewall_port_helper {
}
elsif (@$netsh_output[-1] =~ /(Ok|The object already exists)/i) {
notify($ERRORS{'OK'}, 0, "opened firewall on $computer_node_name:\n" .
- "name: '$name'\n" .
- "protocol: $protocol\n" .
- "port/type: $port\n" .
- "scope: $scope"
+ "name: '$name'\n" .
+ "protocol: $protocol\n" .
+ "port/type: $port\n" .
+ "scope: $scope"
);
return 1;
}
@@ -6732,7 +6727,7 @@ sub search_and_replace_in_files {
Returns :
Description : Copies all required configuration files to the computer,
including scripts, utilities, drivers needed to capture an
- image.
+ image.
=cut
@@ -8233,15 +8228,15 @@ sub set_static_public_address {
my $computer_name = $self->data->get_computer_short_name();
- my $server_request_id = $self->data->get_server_request_id();
- my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
+ my $server_request_id = $self->data->get_server_request_id();
+ my $server_request_fixed_ip = $self->data->get_server_request_fixed_ip();
# Make sure public IP configuration is static or this is a server request
my $ip_configuration = $self->data->get_management_node_public_ip_configuration();
if ($ip_configuration !~ /static/i) {
- if ( !$server_request_fixedIP ) {
- notify($ERRORS{'WARNING'}, 0, "static public address can only be set if IP configuration is static, current value: $ip_configuration \nserver_request_fixedIP=$server_request_fixedIP");
- return;
+ if ( !$server_request_fixed_ip ) {
+ notify($ERRORS{'WARNING'}, 0, "static public address can only be set if IP configuration is static, current value: $ip_configuration \nserver_request_fixed_ip=$server_request_fixed_ip");
+ return;
}
}
@@ -8252,11 +8247,11 @@ sub set_static_public_address {
my $default_gateway = $self->data->get_management_node_public_default_gateway() || '<undefined>';
my @dns_servers = $self->data->get_management_node_public_dns_servers();
- if ($server_request_fixedIP) {
- $computer_public_ip_address = $server_request_fixedIP;
+ if ($server_request_fixed_ip) {
+ $computer_public_ip_address = $server_request_fixed_ip;
$subnet_mask = $self->data->get_server_request_netmask();
$default_gateway = $self->data->get_server_request_router();
- @dns_servers = $self->data->get_server_request_DNSservers();
+ @dns_servers = $self->data->get_server_request_dns_servers();
}
# Assemble a string containing the static IP configuration
@@ -10651,8 +10646,7 @@ sub disable_login_screensaver {
}
my $registry_key = 'HKEY_USERS\\.DEFAULT\\Control Panel\\Desktop';
- if ($self->reg_add($registry_key, 'ScreenSaveActive', 'REG_SZ', 0) &&
- $self->reg_add($registry_key, 'ScreenSaveTimeOut', 'REG_SZ', 0)) {
+ if ($self->reg_add($registry_key, 'ScreenSaveActive', 'REG_SZ', 0) && $self->reg_add($registry_key, 'ScreenSaveTimeOut', 'REG_SZ', 0)) {
notify($ERRORS{'DEBUG'}, 0, "set registry keys to disable the login screensaver");
}
else {
@@ -11454,10 +11448,10 @@ sub check_image {
my $disable_user_names_regex = join("|", @disable_user_names);
notify($ERRORS{'DEBUG'}, 0, "image users:\n" .
- "users on $image_name: " . join(", ", @image_user_names) . "\n" .
- "reservation users: " . join(", ", @reservation_user_names) . "\n" .
- "users which should be disabled for all images: " . join(", ", @disable_user_names) . "\n" .
- "users which can be ignored for all images: " . join(", ", @ignore_user_names) . "\n"
+ "users on $image_name: " . join(", ", @image_user_names) . "\n" .
+ "reservation users: " . join(", ", @reservation_user_names) . "\n" .
+ "users which should be disabled for all images: " . join(", ", @disable_user_names) . "\n" .
+ "users which can be ignored for all images: " . join(", ", @ignore_user_names) . "\n"
);
my @image_user_names_reservation = ();
@@ -11499,10 +11493,10 @@ sub check_image {
if (scalar(@image_user_names_report) > 0 || !$firewall_state || $firewall_state !~ /(1|yes|on|enabled)/i) {
notify($ERRORS{'DEBUG'}, 0, "reporting $image_name image to imagerevisioninfo table (imagerevision ID: $imagerevision_id):\n" .
- "firewall state: $firewall_state\n" .
- "reservation users found on image: " . join(", ", @image_user_names_reservation) . "\n" .
- "ignored users found on image: " . join(", ", @image_user_names_ignore) . "\n" .
- "users which might not belong on image: " . join(", ", @image_user_names_report)
+ "firewall state: $firewall_state\n" .
+ "reservation users found on image: " . join(", ", @image_user_names_reservation) . "\n" .
+ "ignored users found on image: " . join(", ", @image_user_names_ignore) . "\n" .
+ "users which might not belong on image: " . join(", ", @image_user_names_report)
);
$self->update_imagerevision_info($imagerevision_id, join(",", @image_user_names_report), $firewall_state);
@@ -11887,7 +11881,7 @@ sub notify_user_console {
my $username = shift;
if (!$username) {
- $username = $self->data->get_user_login_id();
+ $username = $self->data->get_user_login_id();
}
my $request_forimaging = $self->data->get_request_forimaging();
if ($request_forimaging) {
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm Tue Dec 9 23:56:55 2014
@@ -1689,10 +1689,10 @@ sub _enable_firewall_port_helper {
}
elsif (@$netsh_output[-1] =~ /(Ok|The object already exists)/i) {
notify($ERRORS{'OK'}, 0, "opened firewall on $computer_node_name:\n" .
- "name: '$name'\n" .
- "protocol: $protocol\n" .
- "port/type: $port\n" .
- "scope: $scope"
+ "name: '$name'\n" .
+ "protocol: $protocol\n" .
+ "port/type: $port\n" .
+ "scope: $scope"
);
return 1;
}
@@ -2339,36 +2339,36 @@ sub query_event_log_helper {
Parameters : $past_minutes (optional)
Returns : array
Description : Queries the event log for logon events in either the Security log
- or Microsoft-Windows-TerminalServices-LocalSessionManager.
- Anonymous logon and service logons are ignored. An array is
- returned sorted by time from oldest to newest. Example:
- [
- {
- "datetime" => "2014-03-18 19:15:25",
- "description" => "An account was successfully logged on",
- "epoch" => "1395184525",
- "event_id" => 4624,
- "event_record_id" => 2370,
- "logon_type" => "Interactive",
- "logon_type_id" => 2,
- "pid" => 4624,
- "provider" => "Microsoft-Windows-Security-Auditing",
- "remote_ip" => "127.0.0.1",
- "user" => "root"
- },
- {
- "datetime" => "2014-03-19 17:06:37",
- "description" => "An account was successfully logged on",
- "epoch" => "1395263197",
- "event_id" => 4624,
- "event_record_id" => 2665,
- "logon_type" => "Network",
- "logon_type_id" => 3,
- "pid" => 4624,
- "provider" => "Microsoft-Windows-Security-Auditing",
- "user" => "Administrator"
- },
- ]
+ or Microsoft-Windows-TerminalServices-LocalSessionManager.
+ Anonymous logon and service logons are ignored. An array is
+ returned sorted by time from oldest to newest. Example:
+ [
+ {
+ "datetime" => "2014-03-18 19:15:25",
+ "description" => "An account was successfully logged on",
+ "epoch" => "1395184525",
+ "event_id" => 4624,
+ "event_record_id" => 2370,
+ "logon_type" => "Interactive",
+ "logon_type_id" => 2,
+ "pid" => 4624,
+ "provider" => "Microsoft-Windows-Security-Auditing",
+ "remote_ip" => "127.0.0.1",
+ "user" => "root"
+ },
+ {
+ "datetime" => "2014-03-19 17:06:37",
+ "description" => "An account was successfully logged on",
+ "epoch" => "1395263197",
+ "event_id" => 4624,
+ "event_record_id" => 2665,
+ "logon_type" => "Network",
+ "logon_type_id" => 3,
+ "pid" => 4624,
+ "provider" => "Microsoft-Windows-Security-Auditing",
+ "user" => "Administrator"
+ },
+ ]
=cut
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm Tue Dec 9 23:56:55 2014
@@ -101,10 +101,10 @@ sub get_next_image {
my @block_ret_array = get_block_request_image_info($computer_id);
if (defined($block_ret_array[0]) && $block_ret_array[0]) {
- push(@ret_array, "reload", @block_ret_array);
- return @ret_array;
+ push(@ret_array, "reload", @block_ret_array);
+ return @ret_array;
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "computer $computer_id is part of blockComputers, failed to return image info");
}
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm Tue Dec 9 23:56:55 2014
@@ -98,7 +98,7 @@ sub get_next_image {
push(@ret_array, "reload", @block_ret_array);
return @ret_array;
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "computer $computer_id is part of blockComputers, failed to return image info");
}
}
Modified: vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_2.pm Tue Dec 9 23:56:55 2014
@@ -100,7 +100,7 @@ sub get_next_image {
push(@ret_array, "reload", @block_ret_array);
return @ret_array;
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "computer $computer_id is part of blockComputers, failed to return image info");
}
}
@@ -152,25 +152,25 @@ sub get_next_image {
#Look for any upcoming reservations
my $select_statement = "
- SELECT DISTINCT
- req.start AS starttime,
- ir.imagename AS imagename,
- res.imagerevisionid AS imagerevisionid,
- res.imageid AS imageid
- FROM
- reservation res,
- request req,
- image i,
- state s,
- imagerevision ir
- WHERE
- res.requestid = req.id
- AND req.stateid = s.id
- AND i.id = res.imageid
- AND ir.id = res.imagerevisionid
- AND res.computerid = $computer_id
- AND (s.name = \'new\' OR s.name = \'reload\' OR s.name = \'imageprep\')
- ";
+ SELECT DISTINCT
+ req.start AS starttime,
+ ir.imagename AS imagename,
+ res.imagerevisionid AS imagerevisionid,
+ res.imageid AS imageid
+ FROM
+ reservation res,
+ request req,
+ image i,
+ state s,
+ imagerevision ir
+ WHERE
+ res.requestid = req.id
+ AND req.stateid = s.id
+ AND i.id = res.imageid
+ AND ir.id = res.imagerevisionid
+ AND res.computerid = $computer_id
+ AND (s.name = \'new\' OR s.name = \'reload\' OR s.name = \'imageprep\')
+ ";
# Call the database select subroutine
# This will return an array of one or more rows based on the select statement
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm Tue Dec 9 23:56:55 2014
@@ -134,19 +134,19 @@ sub load {
[1]: log file path (optional)
Returns : Depends on the context which node_status was called:
default: string containing "READY" or "FAIL"
- boolean: true if ping, SSH, and VCL client checks are successful
- false if any checks fail
+ boolean: true if ping, SSH, and VCL client checks are successful
+ false if any checks fail
list: array, values are 1 for SUCCESS, 0 for FAIL
- [0]: Node status ("READY" or "FAIL")
- [1]: Ping status (0 or 1)
- [2]: SSH status (0 or 1)
- [3]: VCL client daemon status (0 ir 1)
- arrayref: reference to array described above
+ [0]: Node status ("READY" or "FAIL")
+ [1]: Ping status (0 or 1)
+ [2]: SSH status (0 or 1)
+ [3]: VCL client daemon status (0 ir 1)
+ arrayref: reference to array described above
hashref: reference to hash with keys/values:
- {status} => <"READY","FAIL">
- {ping} => <0,1>
- {ssh} => <0,1>
- {vcl_client} => <0,1>
+ {status} => <"READY","FAIL">
+ {ping} => <0,1>
+ {ssh} => <0,1>
+ {vcl_client} => <0,1>
Description : Checks the status of a lab machine. Checks if the machine is
pingable, can be accessed via SSH, and the VCL client is running.
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Tue Dec 9 23:56:55 2014
@@ -350,8 +350,8 @@ sub initialize {
$self->{api} = $vmware_api;
notify($ERRORS{'DEBUG'}, 0, "VMware OS and API objects created for VM host $vmhost_computer_name:\n" .
- "VM host OS object type: " . ref($self->vmhost_os) . "\n" .
- "VMware API object type: " . ref($self->api) . "\n"
+ "VM host OS object type: " . ref($self->vmhost_os) . "\n" .
+ "VMware API object type: " . ref($self->api) . "\n"
);
# Make sure the VMware product name can be retrieved
@@ -1214,9 +1214,9 @@ sub get_vmhost_datastructure {
my $vmhost_data;
eval {
$vmhost_data= new VCL::DataStructure({request_data => $request_data,
- reservation_id => $reservation_id,
- computer_identifier => $vmhost_computer_id,
- image_identifier => $vmhost_profile_image_id});
+ reservation_id => $reservation_id,
+ computer_identifier => $vmhost_computer_id,
+ image_identifier => $vmhost_profile_image_id});
};
if ($EVAL_ERROR) {
@@ -1349,10 +1349,11 @@ sub get_vmhost_api_object {
# Create an API object to control the VM host and VMs
my $api;
- eval { $api = ($api_perl_package)->new({data_structure => $self->data,
- vmhost_data => $vmhost_datastructure,
- vmhost_os => $self->vmhost_os
- })};
+ eval { $api = ($api_perl_package)->new({
+ data_structure => $self->data,
+ vmhost_data => $vmhost_datastructure,
+ vmhost_os => $self->vmhost_os
+ })};
if (!$api) {
if ($EVAL_ERROR) {
notify($ERRORS{'WARNING'}, 0, "API object could not be created: $api_perl_package, error:\n$EVAL_ERROR");
@@ -1686,25 +1687,25 @@ sub prepare_vmx {
# ide needed for boot
# usb needed for mouse
# monitor, ich7m, smc for darwin
- if ($image_os_type =~ /osx/i) {
- %vmx_parameters = (%vmx_parameters, (
- "ide1:0.clientDevice" => "TRUE",
- "ide1:0.deviceType" => "atapi-cdrom",
- "ide1:0.fileName" => "",
- "ide1:0.present" => "TRUE",
- "ide1:0.startConnected" => "FALSE",
- "usb.present" => "TRUE",
- "usb:1.deviceType" => "hub",
- "usb:1.present" => "TRUE",
- "usb:2.deviceType" => "mouse",
- "usb:2.present" => "TRUE",
- "monitor.virtual_exec" => "hardware",
- "monitor.virtual_mmu" => "software",
- "ich7m.present" => "TRUE",
- "smc.present" => "FALSE",
- "keyboard.vusb.enable" => "TRUE",
- "mouse.vusb.enable" => "TRUE",
- ));
+ if ($image_os_type =~ /osx/i) {
+ %vmx_parameters = (%vmx_parameters, (
+ "ide1:0.clientDevice" => "TRUE",
+ "ide1:0.deviceType" => "atapi-cdrom",
+ "ide1:0.fileName" => "",
+ "ide1:0.present" => "TRUE",
+ "ide1:0.startConnected" => "FALSE",
+ "usb.present" => "TRUE",
+ "usb:1.deviceType" => "hub",
+ "usb:1.present" => "TRUE",
+ "usb:2.deviceType" => "mouse",
+ "usb:2.present" => "TRUE",
+ "monitor.virtual_exec" => "hardware",
+ "monitor.virtual_mmu" => "software",
+ "ich7m.present" => "TRUE",
+ "smc.present" => "FALSE",
+ "keyboard.vusb.enable" => "TRUE",
+ "mouse.vusb.enable" => "TRUE",
+ ));
}
# Check if the API implements 'add_ethernet_adapter'
@@ -2122,12 +2123,13 @@ sub is_vmx_vmdk_volume_shared {
}
notify($ERRORS{'DEBUG'}, 0, "checking if vmx and vmdk base directory paths appear to be on the same volume:\n" .
- "vmx base directory path: '$vmx_base_directory_path'\n" .
- "vmdk base directory path: '$vmdk_base_directory_path'\n" .
- "vmx volume total space: " . get_file_size_info_string($vmx_volume_total_space) . "\n" .
- "vmdk volume total space: " . get_file_size_info_string($vmdk_volume_total_space) . "\n" .
- "vmx volume available space: " . get_file_size_info_string($vmx_volume_available_space) . "\n" .
- "vmdk volume available space: " . get_file_size_info_string($vmdk_volume_available_space));
+ "vmx base directory path: '$vmx_base_directory_path'\n" .
+ "vmdk base directory path: '$vmdk_base_directory_path'\n" .
+ "vmx volume total space: " . get_file_size_info_string($vmx_volume_total_space) . "\n" .
+ "vmdk volume total space: " . get_file_size_info_string($vmdk_volume_total_space) . "\n" .
+ "vmx volume available space: " . get_file_size_info_string($vmx_volume_available_space) . "\n" .
+ "vmdk volume available space: " . get_file_size_info_string($vmdk_volume_available_space)
+ );
if ($vmx_base_directory_path eq $vmdk_base_directory_path || ($vmx_volume_total_space == $vmdk_volume_total_space && abs($vmx_volume_available_space - $vmdk_volume_available_space) < ($vmdk_volume_total_space * .01))) {
notify($ERRORS{'DEBUG'}, 0, "vmx and vmdk base directory paths appear to be on the same volume based on the total and available space");
@@ -2603,24 +2605,27 @@ sub reclaim_vmhost_disk_space {
if ($available_space >= $additional_space_required) {
notify($ERRORS{'DEBUG'}, 0, "enough space is already available to accomodate the VM:\n" .
- "currently available space: " . get_file_size_info_string($available_space) . "\n" .
- "space required for the VM: " . get_file_size_info_string($additional_space_required));
+ "currently available space: " . get_file_size_info_string($available_space) . "\n" .
+ "space required for the VM: " . get_file_size_info_string($additional_space_required)
+ );
return 1;
}
elsif ($potential_available_space < $additional_space_required) {
notify($ERRORS{'WARNING'}, 0, "not enough space can be reclaimed to accomodate the VM:\n" .
- "deletable space: " . get_file_size_info_string($deletable_space) . "\n" .
- "currently available space: " . get_file_size_info_string($available_space) . "\n" .
- "potential available space: " . get_file_size_info_string($potential_available_space) . "\n" .
- "space required for the VM: " . get_file_size_info_string($additional_space_required));
+ "deletable space: " . get_file_size_info_string($deletable_space) . "\n" .
+ "currently available space: " . get_file_size_info_string($available_space) . "\n" .
+ "potential available space: " . get_file_size_info_string($potential_available_space) . "\n" .
+ "space required for the VM: " . get_file_size_info_string($additional_space_required)
+ );
return 0;
}
else {
notify($ERRORS{'DEBUG'}, 0, "enough space can be reclaimed to accomodate the VM:\n" .
- "deletable space: " . get_file_size_info_string($deletable_space) . "\n" .
- "currently available space: " . get_file_size_info_string($available_space) . "\n" .
- "potential available space: " . get_file_size_info_string($potential_available_space) . "\n" .
- "space required for the VM: " . get_file_size_info_string($additional_space_required));
+ "deletable space: " . get_file_size_info_string($deletable_space) . "\n" .
+ "currently available space: " . get_file_size_info_string($available_space) . "\n" .
+ "potential available space: " . get_file_size_info_string($potential_available_space) . "\n" .
+ "space required for the VM: " . get_file_size_info_string($additional_space_required)
+ );
}
}
else {
@@ -2632,43 +2637,47 @@ sub reclaim_vmhost_disk_space {
if ($vmx_available_space >= $vmx_additional_bytes_required && $vmdk_available_space >= $vmdk_additional_bytes_required) {
notify($ERRORS{'DEBUG'}, 0, "enough space is already available to accomodate the VM:\n" .
- "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
- "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
- "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
- "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space));
+ "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
+ "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
+ "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
+ "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space)
+ );
return 1;
}
my $deficit = 0;
if ($vmx_potential_available_space < $vmx_additional_bytes_required) {
notify($ERRORS{'WARNING'}, 0, "not enough space can be reclaimed to accomodate the vmx directory:\n" .
- "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
- "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
- "vmx volume deletable space: " . get_file_size_info_string($total_deletable_vmx_size) . "\n" .
- "vmx volume potentially available space: " . get_file_size_info_string($vmx_potential_available_space));
-
+ "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
+ "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
+ "vmx volume deletable space: " . get_file_size_info_string($total_deletable_vmx_size) . "\n" .
+ "vmx volume potentially available space: " . get_file_size_info_string($vmx_potential_available_space)
+ );
+
$deficit = 1;
}
if ($vmdk_potential_available_space < $vmdk_additional_bytes_required) {
notify($ERRORS{'WARNING'}, 0, "not enough space can be reclaimed to accomodate the vmdk directory:\n" .
- "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
- "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space) . "\n" .
- "vmdk volume deletable space: " . get_file_size_info_string($total_deletable_vmdk_size) . "\n" .
- "vmdk volume potentially available space: " . get_file_size_info_string($vmdk_potential_available_space));
+ "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
+ "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space) . "\n" .
+ "vmdk volume deletable space: " . get_file_size_info_string($total_deletable_vmdk_size) . "\n" .
+ "vmdk volume potentially available space: " . get_file_size_info_string($vmdk_potential_available_space)
+ );
$deficit = 1;
}
return 0 if $deficit;
notify($ERRORS{'DEBUG'}, 0, "enough space can be reclaimed to accomodate the VM:\n" .
- "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
- "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
- "vmx volume deletable space: " . get_file_size_info_string($total_deletable_vmx_size) . "\n" .
- "vmx volume potentially available space: " . get_file_size_info_string($vmx_potential_available_space) . "\n" .
- "---\n" .
- "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
- "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space) . "\n" .
- "vmdk volume deletable space: " . get_file_size_info_string($total_deletable_vmdk_size) . "\n" .
- "vmdk volume potentially available space: " . get_file_size_info_string($vmdk_potential_available_space));
+ "space required for the vmx directory: " . get_file_size_info_string($vmx_additional_bytes_required) . "\n" .
+ "vmx volume available space: " . get_file_size_info_string($vmx_available_space) . "\n" .
+ "vmx volume deletable space: " . get_file_size_info_string($total_deletable_vmx_size) . "\n" .
+ "vmx volume potentially available space: " . get_file_size_info_string($vmx_potential_available_space) . "\n" .
+ "---\n" .
+ "space required for the vmdk directory: " . get_file_size_info_string($vmdk_additional_bytes_required) . "\n" .
+ "vmdk volume available space: " . get_file_size_info_string($vmdk_available_space) . "\n" .
+ "vmdk volume deletable space: " . get_file_size_info_string($total_deletable_vmdk_size) . "\n" .
+ "vmdk volume potentially available space: " . get_file_size_info_string($vmdk_potential_available_space)
+ );
}
my @delete_stage_order = (
@@ -4302,8 +4311,9 @@ sub get_image_size_bytes {
}
elsif (defined($image_size_bytes_repository) && defined($image_size_bytes_datastore)) {
notify($ERRORS{'DEBUG'}, 0, "image size retrieved from both the image repository and VM host datastore:\n" .
- "image repository: " . format_number($image_size_bytes_repository) . "\n" .
- "VM host datastore: " . format_number($image_size_bytes_datastore));
+ "image repository: " . format_number($image_size_bytes_repository) . "\n" .
+ "VM host datastore: " . format_number($image_size_bytes_datastore)
+ );
if ($image_size_bytes_repository > $image_size_bytes_datastore) {
$image_size_bytes = $image_size_bytes_repository;
@@ -4322,9 +4332,10 @@ sub get_image_size_bytes {
my $image_size_mb = format_number(($image_size_bytes / 1024 / 1024));
my $image_size_gb = format_number(($image_size_bytes / 1024 / 1024 / 1024), 2);
notify($ERRORS{'DEBUG'}, 0, "size of $image_name image:\n" .
- format_number($image_size_bytes) . " bytes\n" .
- "$image_size_mb MB\n" .
- "$image_size_gb GB");
+ format_number($image_size_bytes) . " bytes\n" .
+ "$image_size_mb MB\n" .
+ "$image_size_gb GB"
+ );
return $image_size_bytes;
}
@@ -5570,9 +5581,10 @@ sub get_vm_additional_vmx_bytes_required
}
notify($ERRORS{'DEBUG'}, 0, "estimate of additional space required for the vmx directory:\n" .
- "vmem/vswp file: " . get_file_size_info_string($vm_ram_bytes) . "\n" .
- "redo files: " . get_file_size_info_string($redo_size) . "\n" .
- "total: " . get_file_size_info_string($additional_bytes_required));
+ "vmem/vswp file: " . get_file_size_info_string($vm_ram_bytes) . "\n" .
+ "redo files: " . get_file_size_info_string($redo_size) . "\n" .
+ "total: " . get_file_size_info_string($additional_bytes_required)
+ );
# Store the value in this object so it doesn't have to be retrieved again
$self->{additional_vmx_bytes_required} = $additional_bytes_required;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm Tue Dec 9 23:56:55 2014
@@ -253,10 +253,11 @@ sub vm_register {
local $SIG{__DIE__} = sub{};
my $vm_mo_ref;
- eval { $vm_mo_ref = $vm_folder->RegisterVM(path => $vmx_path,
- asTemplate => 'false',
- pool => $resource_pool
- );
+ eval {
+ $vm_mo_ref = $vm_folder->RegisterVM(path => $vmx_path,
+ asTemplate => 'false',
+ pool => $resource_pool
+ );
};
if ($@) {
@@ -1044,12 +1045,13 @@ sub move_virtual_disk {
# Attempt to move the virtual disk using MoveVirtualDisk
notify($ERRORS{'DEBUG'}, 0, "attempting to move virtual disk on VM host $vmhost_name: '$source_path' --> '$destination_path'");
- eval { $virtual_disk_manager->MoveVirtualDisk(sourceName => $source_path,
- sourceDatacenter => $datacenter,
- destName => $destination_path,
- destDatacenter => $datacenter,
- force => 0);
- };
+ eval { $virtual_disk_manager->MoveVirtualDisk(
+ sourceName => $source_path,
+ sourceDatacenter => $datacenter,
+ destName => $destination_path,
+ destDatacenter => $datacenter,
+ force => 0
+ );};
# Check if an error occurred
if (my $fault = $@) {
@@ -1153,8 +1155,9 @@ sub create_nfs_datastore {
}
else {
notify($ERRORS{'WARNING'}, 0, "$check_datastore_type datastore '$datastore_name' already exists on VM host but it is pointing to a different remote path:
- requested remote path: $datastore_device
- existing remote path: $check_datastore_device");
+ requested remote path: $datastore_device
+ existing remote path: $check_datastore_device"
+ );
return;
}
}
@@ -1162,8 +1165,9 @@ sub create_nfs_datastore {
# Datastore names don't match, make sure an existing datastore with a different name isn't pointing to the requested device path
if ($check_datastore_device eq $datastore_device) {
notify($ERRORS{'WARNING'}, 0, "$check_datastore_type datastore with a different name already exists on VM host pointing to '$check_datastore_device':
- requested datastore name: $datastore_name
- existing datastore name: $check_datastore_name");
+ requested datastore name: $datastore_name
+ existing datastore name: $check_datastore_name"
+ );
return;
}
else {
@@ -1181,11 +1185,12 @@ sub create_nfs_datastore {
}
# Create a HostNasVolumeSpec object to store the datastore configuration
- my $host_nas_volume_spec = HostNasVolumeSpec->new(accessMode => 'readWrite',
- localPath => $datastore_name,
- remoteHost => $remote_host,
- remotePath => $remote_path,
- );
+ my $host_nas_volume_spec = HostNasVolumeSpec->new(
+ accessMode => 'readWrite',
+ localPath => $datastore_name,
+ remoteHost => $remote_host,
+ remotePath => $remote_path,
+ );
# Override the die handler
local $SIG{__DIE__} = sub{};
@@ -1669,12 +1674,13 @@ sub copy_file {
# Attempt to copy the file
notify($ERRORS{'DEBUG'}, 0, "attempting to copy file on VM host $vmhost_hostname: '$source_file_path' --> '$destination_file_path'");
- eval { $file_manager->CopyDatastoreFile(sourceName => $source_file_path,
- sourceDatacenter => $datacenter,
- destinationName => $destination_file_path,
- destinationDatacenter => $datacenter,
- force => 0);
- };
+ eval { $file_manager->CopyDatastoreFile(
+ sourceName => $source_file_path,
+ sourceDatacenter => $datacenter,
+ destinationName => $destination_file_path,
+ destinationDatacenter => $datacenter,
+ force => 0
+ );};
# Check if an error occurred
if ($@) {
@@ -1936,12 +1942,12 @@ sub move_file {
# Attempt to copy the file
notify($ERRORS{'DEBUG'}, 0, "attempting to move file on VM host $vmhost_hostname: '$source_file_path' --> '$destination_file_path'");
- eval { $file_manager->MoveDatastoreFile(sourceName => $source_file_path,
- sourceDatacenter => $datacenter,
- destinationName => $destination_file_path,
- destinationDatacenter => $datacenter
- );
- };
+ eval { $file_manager->MoveDatastoreFile(
+ sourceName => $source_file_path,
+ sourceDatacenter => $datacenter,
+ destinationName => $destination_file_path,
+ destinationDatacenter => $datacenter
+ );};
if ($@) {
if ($@->isa('SoapFault') && ref($@->detail) eq 'FileNotFound') {
@@ -3175,8 +3181,8 @@ sub _get_resource_pool_view {
# Check if the retrieved resource pool matches the profile resource path
if ($vmhost_profile_resource_path =~ /^$resource_pool_path$/i) {
notify($ERRORS{'DEBUG'}, 0, "found matching resource pool on VM host $vmhost_name\n" .
- "VM host profile resource path: $vmhost_profile_resource_path\n" .
- "resource pool path on host: $resource_pool_path"
+ "VM host profile resource path: $vmhost_profile_resource_path\n" .
+ "resource pool path on host: $resource_pool_path"
);
$self->{resource_pool_view_object} = $resource_pool;
return $resource_pool;
@@ -3185,8 +3191,8 @@ sub _get_resource_pool_view {
# Check if the fixed retrieved resource pool path matches the profile resource path
if ($vmhost_profile_resource_path =~ /^$resource_pool_path$/i) {
notify($ERRORS{'DEBUG'}, 0, "found resource pool on VM host $vmhost_name matching VM host profile resource path with default hidden levels removed:\n" .
- "path on VM host: '$resource_pool_path'\n" .
- "VM profile path: '$vmhost_profile_resource_path'"
+ "path on VM host: '$resource_pool_path'\n" .
+ "VM profile path: '$vmhost_profile_resource_path'"
);
$self->{resource_pool_view_object} = $resource_pool;
return $resource_pool;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm Tue Dec 9 23:56:55 2014
@@ -663,13 +663,13 @@ sub netapp_rename_dir
my $s = $_[0];
my $from_path = $_[1];
my $to_path = $_[2];
-
+
my $in = NaElement->new("file-rename-directory");
$in->child_add_string("from-path",$from_path);
$in->child_add_string("to-path",$to_path);
-
+
my $out = $s->invoke_elem($in);
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
@@ -703,7 +703,7 @@ sub netapp_create_dir
$in->child_add_string("perm",$dir_perm);
my $out = $s->invoke_elem($in);
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
@@ -731,7 +731,7 @@ sub netapp_read_file
#my $hex_data = ascii_to_hex($ascii_data);
my $out = $s->invoke( "file-read-file","length",1048576,"offset",0,"path",$path );
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
@@ -759,7 +759,7 @@ sub netapp_write_file
my $hex_data = ascii_to_hex($ascii_data);
my $out = $s->invoke( "file-write-file","data",$hex_data,"offset",0,"overwrite",0,"path",$path );
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
@@ -803,7 +803,6 @@ sub netapp_delete_dir
}
}
-
# Start a directory iteration
my $in = NaElement->new("file-list-directory-iter-start");
$in->child_add_string("path",$dir_path);
@@ -997,7 +996,7 @@ sub netapp_delete_empty_dir
$in->child_add_string("path",$dir_path);
my $out = $s->invoke_elem($in);
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
@@ -1027,7 +1026,7 @@ sub netapp_delete_file
$in->child_add_string("path",$file_path);
my $out = $s->invoke_elem($in);
-
+
if ($out->results_status() eq "failed") {
notify($ERRORS{'CRITICAL'}, 0, $out->results_reason() ."\n");
return 0;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/one.pm Tue Dec 9 23:56:55 2014
@@ -374,7 +374,7 @@ sub capture {
# Call the OS module's pre_capture() subroutine (don't shutdown at the end)
if ($self->os->can("pre_capture")) {
- if (!$self->os->pre_capture({end_state => 'on'})) {
+ if (!$self->os->pre_capture({end_state => 'on'})) {
notify($ERRORS{'CRITICAL'}, 0, "failed to complete OS module's pre_capture tasks");
return;
} else {
@@ -884,11 +884,11 @@ sub _one_get_object_id {
if ($_->{NAME} =~ /$o_name/) {
return $_->{ID};
}
- }
+ }
} else { #HASH, found only one entry
if ($data->{VM}{NAME} =~ /$o_name/) {
return $data->{VM}{ID};
- }
+ }
}
} else {
notify($ERRORS{'CRITICAL'}, 0, $reply[0][1]);
@@ -902,7 +902,7 @@ sub _one_get_object_id {
if ( (ref($rs_data->{IMAGE})) eq "ARRAY" ) {
foreach (@{$rs_data->{IMAGE}}) {
if ($_->{NAME} eq $o_name) {
- return $_->{ID};
+ return $_->{ID};
}
}
} else { #HASH, only one entry
Modified: vcl/trunk/managementnode/lib/VCL/Module/Semaphore.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Semaphore.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Semaphore.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Semaphore.pm Tue Dec 9 23:56:55 2014
@@ -64,6 +64,8 @@ use Fcntl qw(:DEFAULT :flock);
use VCL::utils;
+no warnings 'redefine';
+
##############################################################################
=head1 CLASS VARIABLES
@@ -178,7 +180,7 @@ sub open_lockfile {
$file_handle->truncate(0);
print $file_handle "$$ $0\n";
$file_handle->setpos($file_handle->getpos());
-
+
notify($ERRORS{'DEBUG'}, 0, "wrote to file: $file_path, contents:\n '$$ $0'");
$self->{file_handles}{$file_path} = $file_handle;
Modified: vcl/trunk/managementnode/lib/VCL/blockrequest.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/blockrequest.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/blockrequest.pm Tue Dec 9 23:56:55 2014
@@ -76,10 +76,10 @@ use DBI;
sub initialize {
my $self = shift;
-
+
# Initialize the database handle count
$ENV{dbh_count} = 0;
-
+
# Attempt to get a database handle
if ($ENV{dbh} = getnewdbh()) {
notify($ERRORS{'OK'}, 0, "obtained a database handle for this state process, stored as \$ENV{dbh}");
@@ -87,13 +87,12 @@ sub initialize {
else {
notify($ERRORS{'WARNING'}, 0, "unable to obtain a database handle for this state process");
}
-
+
# Rename this process to include some request info
rename_vcld_process($self->data);
-
+
notify($ERRORS{'OK'}, 0, "returning 1");
return 1;
-
} ## end sub initialize
=pod
@@ -120,7 +119,7 @@ sub initialize {
sub process {
my $self = shift;
my ($package, $filename, $line) = caller;
-
+
# Retrieve data from the data structure
my $blockrequest_id = $self->data->get_blockrequest_id();
my $blockrequest_mode = $self->data->get_blockrequest_mode();
@@ -135,28 +134,28 @@ sub process {
my $blockrequest_owner_id = $self->data->get_blockrequest_owner_id();
my $block_group_id = $self->data->get_blockrequest_group_id();
my $block_group_name = $self->data->get_blockrequest_group_name();
-
+
# Get user info
my $user_info;
my $image_info;
- my $image_prettyname;
+ my $image_prettyname;
my $owner_affiliation_helpaddress;
my $owner_email;
-
+
if ($user_info = get_user_info($blockrequest_owner_id)) {
$owner_email = $user_info->{email};
$owner_affiliation_helpaddress = $user_info->{affiliation}{helpaddress};
}
-
+
#Get image info
if ($image_info = get_image_info($blockrequest_image_id)) {
$image_prettyname = $image_info->{prettyname};
-
+
}
#Set local timer
my $localtimer = convert_to_epoch_seconds();
-
+
notify($ERRORS{'DEBUG'}, 0, "blockrequest id: $blockrequest_id");
notify($ERRORS{'DEBUG'}, 0, "blockrequest mode: $blockrequest_mode");
notify($ERRORS{'DEBUG'}, 0, "blockrequest image id: $blockrequest_image_id");
@@ -167,14 +166,13 @@ sub process {
notify($ERRORS{'DEBUG'}, 0, "blocktime start: $blocktime_start");
notify($ERRORS{'DEBUG'}, 0, "owner email: $owner_email");
notify($ERRORS{'DEBUG'}, 0, "help address: $owner_affiliation_helpaddress");
-
+
if ($blockrequest_mode eq "start") {
-
#update processed flag for request
if (update_block_times_processing($blocktime_id, 1)) {
notify($ERRORS{'OK'}, 0, "updated process flag on blocktime_id= $blocktime_id");
}
-
+
my $completed = 0;
my $loop_control = 0;
my $xmlcall;
@@ -185,30 +183,30 @@ sub process {
if ($urla =~ /(.*)(=xmlrpccall)/) {
$blockAlloc_URL = $1 . "=blockallocations";
}
-
+
my($allocated,$unallocated) = 0;
-
+
while (!($completed)) {
if ($loop_control < 6) {
$loop_control++;
notify($ERRORS{'DEBUG'}, 0, "processing blocktime_id= $blocktime_id pass $loop_control");
$xmlcall = process_block_time($blocktime_id);
}
- else{
+ else {
$completed=1;
notify($ERRORS{'DEBUG'}, 0, "attempted $loop_control passes to complete block_request $blockrequest_id\n allocated= $allocated \nblockrequest_number_machines= $blockrequest_number_machines");
last;
}
-
+
$allocated = $xmlcall->{allocated} if (defined($xmlcall->{allocated}));
$unallocated = $xmlcall->{unallocated} if (defined($xmlcall->{unallocated}));
-
+
if ($allocated >= $blockrequest_number_machines) {
$completed=1;
notify($ERRORS{'OK'}, 0, "success blockTimes id $blocktime_id processed and allocated $xmlcall->{allocated} nodes \nstatus= $xmlcall->{status}");
last;
}
-
+
if ($xmlcall->{status} =~ /warning|fault/) {
$warningmsg = $xmlcall->{warningmsg} if (defined($xmlcall->{warningmsg}));
notify($ERRORS{'DEBUG'}, 0, "xmlrpc warning: $warningmsg allocated= $allocated unallocated= $unallocated");
@@ -221,14 +219,14 @@ sub process {
$completed=1;
notify($ERRORS{'OK'}, 0, "success blockTimes id $blocktime_id already processed");
}
-
+
sleep 5 if(!$completed);
}
my $body;
my $subject = "VCL Block allocation results for $blockrequest_name";
my $mailstring;
-
+
if (defined($warningmsg) || defined($errormsg) || ($allocated < $blockrequest_number_machines)) {
$body .= "Problem processing block allocation \n\n";
$body .= "Block id = $blockrequest_id\n";
@@ -241,13 +239,13 @@ sub process {
$body .= "xmlrpc warn msg = $warningmsg\n" if(defined($warningmsg));
$body .= "xmlrpc error msg = $errormsg\n" if(defined($errormsg));
$body .= "\n";
-
+
notify($ERRORS{'CRITICAL'}, 0, "$body");
-
+
if ($allocated < $blockrequest_number_machines) {
- $subject = "VCL Block allocation warning for $blockrequest_name";
-
- $mailstring .= << "EOF";
+ $subject = "VCL Block allocation warning for $blockrequest_name";
+
+ $mailstring .= << "EOF";
WARNING - The block allocation for $blockrequest_name was not successfully processed for the following session.
REASON: machines allocated were less than requested
@@ -267,16 +265,14 @@ If you wish to cancel this session or ma
the VCL site: $blockAlloc_URL
EOF
- if (defined($owner_email)) {
- mail($owner_email, $subject, $mailstring, $owner_affiliation_helpaddress);
- }
+
+ if (defined($owner_email)) {
+ mail($owner_email, $subject, $mailstring, $owner_affiliation_helpaddress);
+ }
}
-
-
}
elsif ($completed) {
- # Notify block request owner for given time slot has been processed.
-
+ # Notify block request owner for given time slot has been processed.
my $mailstring .= <<"EOF";
The block allocation for $blockrequest_name was processed successfully with the following results:
@@ -302,12 +298,10 @@ EOF
if (defined($owner_email)) {
mail($owner_email, $subject, $mailstring, $owner_affiliation_helpaddress);
}
-
}
-
+
sleep 10;
-
-
+
} ## end if ($blockrequest_mode eq "start")
elsif ($blockrequest_mode eq "end") {
# remove blockTime entry for this request
@@ -317,7 +311,7 @@ EOF
if (clear_block_times($blocktime_id)) {
notify($ERRORS{'OK'}, 0, "Removed blocktime_id=$blocktime_id from blockTimes table");
}
-
+
#check expire time, if this was the last blockTimes entry then this is likely the expiration time as well
my $status = check_blockrequest_time($blocktime_start, $blocktime_end, $blockrequest_expire);
if ($status eq "expire") {
@@ -327,8 +321,6 @@ EOF
notify($ERRORS{'OK'}, 0, "Updated status of blockRequest id $blockrequest_id to completed");
}
}
-
-
} ## end elsif ($blockrequest_mode eq "end") [ if ($blockrequest_mode eq "start")
elsif ($blockrequest_mode eq "expire") {
notify($ERRORS{'OK'}, 0, "Block Request $blockrequest_id has expired");
@@ -376,24 +368,24 @@ sub process_block_time {
my %info;
if ( ref($xml_ret) =~ /STRUCT/i) {
- $info{status} = $xml_ret->value->{status};
- $info{allocated} = $xml_ret->value->{allocated} if(defined($xml_ret->value->{allocated})) ;
- $info{unallocated} = $xml_ret->value->{unallocated} if(defined($xml_ret->value->{unallocated}));
- #error
- $info{errorcode} = $xml_ret->value->{errorcode} if(defined($xml_ret->value->{errorcode}));
- $info{errormsg} = $xml_ret->value->{errormsg} if(defined($xml_ret->value->{errormsg}));
- #warning
- $info{warningcode} = $xml_ret->value->{warningcode} if(defined($xml_ret->value->{warningcode}));
- $info{warningmsg} = $xml_ret->value->{warningmsg} if(defined($xml_ret->value->{warningmsg}));
- #$info{reqidlists} = $xml_ret->value->{requestids};
- }
+ $info{status} = $xml_ret->value->{status};
+ $info{allocated} = $xml_ret->value->{allocated} if(defined($xml_ret->value->{allocated})) ;
+ $info{unallocated} = $xml_ret->value->{unallocated} if(defined($xml_ret->value->{unallocated}));
+ #error
+ $info{errorcode} = $xml_ret->value->{errorcode} if(defined($xml_ret->value->{errorcode}));
+ $info{errormsg} = $xml_ret->value->{errormsg} if(defined($xml_ret->value->{errormsg}));
+ #warning
+ $info{warningcode} = $xml_ret->value->{warningcode} if(defined($xml_ret->value->{warningcode}));
+ $info{warningmsg} = $xml_ret->value->{warningmsg} if(defined($xml_ret->value->{warningmsg}));
+ #$info{reqidlists} = $xml_ret->value->{requestids};
+ }
else {
notify($ERRORS{'WARNING'}, 0, "return argument XMLRPCprocessBlockTime was not a STRUCT as expected" . ref($xml_ret) );
if (ref($xml_ret) =~ /fault/) {
$info{status} = "fault";
}
else {
- $info{status} = ref($xml_ret);
+ $info{status} = ref($xml_ret);
}
}
@@ -494,36 +486,35 @@ sub delete_block_request {
=cut
sub udpate_block_request_status {
- my ($blockrequest_id,$status) = @_;
-
- # Check the arguments
- if (!defined($blockrequest_id)) {
- notify($ERRORS{'WARNING'}, 0, "blockrequest ID was not specified");
- return 0;
- }
- if (!defined($status)) {
- notify($ERRORS{'WARNING'}, 0, "status was not specified for blockrequest_id $blockrequest_id ");
- return 0;
- }
-
- # Construct the update statement
- my $update_statement = "
- UPDATE
- blockRequest
- SET blockRequest.status = '$status'
- WHERE
- blockRequest.id = $blockrequest_id
- ";
-
- # Call the database execute subroutine
- if (database_execute($update_statement)) {
- return 1;
- }
- else {
- notify($ERRORS{'WARNING'}, 0, "unable to updated blockrequest $blockrequest_id blockRequest table ");
- return 0;
- }
-
+ my ($blockrequest_id,$status) = @_;
+
+ # Check the arguments
+ if (!defined($blockrequest_id)) {
+ notify($ERRORS{'WARNING'}, 0, "blockrequest ID was not specified");
+ return 0;
+ }
+ if (!defined($status)) {
+ notify($ERRORS{'WARNING'}, 0, "status was not specified for blockrequest_id $blockrequest_id ");
+ return 0;
+ }
+
+ # Construct the update statement
+ my $update_statement = "
+ UPDATE
+ blockRequest
+ SET blockRequest.status = '$status'
+ WHERE
+ blockRequest.id = $blockrequest_id
+ ";
+
+ # Call the database execute subroutine
+ if (database_execute($update_statement)) {
+ return 1;
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "unable to updated blockrequest $blockrequest_id blockRequest table ");
+ return 0;
+ }
}
#/////////////////////////////////////////////////////////////////////////////
Modified: vcl/trunk/managementnode/lib/VCL/healthcheck.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/healthcheck.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/healthcheck.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/healthcheck.pm Tue Dec 9 23:56:55 2014
@@ -87,7 +87,6 @@ sub new {
bless $obj_ref, $class; # bless ref to said class
$obj_ref->_initialize(); # more work to do
return $obj_ref;
-
}
#////////////////////////////////////////////////////////////////////////////////
@@ -143,16 +142,16 @@ sub process {
my ($info, $powerdownstage) = @_;
#notify($ERRORS{'OK'}, 0, "in processing routine");
$info->{"globalmsg"}->{"body"} = "Summary of VCL node monitoring system:\n\n";
-
+
my $mn_hostname = $info->{managementnode}->{hostname};
my $last_check;
-
+
if ($powerdownstage =~ /^(available|all)$/) {
notify($ERRORS{'WARNING'}, 0, "ALERT: powerdown stage triggered,placing MN $mn_hostname in maintenance");
if (set_managementnode_state($info->{managementnode}, "maintenance")) {
notify($ERRORS{'OK'}, 0, "Successfully set $mn_hostname into maintenance");
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "Failed to set $mn_hostname into maintenance");
}
}
@@ -161,70 +160,67 @@ sub process {
if (set_managementnode_state($info->{managementnode}, "available")) {
notify($ERRORS{'OK'}, 0, "Successfully set $mn_hostname into available");
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "Failed to set $mn_hostname into available");
}
}
- else{
+ else {
#proceed standard checks
}
-
-
foreach my $cid (keys %{$info->{computertable}}) {
#set some local variables
#notify($ERRORS{'OK'}, 0, " dumping data for computer id $cid\n" . format_data($info->{computertable}->{$cid}));
# Create a DataStructure object containing data for the computer specified as the argument
- my $data;
+ my $data;
my $self;
my $computer_id = $cid;
- eval {
- $data= new VCL::DataStructure({computer_identifier => $computer_id});
- };
- if ($EVAL_ERROR) {
- notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, error: $EVAL_ERROR");
- return;
- }
- elsif (!$data) {
- notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, DataStructure object is not defined");
- return;
- }
- else {
- #notify($ERRORS{'OK'}, 0, "created DataStructure object for computer ID: $computer_id\n". format_data($data->get_request_data));
- }
+ eval {
+ $data= new VCL::DataStructure({computer_identifier => $computer_id});
+ };
+ if ($EVAL_ERROR) {
+ notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, error: $EVAL_ERROR");
+ return;
+ }
+ elsif (!$data) {
+ notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, DataStructure object is not defined");
+ return;
+ }
+ else {
+ #notify($ERRORS{'OK'}, 0, "created DataStructure object for computer ID: $computer_id\n". format_data($data->get_request_data));
+ }
my $computer_state = $data->get_computer_state_name();
$last_check = $data->get_computer_lastcheck_time();
my $computer_currentimage_name = $data->get_computer_currentimage_name();
-
- #Only preform actions on available or failed computers
- #skip if is inuse, maintenance, tovmhost, etc.
- if ($computer_state !~ /available|failed/) {
-
- #notify($ERRORS{'OK'}, 0, "NODE computer_id $computer_id is in computer_state $computer_state skipping");
- $info->{computers}->{$cid}->{"skip"} = 1;
- $info->{"computersskipped"} += 1;
- next;
- }
-
- #check lastcheck timestampe
- if (defined($last_check) && $computer_state !~ /failed/) {
- my $lastcheckepoch = convert_to_epoch_seconds($last_check);
- my $currentimeepoch = convert_to_epoch_seconds();
- my $delta = ($currentimeepoch - $lastcheckepoch);
-
- my $delta_minutes = round($delta / 30);
-
- if ($delta_minutes <= (90)) {
- # notify($ERRORS{'OK'}, 0, "NODE $computer_id recently checked $delta_minutes minutes ago skipping");
+
+ #Only preform actions on available or failed computers
+ #skip if is inuse, maintenance, tovmhost, etc.
+ if ($computer_state !~ /available|failed/) {
+ #notify($ERRORS{'OK'}, 0, "NODE computer_id $computer_id is in computer_state $computer_state skipping");
+ $info->{computers}->{$cid}->{"skip"} = 1;
+ $info->{"computersskipped"} += 1;
+ next;
+ }
+
+ #check lastcheck timestampe
+ if (defined($last_check) && $computer_state !~ /failed/) {
+ my $lastcheckepoch = convert_to_epoch_seconds($last_check);
+ my $currentimeepoch = convert_to_epoch_seconds();
+ my $delta = ($currentimeepoch - $lastcheckepoch);
+
+ my $delta_minutes = round($delta / 30);
+
+ if ($delta_minutes <= (90)) {
+ # notify($ERRORS{'OK'}, 0, "NODE $computer_id recently checked $delta_minutes minutes ago skipping");
#this node was recently checked
$info->{computers}->{$cid}->{"skip"} = 1;
$info->{"computersskipped"} += 1;
next;
- }
- $info->{"computerschecked"} += 1;
- } ## end if (defined($last_check) && $computer_state !~...
-
+ }
+ $info->{"computerschecked"} += 1;
+ } ## end if (defined($last_check) && $computer_state !~...
+
my $computer_hostname = $data->get_computer_host_name();
my $computer_short_name = $1 if ($computer_hostname =~ /([-_a-zA-Z0-9]*)(\.?)/);
my $computer_type = $data->get_computer_type();
@@ -235,7 +231,7 @@ sub process {
}
#next if($computer_type eq "blade");
#next if ($computer_type eq "virtualmachine");
-
+
my %node_status;
$node_status{"ping"} = 0;
$node_status{"ssh"} = 0;
@@ -247,43 +243,43 @@ sub process {
$node_status{"rpower"} = "off";
my $datestring;
my $node_status_string = "reload";
-
+
notify($ERRORS{'OK'}, 0, "pinging node $computer_short_name ");
if (_pingnode($computer_short_name) ) {
$node_status{ping} = 1;
# Try nmap to see if any of the ssh ports are open before attempting to run a test command
my $port_22_status = nmap_port($computer_short_name, 22) ? "open" : "closed";
my $port_24_status = nmap_port($computer_short_name, 24) ? "open" : "closed";
-
+
my $port = 22;
if ($port_24_status eq "open") {
$port = 24;
}
-
+
my $ssh_user= "root";
$ssh_user = "vclstaff" if ($computer_type eq "lab");
-
+
my ($exit_status, $output) = run_ssh_command({
- node => $computer_short_name,
- command => "echo \"testing ssh on $computer_short_name\"",
- max_attempts => 2,
- output_level => 0,
- port => $port,
- user => $ssh_user,
- timeout_seconds => 30,
- });
-
+ node => $computer_short_name,
+ command => "echo \"testing ssh on $computer_short_name\"",
+ max_attempts => 2,
+ output_level => 0,
+ port => $port,
+ user => $ssh_user,
+ timeout_seconds => 30,
+ });
+
my $sshd_status = "off";
-
- # The exit status will be 0 if the command succeeded
- if (defined($output) && grep(/testing/, @$output)) {
+
+ # The exit status will be 0 if the command succeeded
+ if (defined($output) && grep(/testing/, @$output)) {
notify($ERRORS{'OK'}, 0, "ssh test: Successful");
- $sshd_status = "on";
+ $sshd_status = "on";
}
else {
notify($ERRORS{'OK'}, 0, "ssh test: failed. port 22: $port_22_status, port 24: $port_24_status");
}
-
+
if ($sshd_status eq "on") {
$node_status{"ssh"} = 1;
if ($computer_type eq "lab") {
@@ -292,43 +288,43 @@ sub process {
next;
}
my @currentimage_txt_contents = get_current_image_contents_no_data_structure($computer_short_name);
- foreach my $l (@currentimage_txt_contents) {
- #notify($ERRORS{'OK'}, 0, "NODE l=$l");
- if ( $l =~ /imagerevision_id/i ) {
- chomp($l);
- my ($b,$imagerevision_id) = split(/=/,$l);
- $node_status{imagerevision_id} = $imagerevision_id;
- $node_status_string = "post_load";
- $node_status{status} = "post_load";
- }
- if ($l =~ /vcld_post_load/ ) {
- $node_status_string = "ready";
- $node_status{status} = "ready";
- }
+ foreach my $l (@currentimage_txt_contents) {
+ #notify($ERRORS{'OK'}, 0, "NODE l=$l");
+ if ( $l =~ /imagerevision_id/i ) {
+ chomp($l);
+ my ($b,$imagerevision_id) = split(/=/,$l);
+ $node_status{imagerevision_id} = $imagerevision_id;
+ $node_status_string = "post_load";
+ $node_status{status} = "post_load";
}
-
- if ($node_status{imagerevision_id}) {
- #Get image info using imagerevision_id as identifier
- my $image_info = get_imagerevision_info($node_status{imagerevision_id},0);
- $node_status{"currentimage"} = $image_info->{imagename};
- $node_status{"current_image_id"} = $image_info->{imageid};
- $node_status{"imagerevision_id"} = $image_info->{id};
- $node_status{"vmstate"} = "on";
- $node_status{"rpower"} = "on";
+ if ($l =~ /vcld_post_load/ ) {
+ $node_status_string = "ready";
+ $node_status{status} = "ready";
}
+ }
+
+ if ($node_status{imagerevision_id}) {
+ #Get image info using imagerevision_id as identifier
+ my $image_info = get_imagerevision_info($node_status{imagerevision_id},0);
+ $node_status{"currentimage"} = $image_info->{imagename};
+ $node_status{"current_image_id"} = $image_info->{imageid};
+ $node_status{"imagerevision_id"} = $image_info->{id};
+ $node_status{"vmstate"} = "on";
+ $node_status{"rpower"} = "on";
+ }
}
-
+
}
-
+
#need to pass some of the management node info to provisioing module node_status
$info->{computertable}->{$cid}->{"managementnode"} = $info->{managementnode};
$info->{computertable}->{$cid}->{"logfile"} = $info->{logfile};
-
+
notify($ERRORS{'OK'}, 0, "hostname:$computer_hostname cid:$cid type:$computer_type state:$computer_state");
notify($ERRORS{'OK'}, 0, "$computer_hostname currentimage:$node_status{currentimage} current_image_id:$node_status{current_image_id}");
notify($ERRORS{'OK'}, 0, "$computer_hostname imagerevision_id:$node_status{imagerevision_id}");
notify($ERRORS{'OK'}, 0, "$computer_hostname vmstate:$node_status{vmstate} power:$node_status{rpower} status:$node_status{status}");
-
+
# Collect current state of node - it could have changed since we started
if (my $comp_current_state = get_computer_current_state_name($cid)) {
$info->{computertable}->{$cid}->{computer}->{state}->{name} = $comp_current_state;
@@ -338,7 +334,7 @@ sub process {
#could not get it, use existing data
notify($ERRORS{'OK'}, 0, "could not retrieve current computer state cid= $cid, using old data");
}
-
+
#check for powerdownstages
if ($powerdownstage =~ /^(available|all)$/) {
$info->{computertable}->{$cid}->{"powerdownstage"} = $powerdownstage;
@@ -351,22 +347,22 @@ sub process {
next;
}
else {
- #proceed as normal
+ #proceed as normal
}
-
+
#count the nodes processed
$info->{"computercount"} += 1;
-
+
if ($node_status_string =~ /(^ready)|(post_load)/i) {
#proceed
notify($ERRORS{'OK'}, 0, "nodestatus reports $node_status_string for $computer_hostname");
-
+
#update lastcheck datetime
$datestring = makedatestring;
if (update_computer_lastcheck($computer_id, $datestring, 0)) {
notify($ERRORS{'OK'}, 0, "updated lastcheckin for $computer_hostname");
}
-
+
#udpate state to available if old state is failed
if ($computer_state =~ /failed/i) {
if (update_computer_state($computer_id, "available", 0)) {
@@ -375,20 +371,19 @@ sub process {
}
} ## end if ($node_status_string =~ /^ready/i)
elsif ($node_status_string =~ /^reload/i) {
-
$info->{computertable}->{$cid}->{node_status} = \%node_status;
$info->{computertable}->{$cid}->{"computer_currentimage_name"} = $computer_currentimage_name;
$info->{computertable}->{$cid}->{"computer_hostname"} = $computer_hostname;
notify($ERRORS{'OK'}, 0, "nodestatus reports $node_status_string for $computer_hostname");
-
+
#additional steps
my $node_available = 0;
-
+
if ($computer_type eq "lab") {
#no additional checks required for lab type
#if (lab_investigator($info->{computertable}->{$cid})) {
- $node_available =1;
+ $node_available =1;
#}
}
elsif ($computer_type eq "virtualmachine") {
@@ -401,7 +396,7 @@ sub process {
$node_available = 1;
}
}
-
+
if ($node_available) {
#update state to available
if (update_computer_state($computer_id, "available", 0)) {
@@ -413,19 +408,18 @@ sub process {
notify($ERRORS{'OK'}, 0, "updated lastcheckin for $computer_hostname");
}
} ## end if ($node_available)
- else{
+ else {
$info->{globalmsg}->{failedbody} .= "$computer_hostname type= $computer_type offline\n";
}
-
+
} ## end elsif ($node_status_string =~ /^reload/i) [ if ($node_status_string =~ /^ready/i)
else {
notify($ERRORS{'OK'}, 0, "node_status reports unknown value for $computer_hostname node_status_string= $node_status_string ");
}
-
+
#
sleep 3;
-
- } #for loop
+ }
return 1;
} ## end sub process
@@ -518,13 +512,10 @@ sub powerdown_event {
}
return 0;
}
- else{
- notify($ERRORS{'OK'}, 0, "SKIPPING $computer_short_name computer_type= $computer_type in computer_state= $computer_state");
- return 0;
+ else {
+ notify($ERRORS{'OK'}, 0, "SKIPPING $computer_short_name computer_type= $computer_type in computer_state= $computer_state");
+ return 0;
}
-
-
-
}
#////////////////////////////////////////////////////////////////////////////////
@@ -578,8 +569,8 @@ sub _virtualmachine_investigator {
Parameters : hash
Returns : 1,0
Description : compare the input values, if no difference or success
- updated return 1, if can not update return 0
- provides additional checks for virtualmachine types
+ updated return 1, if can not update return 0
+ provides additional checks for virtualmachine types
=cut
Modified: vcl/trunk/managementnode/lib/VCL/image.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/image.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/image.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/image.pm Tue Dec 9 23:56:55 2014
@@ -775,7 +775,7 @@ sub setup_capture_base_image {
}
}
if (update_computer_state($computer_id, "available")) {
- print "Set $computer_node_name to available state\n";
+ print "Set $computer_node_name to available state\n";
}
$chosen_prettyname = $existing_requests_array_choices{$chosen_request_id}{prettyname};
print "Restarting image capture for: \nRequest id= $chosen_request_id \nImage Name: $chosen_prettyname \nNode Name: $computer_node_name\n";
@@ -987,11 +987,11 @@ EOF
if (open(COMMAND, "tail -f $LOGFILE 2>&1 |")) {
# Capture the output of the command
while (my $output = <COMMAND>) {
- if ($output =~ /$reservation_id/) {
+ if ($output =~ /$reservation_id/) {
print $output;
if ($output =~ /complete/i ) {
last;
- }
+ }
}
}
}
Modified: vcl/trunk/managementnode/lib/VCL/inuse.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/inuse.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/inuse.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/inuse.pm Tue Dec 9 23:56:55 2014
@@ -960,8 +960,8 @@ sub _start_imaging_request {
}
elsif ($xml_ret->value->{status} !~ /success/) {
notify($ERRORS{'WARNING'}, 0, "failed to start imaging request, XML::RPC '$method' status: $xml_ret->value->{status}\n" .
- "error code $xml_ret->value->{errorcode}\n" .
- "error message: $xml_ret->value->{errormsg}"
+ "error code $xml_ret->value->{errorcode}\n" .
+ "error message: $xml_ret->value->{errormsg}"
);
return;
}
Modified: vcl/trunk/managementnode/lib/VCL/new.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/new.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/new.pm Tue Dec 9 23:56:55 2014
@@ -464,7 +464,7 @@ sub reload_image {
my $image_os_install_type = $self->data->get_image_os_install_type();
my $imagerevision_id = $self->data->get_imagerevision_id();
my $server_request_id = $self->data->get_server_request_id();
- my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
+ my $server_request_fixed_ip = $self->data->get_server_request_fixed_ip();
# Try to get the node status if the provisioning engine has implemented a node_status() subroutine
my $node_status;
@@ -652,8 +652,8 @@ sub reload_image {
if ($server_request_id) {
notify($ERRORS{'DEBUG'}, 0, " SERVER_REQUEST_ID detected");
- if ($server_request_fixedIP) {
- notify($ERRORS{'DEBUG'}, 0, "server_request_fixedIP is set calling update_public_ip_address");
+ if ($server_request_fixed_ip) {
+ notify($ERRORS{'DEBUG'}, 0, "server_request_fixed_ip is set calling update_public_ip_address");
if (!$self->os->server_request_set_fixed_ip()) {
notify($ERRORS{'WARNING'}, 0, "failed to update IP address for $computer_short_name");
insertloadlog($reservation_id, $computer_id, "failed", "unable to set public IP address on $computer_short_name possibly IP address is inuse");
@@ -816,8 +816,8 @@ sub computer_not_being_used {
# -or-
# Reload reservation -- either for a different image or the previous check loop monitoring the reload process for the same image timed out
if ($competing_request_end_epoch <= $now_epoch ||
- ($competing_request_state =~ /(timeout|deleted|reload)/) ||
- ($competing_request_state eq 'pending' && $competing_request_laststate =~ /(timeout|deleted|reload)/)) {
+ ($competing_request_state =~ /(timeout|deleted|reload)/) ||
+ ($competing_request_state eq 'pending' && $competing_request_laststate =~ /(timeout|deleted|reload)/)) {
# Update the competing request state to complete
# If this fails, check if the competing request has already been deleted
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1644246&r1=1644245&r2=1644246&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Tue Dec 9 23:56:55 2014
@@ -363,12 +363,12 @@ INIT {
# Store the command line options in hash
our %OPTIONS;
GetOptions(\%OPTIONS,
- 'config=s' => \$CONF_FILE_PATH,
- 'daemon!' => \$DAEMON_MODE,
- 'logfile=s' => \$LOGFILE,
- 'help' => \&help,
- 'setup!' => \$SETUP_MODE,
- 'verbose!' => \$VERBOSE,
+ 'config=s' => \$CONF_FILE_PATH,
+ 'daemon!' => \$DAEMON_MODE,
+ 'logfile=s' => \$LOGFILE,
+ 'help' => \&help,
+ 'setup!' => \$SETUP_MODE,
+ 'verbose!' => \$VERBOSE,
);
my %parameters = (
@@ -1229,11 +1229,7 @@ sub mail {
if ($shared_mail_box) {
my $bcc = $shared_mail_box;
- if ($mailer->open({From => $from,
- To => $to,
- Bcc => $bcc,
- Subject => $subject,}))
- {
+ if ($mailer->open({From => $from, To => $to, Bcc => $bcc, Subject => $subject})) {
print $mailer $mailstring;
$mailer->close();
notify($ERRORS{'OK'}, 0, "SUCCESS -- Sending mail To: $to, $subject");
@@ -1243,9 +1239,7 @@ sub mail {
}
} ## end if ($shared_mail_box)
else {
- if ($mailer->open({From => $from,
- To => $to,
- Subject => $subject,}))
+ if ($mailer->open({From => $from, To => $to, Subject => $subject,}))
{
print $mailer $mailstring;
$mailer->close();
@@ -2125,7 +2119,7 @@ sub check_ssh {
notify($ERRORS{'OK'}, $log, " $node ssh port $port open");
return 1;
}
- else{
+ else {
notify($ERRORS{'OK'}, $log, " $node ssh port $port closed");
return 0;
}
@@ -3226,7 +3220,7 @@ sub set_managementnode_state {
# Construct the update statement
my $update_statement = "
- UPDATE
+ UPDATE
managementnode,
state
SET
@@ -3234,7 +3228,7 @@ sub set_managementnode_state {
WHERE
state.name = '$state' AND
managementnode.id = '$mn_ID'
- ";
+ ";
# Call the database execute subroutine
@@ -3552,7 +3546,7 @@ EOF
if ($imagerevision_identifier =~ /^\d/) {
$select_statement .= "imagerevision.id = '$imagerevision_identifier'";
}
- else{
+ else {
$select_statement .= "imagerevision.imagename = \'$imagerevision_identifier\'";
}
@@ -4696,7 +4690,7 @@ sub update_computer_imagename {
if ( $imagerevision_info = get_imagerevision_info($imagename)) {
notify($ERRORS{'DEBUG'}, 0, "successfully retreived image info for $imagename");
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "failed to get_imagerevision_info for $imagename");
return 0;
}
@@ -4708,7 +4702,7 @@ sub update_computer_imagename {
notify($ERRORS{'DEBUG'}, 0, "successfully updated computerid= $computerid image_id= $image_id imagerevision_id= $imagerevision_id");
return 1;
}
- else{
+ else {
notify($ERRORS{'WARNING'}, 0, "failed to update_currentimage imagename= $imagename computerid= $computerid");
return 0;
}
@@ -4750,14 +4744,14 @@ sub update_currentimage {
# Construct the update statement
# If $nextimageid defined and set build slightly different statement
my $update_statement = "
- UPDATE
+ UPDATE
computer c, image i
SET
c.currentimageid = $imageid,
- c.imagerevisionid= $imagerevisionid
+ c.imagerevisionid= $imagerevisionid
WHERE
c.id = $computerid
- ";
+ ";
if (defined($nextimagid) && ($nextimagid)) {
notify($ERRORS{'WARNING'}, 0, "*******NEXTIMAGE updating computer $computerid: image=$imageid, imagerevision=$imagerevisionid nextimageid = $imageid");
@@ -4808,12 +4802,12 @@ sub is_inblockrequest {
}
# Construct the select statement
my $select_statement = "
- SELECT
- b.blockRequestid,c.blockTimeid
- FROM blockTimes b, blockComputers c
- WHERE
- c.blockTimeid=b.id AND c.computerid = $computerid
- ";
+ SELECT
+ b.blockRequestid,c.blockTimeid
+ FROM blockTimes b, blockComputers c
+ WHERE
+ c.blockTimeid=b.id AND c.computerid = $computerid
+ ";
# Call the database select subroutine
# This will return an array of one or more rows based on the select statement
@@ -6409,7 +6403,7 @@ sub get_computers_controlled_by_mn {
if ($info{"manageable_computer_grps"}{$id}{"members"} = get_computer_grp_members($computer_group_id) ) {
notify($ERRORS{'DEBUG'}, $LOGFILE, "retrieved computers from computer groupname= $info{manageable_resoucegroups}{$grp_id}{$id}{groupname}");
}
- else{
+ else {
notify($ERRORS{'DEBUG'}, $LOGFILE, "no computers in computer groupid= $computer_group_id}");
delete $info{manageable_resoucegroups}{$grp_id}{$id};
}
@@ -6426,11 +6420,11 @@ sub get_computers_controlled_by_mn {
foreach my $computergroup (keys %{ $info{manageable_computer_grps}}) {
foreach my $computerid (keys %{ $info{manageable_computer_grps}{$computergroup}{members} }) {
- if ( !(exists $computer_list{$computerid}) ) {
- # add to return list
- $computer_list{$computerid}{"computer_id"}=$computerid;
- }
+ if ( !(exists $computer_list{$computerid}) ) {
+ # add to return list
+ $computer_list{$computerid}{"computer_id"}=$computerid;
}
+ }
}
return \%computer_list;
@@ -6709,7 +6703,7 @@ EOF
(my $original_key = $key) =~ s/^.+_//;
if ($key =~ /^(.+)_/) {
- $user_info->{$1}{$original_key} = $value;
+ $user_info->{$1}{$original_key} = $value;
}
else {
$user_info->{$original_key} = $value;
@@ -6766,7 +6760,7 @@ EOF
# If usepublickeys =0 && sshpublickeys is defined, disable public keys by setting sshpublickeys=0
if (!$user_info->{usepublickeys} && defined($user_info->{sshpublickeys})) {
- $user_info->{sshpublickeys} = 0;
+ $user_info->{sshpublickeys} = 0;
}
# For test account only
@@ -7007,7 +7001,7 @@ EOF
$computer_info->{provisioning}{$table}{$column} = $value;
}
elsif ($table eq 'predictivemodule' ) {
- $computer_info->{predictive}{module}{$column} = $value;
+ $computer_info->{predictive}{module}{$column} = $value;
}
else {
$computer_info->{$table}{$column} = $value;
@@ -7093,27 +7087,27 @@ EOF
Returns : hash reference
Description : Retrieves nathost info if a nathost is mapped to the computer via
the nathostcomputermap table. Example:
- {
- "HOSTNAME" => "nat1.vcl.org",
- "datedeleted" => undef,
- "deleted" => 0,
- "id" => 2,
- "natIP" => "x.x.x.x",
- "nathostcomputermap" => {
- "computerid" => 3591,
- "nathostid" => 2
- },
- "resource" => {
- "id" => 6185,
- "resourcetype" => {
- "id" => 16,
- "name" => "managementnode"
- },
- "resourcetypeid" => 16,
- "subid" => 8
- },
- "resourceid" => 6185
- }
+ {
+ "HOSTNAME" => "nat1.vcl.org",
+ "datedeleted" => undef,
+ "deleted" => 0,
+ "id" => 2,
+ "natIP" => "x.x.x.x",
+ "nathostcomputermap" => {
+ "computerid" => 3591,
+ "nathostid" => 2
+ },
+ "resource" => {
+ "id" => 6185,
+ "resourcetype" => {
+ "id" => 16,
+ "name" => "managementnode"
+ },
+ "resourcetypeid" => 16,
+ "subid" => 8
+ },
+ "resourceid" => 6185
+ }
=cut
@@ -8533,7 +8527,7 @@ sub add_imageid_to_newimages {
return 0;
}
else {
- return 1;
+ return 1;
}
}
@@ -8578,8 +8572,8 @@ sub xmlrpc_call {
if (defined($client)) {
notify($ERRORS{'DEBUG'}, 0, "created RPC::XML client object:\n" .
- "URL: $XMLRPC_URL\n" .
- "username: $XMLRPC_USER"
+ "URL: $XMLRPC_URL\n" .
+ "username: $XMLRPC_USER"
);
}
else {
@@ -8889,8 +8883,8 @@ sub is_public_ip_address {
# 172.16.0.0 - 172.16.31.255.255
# 192.168.0.0 - 192.168.255.255
if (($octets[0] == 10) ||
- ($octets[0] == 172 && ($octets[1] >= 16 && $octets[1] <= 31)) ||
- ($octets[0] == 192 && $octets[1] == 168)
+ ($octets[0] == 172 && ($octets[1] >= 16 && $octets[1] <= 31)) ||
+ ($octets[0] == 192 && $octets[1] == 168)
) {
notify($ERRORS{'DEBUG'}, 0, "private IP address: $ip_address, returning 0");
return 0;
@@ -8908,11 +8902,11 @@ sub is_public_ip_address {
# 223.255.255.0
# 240.0.0.0 - 255.255.255.254
elsif (($ip_address eq '0.0.0.0') ||
- ($ip_address =~ /^169\.254/) ||
- ($ip_address eq '191.255.0.0') ||
- ($ip_address eq '223.255.255.0') ||
- ($octets[0] >= 240 && $octets[0] <= 255)
- ) {
+ ($ip_address =~ /^169\.254/) ||
+ ($ip_address eq '191.255.0.0') ||
+ ($ip_address eq '223.255.255.0') ||
+ ($octets[0] >= 240 && $octets[0] <= 255)
+ ) {
notify($ERRORS{'DEBUG'}, 0, "reserved IP address: $ip_address, returning 0");
return 0;
}
@@ -10011,7 +10005,7 @@ EOF
(my $original_key = $key) =~ s/^.+_//;
if ($key =~ /module_/) {
- $info{$os_id}{module}{$original_key} = $value;
+ $info{$os_id}{module}{$original_key} = $value;
}
else {
$info{$os_id}{$original_key} = $value;
@@ -10091,51 +10085,50 @@ sub kill_child_processes {
Returns : hash reference
Description : Returns the connect methods for the image revision specified as
the argument. Example:
- {
- 4 => {
- "RETRIEVAL_TIME" => "1417709281",
- "connectmethodmap" => {
- "OSid" => 36,
- "OStypeid" => undef,
- "autoprovisioned" => undef,
- "connectmethodid" => 4,
- "disabled" => 0,
- "imagerevisionid" => undef
- },
- "connectmethodport" => {
- 35 => {
- "connectmethodid" => 4,
- "id" => 35,
- "natport" => {
- "connectmethodportid" => 35,
- "nathostid" => 2,
- "publicport" => 56305,
- "reservationid" => 3115
- },
- "port" => 3389,
- "protocol" => "TCP"
- },
- 37 => {
- "connectmethodid" => 4,
- "id" => 37,
- "natport" => {
- "connectmethodportid" => 37,
- "nathostid" => 2,
- "publicport" => 63058,
- "reservationid" => 3115
- },
- "port" => 3389,
- "protocol" => "UDP"
- }
- },
- "description" => "Linux xRDP (Remote Desktop Protocol)",
- "id" => 4,
- "name" => "xRDP",
- "servicename" => "xrdp",
- "startupscript" => undef
- }
- }
-
+ {
+ 4 => {
+ "RETRIEVAL_TIME" => "1417709281",
+ "connectmethodmap" => {
+ "OSid" => 36,
+ "OStypeid" => undef,
+ "autoprovisioned" => undef,
+ "connectmethodid" => 4,
+ "disabled" => 0,
+ "imagerevisionid" => undef
+ },
+ "connectmethodport" => {
+ 35 => {
+ "connectmethodid" => 4,
+ "id" => 35,
+ "natport" => {
+ "connectmethodportid" => 35,
+ "nathostid" => 2,
+ "publicport" => 56305,
+ "reservationid" => 3115
+ },
+ "port" => 3389,
+ "protocol" => "TCP"
+ },
+ 37 => {
+ "connectmethodid" => 4,
+ "id" => 37,
+ "natport" => {
+ "connectmethodportid" => 37,
+ "nathostid" => 2,
+ "publicport" => 63058,
+ "reservationid" => 3115
+ },
+ "port" => 3389,
+ "protocol" => "UDP"
+ }
+ },
+ "description" => "Linux xRDP (Remote Desktop Protocol)",
+ "id" => 4,
+ "name" => "xRDP",
+ "servicename" => "xrdp",
+ "startupscript" => undef
+ }
+ }
=cut