svn commit: r986327 - /incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
Author: arkurth Date: Tue Aug 17 14:33:09 2010 New Revision: 986327 URL: http://svn.apache.org/viewvc?rev=986327view=rev Log: VCL-371 Updated DataStructure.pm::get_computer_private_ip_address() to correctly locate lines in /etc/hosts when there is no character after the host name. Also updated subroutine to return the IP address if multiple matching lines are found containing the same address. Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=986327r1=986326r2=986327view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Tue Aug 17 14:33:09 2010 @@ -1547,44 +1547,47 @@ sub get_computer_private_ip_address { } # Find lines containing the computer name followed by a space or period - my @matching_computer_hosts_lines = grep(/\s$computer_name[\s\.]/i, @$output); + my %matching_computer_ip_addresses; - # Extract matching lines which aren't commented out - my @uncommented_computer_hosts_lines = grep(/^\s*[^#]/, @matching_computer_hosts_lines); + for my $line (@$output) { + # Ignore commented lines + next if ($line =~ /^\s*#/); + + # Ignore lines which don't contain the computer name + next if ($line !~ /$computer_name($|\.|\s)/i); + + # Extract the IP address from the matching line + my ($ip_address) = $line =~ /\s*((?:[0-9]{1,3}\.?){4})\s/i; + if (!$ip_address) { + notify($ERRORS{'WARNING'}, 0, unable to extract IP address from line: $line); + next; + } + + # Add the IP address and line to the hash + $matching_computer_ip_addresses{$ip_address} = $line; + } + + # Check the hash, it should contain 1 key # Make sure 1 uncommented line was found - if (@matching_computer_hosts_lines == 0) { + my $found_count = scalar keys %matching_computer_ip_addresses; + if ($found_count == 0) { notify($ERRORS{'WARNING'}, 0, did not find any lines in /etc/hosts containing '$computer_name'); return; } - elsif (@uncommented_computer_hosts_lines == 0) { - notify($ERRORS{'WARNING'}, 0, did not find any uncommented lines in /etc/hosts containing '$computer_name':\n . join(\n, @matching_computer_hosts_lines)); - return; - } - elsif (@uncommented_computer_hosts_lines 1) { - notify($ERRORS{'WARNING'}, 0, found multiple uncommented lines in /etc/hosts containing '$computer_name':\n . join(\n, @matching_computer_hosts_lines)); - return; - } - - my $matching_computer_hosts_line = $matching_computer_hosts_lines[0]; - notify($ERRORS{'DEBUG'}, 0, found line for '$computer_name' in /etc/hosts:\n$matching_computer_hosts_line); - - # Extract the IP address from the matching line - my ($ip_address) = $matching_computer_hosts_line =~ /\s*((?:[0-9]{1,3}\.?){4})\s+$computer_name/i; - - # Check if IP address was found - if (!$ip_address) { - notify($ERRORS{'WARNING'}, 0, unable to determine IP address from line:\n$matching_computer_hosts_line); + elsif ($found_count 1) { + notify($ERRORS{'WARNING'}, 0, found multiple lines in /etc/hosts containing '$computer_name' with different IP addresses:\n . join(\n, values(%matching_computer_ip_addresses))); return; } - notify($ERRORS{'DEBUG'}, 0, found IP address: $ip_address); + my $ip_address = (keys %matching_computer_ip_addresses)[0]; # Update the request data if subroutine was called as an object method without an argument if ($self !$argument) { $self-request_data-{reservation}{$self-reservation_id}{computer}{PRIVATE_IP_ADDRESS_ETC_HOSTS} = $ip_address; } + notify($ERRORS{'DEBUG'}, 0, returning IP address from /etc/hosts file: $ip_address); return $ip_address; }
svn commit: r986358 - /incubator/vcl/trunk/mysql/vcl.sql
Author: arkurth Date: Tue Aug 17 15:27:27 2010 New Revision: 986358 URL: http://svn.apache.org/viewvc?rev=986358view=rev Log: VCL-254 Updated vcl.sql: -Added blockComputers.reloadrequestid, blockRequest.status, blockTimes.skip VCL-298 Updated vcl.sql: -Changed vmhost.vmprofileid to smallint(5) so that it matches vmprofile.id. Added a contstraint. -Changed vmprofile.nasshare to vmprofile.repositorypath -Added entry to module and provisioning tables for the new VMware module, called it vSphere -Updated default vmprofile rows to include VMware Server 2.x and additional examples for ESX Other: -Added entry to OS for vmwarewin2003 -Set computer table's default currentimageid, nextimageid, and imagerevisionid to 4 (No Image) Modified: incubator/vcl/trunk/mysql/vcl.sql Modified: incubator/vcl/trunk/mysql/vcl.sql URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/mysql/vcl.sql?rev=986358r1=986357r2=986358view=diff == --- incubator/vcl/trunk/mysql/vcl.sql (original) +++ incubator/vcl/trunk/mysql/vcl.sql Tue Aug 17 15:27:27 2010 @@ -61,6 +61,7 @@ CREATE TABLE IF NOT EXISTS `blockCompute `blockTimeid` mediumint(8) unsigned NOT NULL default '0', `computerid` smallint(5) unsigned NOT NULL default '0', `imageid` smallint(5) unsigned NOT NULL default '0', + `reloadrequestid` mediumint(8) unsigned NOT NULL default '0', PRIMARY KEY (`blockTimeid`,`computerid`), KEY `computerid` (`computerid`), KEY `imageid` (`imageid`) @@ -84,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `blockRequest `managementnodeid` smallint(5) unsigned NOT NULL, `expireTime` datetime NOT NULL, `processing` tinyint(1) unsigned NOT NULL, + `status` enum('requested','accepted','completed','rejected','deleted') NOT NULL DEFAULT 'accepted', PRIMARY KEY (`id`), KEY `imageid` (`imageid`), KEY `groupid` (`groupid`), @@ -102,6 +104,7 @@ CREATE TABLE IF NOT EXISTS `blockTimes` `start` datetime NOT NULL, `end` datetime NOT NULL, `processed` tinyint(1) unsigned NOT NULL default '0', + `skip` tinyint(1) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `start` (`start`), KEY `end` (`end`), @@ -189,9 +192,9 @@ CREATE TABLE IF NOT EXISTS `computer` ( `ownerid` mediumint(8) unsigned default '1', `platformid` tinyint(3) unsigned NOT NULL default '0', `scheduleid` tinyint(3) unsigned default NULL, - `currentimageid` smallint(5) unsigned NOT NULL default '0', - `nextimageid` smallint(5) unsigned NOT NULL default '0', - `imagerevisionid` mediumint(8) unsigned NOT NULL default '0', + `currentimageid` smallint(5) unsigned NOT NULL default '4', + `nextimageid` smallint(5) unsigned NOT NULL default '4', + `imagerevisionid` mediumint(8) unsigned NOT NULL default '4', `RAM` smallint(5) unsigned NOT NULL default '0', `procnumber` tinyint(5) unsigned NOT NULL default '1', `procspeed` smallint(5) unsigned NOT NULL default '0', @@ -230,7 +233,8 @@ CREATE TABLE IF NOT EXISTS `computer` ( KEY `vmtypeid` (`vmtypeid`), KEY `deleted` (`deleted`), KEY `nextimageid` (`nextimageid`), - KEY `provisioningid` (`provisioningid`) + KEY `provisioningid` (`provisioningid`), + KEY `imagerevisionid` (`imagerevisionid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- @@ -993,11 +997,12 @@ CREATE TABLE IF NOT EXISTS `vmhost` ( `id` smallint(5) unsigned NOT NULL auto_increment, `computerid` smallint(5) unsigned NOT NULL, `vmlimit` tinyint(3) unsigned NOT NULL, - `vmprofileid` tinyint(5) unsigned NOT NULL default '1', + `vmprofileid` smallint(5) unsigned NOT NULL, `vmkernalnic` varchar(15) default NULL, `vmwaredisk` enum('localdisk','networkdisk') NOT NULL default 'localdisk', PRIMARY KEY (`id`), - UNIQUE KEY `computerid` (`computerid`) + UNIQUE KEY `computerid` (`computerid`), + KEY `vmprofileid` (`vmprofileid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- @@ -1011,7 +1016,7 @@ CREATE TABLE IF NOT EXISTS `vmprofile` ( `profilename` varchar(56) NOT NULL, `vmtypeid` tinyint(3) unsigned NOT NULL, `imageid` smallint(5) unsigned NOT NULL, - `nasshare` varchar(128) default NULL, + `repositorypath` varchar(128) default NULL, `datastorepath` varchar(128) NOT NULL, `vmpath` varchar(128) default NULL, `virtualswitch0` varchar(80) NOT NULL default 'VMnet0', @@ -1272,8 +1277,9 @@ INSERT INTO `module` (`id`, `name`, `pre (14, 'os_linux_ubuntu', 'Ubuntu Linux OS Module', '', 'VCL::Module::OS::Linux::Ubuntu'), (15, 'os_unix_lab', 'Unix Lab Module', 'Unix Lab OS support module', 'VCL::Module::OS::Linux::UnixLab'), (16, 'os_win2008', 'Windows Server 2008 OS Module', '', 'VCL::Module::OS::Windows::Version_6::2008'), -(17, 'os_win7', 'Windows 7 OS Module', '', 'VCL::Module::OS::Windows::Version_7::7'), -(20, 'provisioning_xCAT_2x', 'xCAT 2x provisioning module', '',
svn commit: r986367 - /incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Author: fapeeler Date: Tue Aug 17 15:58:06 2010 New Revision: 986367 URL: http://svn.apache.org/viewvc?rev=986367view=rev Log: VCL-254 extended query to handle expire times that don't match the blockTimes.end time Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=986367r1=986366r2=986367view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Tue Aug 17 15:58:06 2010 @@ -7602,7 +7602,46 @@ sub get_management_node_blockrequests { # Check to make sure 1 or more rows were returned if (scalar @selected_rows == 0) { - return 0; + #Lets check to see if we have blockRequests that have expired and don't have any time ids + $select_statement = + SELECT + blockRequest.id AS blockRequest_id, + blockRequest.name AS blockRequest_name, + blockRequest.imageid AS blockRequest_imageid, + blockRequest.numMachines AS blockRequest_numMachines, + blockRequest.groupid AS blockRequest_groupid, + blockRequest.repeating AS blockRequest_repeating, + blockRequest.ownerid AS blockRequest_ownerid, + blockRequest.admingroupid AS blockRequest_admingroupid, + blockRequest.managementnodeid AS blockRequest_managementnodeid, + blockRequest.expireTime AS blockRequest_expireTime, + blockRequest.processing AS blockRequest_processing, + blockRequest.status AS blockRequest_status, + + blockTimes.id AS blockTimes_id, + blockTimes.blockRequestid AS blockTimes_blockRequestid, + blockTimes.start AS blockTimes_start, + blockTimes.end AS blockTimes_end, + blockTimes.processed AS blockTimes_processed + + FROM + blockRequest + LEFT JOIN + blockTimes ON ( +blockRequest.id = blockTimes.blockRequestid + ) + + WHERE + blockRequest.managementnodeid = $managementnode_id AND + blockRequest.status = 'accepted' AND + blockRequest.expireTime NOW() + ; + + @selected_rows = database_select($select_statement); + + if (scalar @selected_rows == 0) { + return 0; + } } # Build the hash
svn commit: r986371 - /incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm
Author: fapeeler Date: Tue Aug 17 16:18:25 2010 New Revision: 986371 URL: http://svn.apache.org/viewvc?rev=986371view=rev Log: VCL-254 Modified: incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm Modified: incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm?rev=986371r1=986370r2=986371view=diff == --- incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm Tue Aug 17 16:18:25 2010 @@ -263,10 +263,6 @@ EOF sleep 10; - if (update_blockrequest_processing($blockrequest_id, 0)) { - notify($ERRORS{'OK'}, 0, Removed processing flag on blockrequest_id $blockrequest_id); - } - } ## end if ($blockrequest_mode eq start) elsif ($blockrequest_mode eq end) { @@ -286,26 +282,26 @@ EOF if(udpate_block_request_status($blockrequest_id,completed)){ notify($ERRORS{'OK'}, 0, Updated status of blockRequest id $blockrequest_id to completed); } - return 1; } - ##remove processing flag - if (update_blockrequest_processing($blockrequest_id, 0)) { - notify($ERRORS{'OK'}, 0, Removed processing flag on blockrequest_id $blockrequest_id); - } } ## 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); - if (delete_block_request($blockrequest_id)) { - notify($ERRORS{'OK'}, 0, Removed blockRequest id $blockrequest_id); + if(udpate_block_request_status($blockrequest_id,completed)){ + notify($ERRORS{'OK'}, 0, Updated status of blockRequest id $blockrequest_id to completed); } - return 1; } else { #should not of hit this notify($ERRORS{'CRITICAL'}, 0, mode not determined mode= $blockrequest_mode); } + + ##remove processing flag + if (update_blockrequest_processing($blockrequest_id, 0)) { + notify($ERRORS{'OK'}, 0, Removed processing flag on blockrequest_id $blockrequest_id); + } + return 1; } ## end sub process @@ -470,7 +466,7 @@ sub udpate_block_request_status { my $update_statement = UPDATE blockRequest - SET blockRequest.status = $status + SET blockRequest.status = '$status' WHERE blockRequest.id = $blockrequest_id ;