Author: jfthomps
Date: Wed Nov 10 19:15:21 2010
New Revision: 1033650

URL: http://svn.apache.org/viewvc?rev=1033650&view=rev
Log:
modified addSublogEntry - added code to save a vm's hostcomputerid in the 
sublog table; this allows us to track which host computers were in use at a 
given time

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

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=1033650&r1=1033649&r2=1033650&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Wed Nov 10 19:15:21 2010
@@ -7257,20 +7257,33 @@ function addSublogEntry($logid, $imageid
        $qh = doQuery($query, 101);
        $row = mysql_fetch_assoc($qh);
        $predictiveid = $row['predictivemoduleid'];
+       $query = "SELECT c.type, "
+              .        "v.computerid AS hostid "
+              . "FROM computer c "
+              . "LEFT JOIN vmhost v ON (c.vmhostid = v.id) "
+              . "WHERE c.id = $computerid";
+       $qh = doQuery($query, 101);
+       $row = mysql_fetch_assoc($qh);
+       if($row['type'] == 'virtualmachine')
+               $hostcomputerid = $row['hostid'];
+       else
+               $hostcomputerid = 'NULL';
        $query = "INSERT INTO sublog "
               .        "(logid, "
               .        "imageid, "
               .        "imagerevisionid, "
               .        "computerid, "
               .        "managementnodeid, "
-              .        "predictivemoduleid) "
+              .        "predictivemoduleid, "
+              .        "hostcomputerid) "
               . "VALUES "
               .        "($logid, "
               .        "$imageid, "
               .        "$imagerevisionid, "
               .        "$computerid, "
               .        "$mgmtnodeid, "
-              .        "$predictiveid)";
+              .        "$predictiveid, "
+              .        "$hostcomputerid)";
        doQuery($query, 101);
 }
 


Reply via email to