This script adds some default values to the host table in the SQL backend. This makes it easy to use a script to add lots of hosts at once.

diff -r df032a7eba18 -r 3379acf8a22f trunk/src/tashi/clustermanager/ data/sql.py --- a/trunk/src/tashi/clustermanager/data/sql.py Tue Jul 07 14:01:11 2009 -0400 +++ b/trunk/src/tashi/clustermanager/data/sql.py Tue Jul 07 15:01:25 2009 -0400
@@ -67,7 +67,7 @@

        def verifyStructure(self):
self.executeStatement("CREATE TABLE instances (id int(11) NOT NULL, vmId int(11), hostId int(11), decayed tinyint(1) NOT NULL, state int(11) NOT NULL, userId int(11), name varchar(256), cores int(11) NOT NULL, memory int(11) NOT NULL, disks varchar(1024) NOT NULL, nics varchar(1024) NOT NULL, hints varchar(1024) NOT NULL)") - self.executeStatement("CREATE TABLE hosts (id int(11) NOT NULL, name varchar(256) NOT NULL, up tinyint(1) NOT NULL, decayed tinyint(1) NOT NULL, state int(11) NOT NULL, memory int(11), cores int(11), version varchar(256))") + self.executeStatement("CREATE TABLE hosts (id INTEGER PRIMARY KEY, name varchar(256) NOT NULL, up tinyint(1) DEFAULT 0, decayed tinyint(1) DEFAULT 0, state int(11) DEFAULT 1, memory int(11), cores int(11), version varchar(256))") self.executeStatement("CREATE TABLE networks (id int(11) NOT NULL, name varchar(256) NOT NULL)") self.executeStatement("CREATE TABLE users (id int(11) NOT NULL, name varchar(256) NOT NULL)")

Reply via email to