Author: mahadev
Date: Sat Jan 26 01:23:44 2013
New Revision: 1438814
URL: http://svn.apache.org/viewvc?rev=1438814&view=rev
Log:
AMBARI-1256. Host registration can fail due to mount point info not fitting
ambari.hosts::disks_info column. (Sumit Mohanty via mahadev)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-server/pom.xml
incubator/ambari/trunk/ambari-server/sbin/ambari-server
incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py
incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1438814&r1=1438813&r2=1438814&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Sat Jan 26 01:23:44 2013
@@ -216,6 +216,9 @@ Trunk (unreleased changes):
AMBARI-1210. Allow capacity scheduler to be attached to host role configs for
CS configurability in the API's. (mahadev)
+ AMBARI-1256. Host registration can fail due to mount point info not fitting
+ ambari.hosts::disks_info column. (Sumit Mohanty via mahadev)
+
AMBARI-1.2.0 branch:
INCOMPATIBLE CHANGES
Modified: incubator/ambari/trunk/ambari-server/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/pom.xml?rev=1438814&r1=1438813&r2=1438814&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/pom.xml (original)
+++ incubator/ambari/trunk/ambari-server/pom.xml Sat Jan 26 01:23:44 2013
@@ -233,6 +233,23 @@
</sources>
</mapping>
<mapping>
+ <directory>/var/lib/ambari-server/resources/upgrade</directory>
+ <filemode>755</filemode>
+ <username>root</username>
+ <groupname>root</groupname>
+ </mapping>
+ <mapping>
+
<directory>/var/lib/ambari-server/resources/upgrade/ddl</directory>
+ <filemode>755</filemode>
+ <username>root</username>
+ <groupname>root</groupname>
+ <sources>
+ <source>
+
<location>src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.2.1.sql</location>
+ </source>
+ </sources>
+ </mapping>
+ <mapping>
<directory>/var/lib/ambari-server/resources/stacks</directory>
<filemode>755</filemode>
<username>root</username>
Modified: incubator/ambari/trunk/ambari-server/sbin/ambari-server
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/sbin/ambari-server?rev=1438814&r1=1438813&r2=1438814&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/sbin/ambari-server (original)
+++ incubator/ambari/trunk/ambari-server/sbin/ambari-server Sat Jan 26 01:23:44
2013
@@ -73,6 +73,10 @@ case "$1" in
$0 stop
$0 start
;;
+ upgrade)
+ echo -e "Upgrading ambari-server"
+ $PYTHON /usr/sbin/ambari-server.py $@
+ ;;
setup)
echo -e "Run postgresql initdb"
initdb_res=`/sbin/service postgresql initdb`
@@ -85,7 +89,7 @@ case "$1" in
$PYTHON /usr/sbin/ambari-server.py $@
;;
*)
- echo "Usage: /usr/sbin/ambari-server {start|stop|restart|setup}
[options]"
+ echo "Usage: /usr/sbin/ambari-server
{start|stop|restart|setup|upgrade} [options]"
exit 1
esac
Modified: incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py?rev=1438814&r1=1438813&r2=1438814&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/python/ambari-server.py Sat
Jan 26 01:23:44 2013
@@ -44,6 +44,7 @@ SETUP_ACTION = "setup"
START_ACTION = "start"
STOP_ACTION = "stop"
RESET_ACTION = "reset"
+UPGRADE_ACTION = "upgrade"
# selinux commands
GET_SE_LINUX_ST_CMD = "/usr/sbin/sestatus"
@@ -247,6 +248,20 @@ def setup_db(args):
+def upgrade_db(args):
+ #password access to ambari-server and mapred
+ configure_postgres_username_password(args)
+ dbname = args.postgredbname
+ file = args.upgrade_script_file
+ username = args.postgres_username
+ password = args.postgres_password
+ command = SETUP_DB_CMD[:]
+ command[-1] = command[-1].format(file, username, password)
+ retcode, outdata, errdata = run_os_command(command)
+ if not retcode == 0:
+ print errdata
+ return retcode
+
#
# Checks SELinux
#
@@ -735,6 +750,25 @@ def stop(args):
#
+# Upgrades the Ambari Server.
+#
+def upgrade(args):
+
+ print 'Checking PostgreSQL...'
+ retcode = check_postgre_up()
+ if not retcode == 0:
+ printErrorMsg ('PostgreSQL server not running. Exiting')
+ sys.exit(retcode)
+
+ print 'Upgrading database...'
+ retcode = upgrade_db(args)
+ if not retcode == 0:
+ printErrorMsg ('Database upgrade script has failed. Exiting.')
+ sys.exit(retcode)
+
+ print "Ambari Server 'upgrade' finished successfully"
+
+#
# Prints an "info" messsage.
#
def print_info_msg(msg):
@@ -905,6 +939,10 @@ def main():
"ambari-server/resources/"
"Ambari-DDL-Postgres-DROP.sql",
help="File with drop script")
+ parser.add_option('-u', '--upgrade-script-file', default="/var/lib/"
+ "ambari-server/resources/upgrade/ddl/"
+ "Ambari-DDL-Postgres-UPGRADE-1.2.1.sql",
+ help="File with upgrade script")
parser.add_option('-j', '--java-home', default=None,
help="Use specified java_home. Must be valid on all hosts")
parser.add_option("-v", "--verbose",
@@ -938,6 +976,8 @@ def main():
stop(options)
elif action == RESET_ACTION:
reset(options)
+ elif action == UPGRADE_ACTION:
+ upgrade(options)
else:
parser.error("Invalid action")
Modified:
incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql?rev=1438814&r1=1438813&r2=1438814&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
(original)
+++
incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
Sat Jan 26 01:23:44 2013
@@ -60,7 +60,7 @@ CREATE TABLE ambari.hostcomponentstate (
GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentstate TO :username;
-CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER
NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT
NULL, disks_info VARCHAR(2000) NOT NULL, host_attributes VARCHAR(20000) NOT
NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255),
last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info
VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255)
NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER
NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT
NULL, disks_info VARCHAR(10000) NOT NULL, host_attributes VARCHAR(20000) NOT
NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), public_host_name VARCHAR(255),
last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info
VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255)
NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
GRANT ALL PRIVILEGES ON TABLE ambari.hosts TO :username;