You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by om...@apache.org on 2012/05/11 18:01:02 UTC
svn commit: r1337230 - in /incubator/ambari/branches/ambari-186: ./
hmc/php/db/ hmc/php/frontend/ hmc/php/puppet/ hmc/php/util/
Author: omalley
Date: Fri May 11 16:01:01 2012
New Revision: 1337230
URL: http://svn.apache.org/viewvc?rev=1337230&view=rev
Log:
AMBARI-209. Node selection should ignore failed nodes. (hitesh via omalley)
Modified:
incubator/ambari/branches/ambari-186/CHANGES.txt
incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php
incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php
incubator/ambari/branches/ambari-186/hmc/php/frontend/deployAddedNodes.php
incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php
incubator/ambari/branches/ambari-186/hmc/php/puppet/DBReader.php
incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php
incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php
incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php
Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Fri May 11 16:01:01 2012
@@ -2,6 +2,8 @@ Ambari Change log
Release 0.x.x - unreleased
+ AMBARI-209. Node selection should ignore failed nodes. (hitesh via omalley)
+
AMBARI-213. Fix directory permissions so that Ganglia graphs render.
(ramya via omalley)
Modified: incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/db/OrchestratorDB.php Fri May 11 16:01:01 2012
@@ -448,7 +448,7 @@ class OrchestratorDB {
*/
public function getAllNodes() {
$result = $this->db->getAllHostsInfo($this->clusterName,
- array(), array());
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), array());
if ($result === FALSE || $result["result"] != 0
|| !isset($result["hosts"]) || !is_array($result["hosts"])) {
$this->logger->log_error("Failed to get host list from DB");
Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/deploy.php Fri May 11 16:01:01 2012
@@ -34,14 +34,6 @@ $thisHostName = trim(strtolower(exec('ho
$nagiosGangliaCoHosted = FALSE;
$dbAccessor = new HMCDBAccessor($dbPath);
-// check if single node install
-$hostsInfo = $dbAccessor->getAllHostsInfo($clusterName);
-if (isset($hostsInfo["hosts"])
- && is_array($hostsInfo["hosts"]) && count($hostsInfo["hosts"] == 1)) {
- $nagiosGangliaCoHosted = TRUE;
-}
-
-// if not single node
// check if nagios hosted on same server
if (!$nagiosGangliaCoHosted) {
// check if component mapped to this host
Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/deployAddedNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/deployAddedNodes.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/deployAddedNodes.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/deployAddedNodes.php Fri May 11 16:01:01 2012
@@ -55,23 +55,6 @@ $goodHosts = convertToLowerCase($goodHos
$logger->log_debug("goodHosts: ".json_encode($goodHosts));
-/*
-////// Get info about all nodes from db ////
-$allHostsInfo = $dbHandle->getAllHostsInfo($clusterName, "", "");
-if ($allHostsInfo["result"] != 0 ) {
- $logger->log_error("Got error while getting allHostsInfo :" .$allHostsInfo["error"]);
- print json_encode($allHostsInfo);
- return false;
-}
-
-$goodHosts = array();
-foreach ($allHostsInfo["hosts"] as $hostInfo) {
- if ($hostInfo["discoveryStatus"] == "SUCCESS") {
- $goodHosts[] = $hostInfo["hostName"];
- }
-}
- */
-
/////// Insert roles for these nodes ////////
foreach ($components as $componentName) {
$addHostsToComponentResult = $dbHandle->addHostsToComponent($clusterName, $componentName, $goodHosts, "UNKNOWN", "UNKNOWN");
Modified: incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/frontend/selectServices.php Fri May 11 16:01:01 2012
@@ -88,7 +88,8 @@ $jsonOutput["allHosts"] = array();
/*
* FIXME need to get all hosts from select Nodes script
*/
-$allHostsInfo = $dbAccessor->getAllHostsInfo($clusterName, "", array());
+$allHostsInfo = $dbAccessor->getAllHostsInfo($clusterName,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), array());
if ($allHostsInfo["result"] != 0 ) {
$logger->log_error("Got error while getting hostsInfo ".$allHostsInfo["error"]);
print json_encode($allHostsInfo);
Modified: incubator/ambari/branches/ambari-186/hmc/php/puppet/DBReader.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/puppet/DBReader.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/puppet/DBReader.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/puppet/DBReader.php Fri May 11 16:01:01 2012
@@ -31,9 +31,10 @@ class DBReader {
public function getAllHostAttributes($clusterName) {
$dbAccessor = new HMCDBAccessor($this->dbPath);
- $allHostAttributes = $dbAccessor->getAllHostsInfo($clusterName, NULL, NULL);
+ $allHostAttributes = $dbAccessor->getAllHostsInfo($clusterName,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), array());
return $allHostAttributes;
- }
+ }
public function getHostNames($clusterId) {
$dbAccessor = new HMCDBAccessor($this->dbPath);
Modified: incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/selectNodes.php Fri May 11 16:01:01 2012
@@ -215,7 +215,8 @@ class SelectNodes {
$return["error"] = "";
$this->logger->log_error("All info: ".$clusterName."\n "
.json_encode($masterToHost));
- $allHostsDBInfo = $db->getAllHostsInfo($clusterName, "", array());
+ $allHostsDBInfo = $db->getAllHostsInfo($clusterName,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), array());
if ($allHostsDBInfo["result"] != 0) {
$this->logger->log_error("Issue getting all hosts info ".$allHostsDBInfo["error"]);
$return["result"] = $allHostsDBInfo["result"];
@@ -307,7 +308,8 @@ class SelectNodes {
$return = array();
$order = array("sortColumn" => "totalMem",
"sortOrder" => "DESC");
- $allHostsDBInfo = $db->getAllHostsInfo($clustername, "", $order);
+ $allHostsDBInfo = $db->getAllHostsInfo($clustername,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")) , $order);
if ($allHostsDBInfo["result"] != 0) {
$this->logger->log_error("Issue getting all hosts info ".$allHostsDBInfo["error"]);
$return["result"] = $allHostsDBInfo["result"];
Modified: incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/sequentialScriptRunner.php Fri May 11 16:01:01 2012
@@ -146,13 +146,11 @@ $hosts = readHostsFile($readFromFile);
$hosts = convertToLowerCase($hosts);
$logger->log_debug("The hosts after converting to lower case ".print_r($hosts, true));
-// Only add this host to list if the db does not have that host already. This is assuming
-// the host being in the db means the HMC host has been bootstrapped and discovered.
-$hostsInfoInDB = $dbHandle->getAllHostsInfo($clusterName, "", "");
-$logger->log_info("Host Info in DB ".print_r($hostsInfoInDB, true));
-$hostsInDB = $hostsInfoInDB["hosts"];
-if (sizeof($hostsInDB) == 0) {
- $logger->log_info("Hosts is empty so adding $thisHostName to the list of hosts");
+// Only add this host to list if the db does not have that host already.
+$checkThisHostInDB = $dbHandle->getHostInfo($clusterName, $thisHostName);
+$logger->log_debug("Host Info in DB ".print_r($checkThisHostInDB, true));
+if ($checkThisHostInDB["result"] != 0) {
+ $logger->log_info($thisHostName . "not found in DB so adding it to the list of hosts");
$hosts = addThisHostToList($hosts, $logger, $thisHostName, $readFromFile);
}
$hosts = convertToLowerCase($hosts);
Modified: incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php?rev=1337230&r1=1337229&r2=1337230&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/util/suggestProperties.php Fri May 11 16:01:01 2012
@@ -155,7 +155,8 @@ class SuggestProperties {
$order = array("sortColumn" => "cpuCount",
"sortOrder" => "ASC");
- $allHosts = $db->getAllHostsInfo($clusterName, "", $order);
+ $allHosts = $db->getAllHostsInfo($clusterName,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), $order);
if ($allHosts["result"] != 0) {
$result["result"] = $allHosts["result"];
$result["error"] = $allHosts["error"];
@@ -295,7 +296,8 @@ class SuggestProperties {
$order = array("sortColumn" => "cpuCount",
"sortOrder" => "ASC");
- $allHosts = $db->getAllHostsInfo($clusterName, "", $order);
+ $allHosts = $db->getAllHostsInfo($clusterName,
+ array("=" => array ( "discoveryStatus" => "SUCCESS")), $order);
if ($allHosts["result"] != 0) {
$result["result"] = $allHosts["result"];
$result["error"] = $allHosts["error"];