You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2010/08/06 20:10:38 UTC

svn commit: r983079 - in /incubator/vcl/trunk/web/.ht-inc: images.php requests.php utils.php

Author: jfthomps
Date: Fri Aug  6 18:10:38 2010
New Revision: 983079

URL: http://svn.apache.org/viewvc?rev=983079&view=rev
Log:
VCL-254
block allocation improvements

utils.php: added isImageBlockTimeActive

images.php: modified getRevisionHTML to print warning message above list of revisions about changing the production revison if > 1 revision and there is an active block allocation

requests.php: modified confirmDeleteRequestProduction to print warning mesage about changing the production version if there is an active block allocation

Modified:
    incubator/vcl/trunk/web/.ht-inc/images.php
    incubator/vcl/trunk/web/.ht-inc/requests.php
    incubator/vcl/trunk/web/.ht-inc/utils.php

Modified: incubator/vcl/trunk/web/.ht-inc/images.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/images.php?rev=983079&r1=983078&r2=983079&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/images.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/images.php Fri Aug  6 18:10:38 2010
@@ -1046,9 +1046,17 @@ function editOrAddImage($state) {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getRevisionHTML($imageid) {
+	$revisions = getImageRevisions($imageid);
 	$rt = '';
 	$rt .= "<h3>Revisions of this Image</h3>\n";
 	$rt .= "<table summary=\"\"><tr><td>\n";
+	if(count($revisions) > 1 && isImageBlockTimeActive($imageid)) {
+		$rt .= "<font color=\"red\">WARNING: This image is part of an active ";
+		$rt .= "block allocation. Changing the production revision of the image ";
+		$rt .= "at this time will result in new reservations under the block ";
+		$rt .= "allocation to have full reload times instead of a &lt; 1 minutes ";
+		$rt .= "wait.</font><br><br>\n";
+	}
 	$rt .= "<table summary=\"\" id=\"revisiontable\">\n";
 	$rt .= "  <tr>\n";
 	$rt .= "    <td></td>\n";
@@ -1058,7 +1066,6 @@ function getRevisionHTML($imageid) {
 	$rt .= "    <th nowrap>In Production</th>\n";
 	$rt .= "    <th>Comments (click to edit)</th>\n";
 	$rt .= "  </tr>\n";
-	$revisions = getImageRevisions($imageid);
 	foreach($revisions AS $rev) {
 		$rt .= "  <tr>\n";
 		$rt .= "    <td><INPUT type=checkbox\n";

Modified: incubator/vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/requests.php?rev=983079&r1=983078&r2=983079&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/requests.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/requests.php Fri Aug  6 18:10:38 2010
@@ -1927,6 +1927,17 @@ function confirmDeleteRequestProduction(
 	print	"Are you satisfied that this environment is ready to be made production ";
 	print "and replace the current production version, or would you just like to ";
 	print "end this reservation and test it again later?\n";
+
+	if(isImageBlockTimeActive($request['reservations'][0]['imageid'])) {
+		print "<br><br><font color=\"red\">WARNING: This environment is part of ";
+		print "an active block allocation. Changing the production version of ";
+		print "the environment at this time will result in new reservations ";
+		print "under the block allocation to have full reload times instead of ";
+		print "a &lt; 1 minutes wait. You can change the production version ";
+		print "later by going to Manage Images-&gt;Edit Image Profiles and ";
+		print "clicking Edit for this environment.</font><br>\n";
+	}
+
 	print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
 
 	$cont = addContinuationsEntry('setImageProduction', $cdata, SECINDAY, 0, 1);

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=983079&r1=983078&r2=983079&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Fri Aug  6 18:10:38 2010
@@ -6369,6 +6369,35 @@ function isBlockAllocationTime($compid, 
 
 ////////////////////////////////////////////////////////////////////////////////
 ///
+/// \fn isImageBlockTimeActive($imageid)
+///
+/// \param $imageid - id of an image
+///
+/// \return 1 if a block time for a block allocation for $imageid has had the
+/// processed flag set and the end time has not been reached; 0 otherwise
+///
+/// \brief checks to see if a block time for $imageid has been processed but not
+/// yet ended
+///
+////////////////////////////////////////////////////////////////////////////////
+function isImageBlockTimeActive($imageid) {
+	$now = time();
+	$nowdt = unixToDatetime($now);
+	$query = "SELECT bt.id "
+	       . "FROM blockTimes bt, "
+	       .      "blockRequest br "
+	       . "WHERE bt.blockRequestid = br.id AND "
+	       .       "bt.processed = 1 AND "
+	       .       "bt.end > '$nowdt' AND "
+	       .       "br.imageid = $imageid";
+	$qh = doQuery($query, 101);
+	if($row = mysql_fetch_assoc($qh))
+		return 1;
+	return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+///
 /// \fn printSelectInput($name, $dataArr, $selectedid, $skip, $multiple, $domid,
 ///                      $extra)
 ///