incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rg...@apache.org
Subject svn commit: r1180511 - in /incubator/tashi/trunk/src/zoni: client/zoni-cli.py data/resourcequerysql.py hardware/dellswitch.py install/db/zoniDbSetup.py
Date Sun, 09 Oct 2011 01:11:58 GMT
Author: rgass
Date: Sun Oct  9 01:11:58 2011
New Revision: 1180511

URL: http://svn.apache.org/viewvc?rev=1180511&view=rev
Log:
removed reservation_id in Domaininfo table.
More data tracking with vlans.  Will eventually let the server periodically log directly into
the switch to get switch state.


Modified:
    incubator/tashi/trunk/src/zoni/client/zoni-cli.py
    incubator/tashi/trunk/src/zoni/data/resourcequerysql.py
    incubator/tashi/trunk/src/zoni/hardware/dellswitch.py
    incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py

Modified: incubator/tashi/trunk/src/zoni/client/zoni-cli.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/client/zoni-cli.py?rev=1180511&r1=1180510&r2=1180511&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/client/zoni-cli.py (original)
+++ incubator/tashi/trunk/src/zoni/client/zoni-cli.py Sun Oct  9 01:11:58 2011
@@ -553,10 +553,11 @@ def main():
 	if (options.showDomains):
 		data.showDomains()
 	if (options.addDomain):
-		if len(args) > 2 and options.reservationId:
-			data.addDomain(args[0], string.join(args[1:len(args)]), options.reservationId)
+		if len(args) > 2 and options.vlanInfo:
+			data.addDomain(args[0], string.join(args[1:len(args)]), options.vlanInfo)
 		else:
-			mesg = "USAGE: %s --addDomain domainname domaindesc --reservationId ID\n" % (sys.argv[0])
+			mesg = "USAGE: %s --addDomain domainname \"domain desc\" --vlanInfo vlan:type,vlan:type\n"
% (sys.argv[0])
+			mesg += "Options\n\n  --vlanInfo 999:native,1000:untagged,1001:tagged\n"
 			sys.stdout.write(mesg)
 			exit()
 	if (options.removeDomain):
@@ -663,6 +664,7 @@ def main():
 			data.removeNodeFromVlan(options.nodeName, options.removeFromVlan)
 		if options.setNative and (options.nodeName or options.switchPort):
 			hwswitch.setNativeVlan(options.setNative)
+			data.addNodeToVlan(host['location'], options.setNative, "native")
 		if options.restoreNative and options.nodeName:
 			hwswitch.restoreNativeVlan()
 		if options.removeAllVlans and (options.nodeName or options.switchPort):

Modified: incubator/tashi/trunk/src/zoni/data/resourcequerysql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/resourcequerysql.py?rev=1180511&r1=1180510&r2=1180511&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/data/resourcequerysql.py (original)
+++ incubator/tashi/trunk/src/zoni/data/resourcequerysql.py Sun Oct  9 01:11:58 2011
@@ -75,14 +75,16 @@ class ResourceQuerySql(InfoStore):
 	def getNote(self):
 		return "Created by Zoni"
 
-	def addDomain(self, name, desc, reservationId):
-		#  Check if there is a reservation
-		query = "select * from reservationinfo where reservation_id = %s" % (reservationId)
-		result = self.selectDb(query)
-		if result.rowcount < 1:
-			mesg = "Reservation does not exist : %s" % (reservationId)
-			self.log.error(mesg)
-			return -1
+	def addDomain(self, name, desc, vlanInfo):
+		#  Check if vlans exist
+		vlans = []
+		for val in vlanInfo.split(","):
+			try:
+				ret = self.getVlanId(val.split(":")[0])
+				vlans.append(val)
+			except Exception, e:
+				print e
+				exit()
 
 		if desc == None:
 			desc = self.getNote()
@@ -92,7 +94,7 @@ class ResourceQuerySql(InfoStore):
 			return -1
 		#  Create a key for the reservation
 		domainKey = createKey(name)
-		query = "insert into domaininfo (domain_name, domain_desc, domain_key, reservation_id)
values ('%s','%s', '%s', '%s')" % (name, desc, domainKey, reservationId)
+		query = "insert into domaininfo (domain_name, domain_desc, domain_key) values ('%s','%s',
'%s')" % (name, desc, domainKey)
 		try:
 			result = self.insertDb(query)
 			mesg = "Adding domain %s(%s)" % (name, desc)
@@ -100,6 +102,19 @@ class ResourceQuerySql(InfoStore):
 		except Exception, e:
 			mesg = "Adding domain %s(%s) failed : %s" % (name, desc, e)
 			self.log.error(mesg)
+
+		#  Get the domain_id
+		domainId = int(self.getDomainIdFromKey(domainKey))
+
+		#  Map domain to vlan
+		for i in vlans:
+			vlanId = int(i.split(":")[0])
+			vlanType = i.split(":")[1]
+			query = "insert into domainmembermap values (%d, %d, '%s')" % (domainId, vlanId, vlanType)
+			try:
+				result = self.insertDb(query)
+			except Exception, e:
+				print e
 		
 
 	def getDomainMembership(self, sys_id):
@@ -114,11 +129,14 @@ class ResourceQuerySql(InfoStore):
 			return -1
 
 	def removeDomain(self, name):
+		domainId = self.__getSomething("domain_id", "domaininfo", "domain_name", name)
 		mesg = "Removing domain %s" % (name)
 		self.log.info(mesg)
 		query = "delete from domaininfo where domain_name = '%s'" % (name)
 		result = self.__deleteDb(query)
 		#  Need to remove any vlans attached to this domain
+		query = "delete from domainmembermap where domain_id = '%s'" % (domainId)
+		result = self.__deleteDb(query)
 
 	def showDomains(self):
 		usermgt = eval("usermanagement.%s" % (self.config['userManagement']) + "()")
@@ -418,11 +436,11 @@ class ResourceQuerySql(InfoStore):
 		result = self.selectDb(query)
 		#print result.rowcount 
 		if result.rowcount > 0:
-			return result.fetchall()[0][0]
+			return int(result.fetchall()[0][0])
 		else:
 			mesg = "VLAN does not exist: " + str(vlan)
 			self.log.error(mesg)
-			return -1 
+			raise Exception, mesg
 
 	def isIpAvailable(self, ip_addr, vlan_id):
 		query = "select * from allocationinfo where ip_addr = \"" + str(ip_addr) + "\" and vlan_id
= \"" + str(vlan_id) + "\""
@@ -492,9 +510,9 @@ class ResourceQuerySql(InfoStore):
 		print "NODE ALLOCATION\n"
 		sum = {}
 		if self.verbose:
-			print "%-5s%-10s%-10s%-13s%-12s%-10s%-34s%-20s%s" % ("Res", "User", "Host", "Cores/Mem","Expiration",
"Hostname", "Boot Image Name", "Vlan Member", "Notes")
+			print "%-5s%-10s%-10s%-10s%-13s%-12s%-10s%-34s%-20s%s" % ("Res", "User", "Host", "Domain",
"Cores/Mem","Expiration", "Hostname", "Boot Image Name", "Vlan Member", "Notes")
 		else:
-			print "%-10s%-10s%-13s%-12s%s" % ("User", "Node", "Cores/Mem","Expiration", "Notes")
+			print "%-10s%-10s%-10s%-13s%-12s%s" % ("User", "Node", "Domain", "Cores/Mem","Expiration",
"Notes")
 
 		for i in result.fetchall():
 			uid = i[0]
@@ -520,18 +538,18 @@ class ResourceQuerySql(InfoStore):
 			sum['totMemory'] = sum.get('totMemory', 0)
 			sum['totMemory'] += memory
 			if self.verbose:
-				#query = "select vlan_num from vlaninfo v, domainmembermap m, domaininfo d where v.vlan_id
= m.vlan_id and d.domain_id = m.domain_id and d.domain_name = '%s'" % (domain);
-				#query = "select vlan_num from vlaninfo v, vlanmembermap m, domaininfo d, allocationinfo
a where v.vlan_id = m.vlan_id and a.reservation_id = d.reservation_id"
-				query = "select v.vlan_num from vlaninfo v, vlanmembermap m where v.vlan_id = m.vlan_id
and allocation_id = '%d'" % allocation_id
+				query = "select v.vlan_num, m.vlan_type from vlaninfo v, vlanmembermap m where v.vlan_id
= m.vlan_id and allocation_id = '%d' order by vlan_num asc" % allocation_id
 				vlanRes = self.selectDb(query)
 				vlanList = []
 				for i in vlanRes.fetchall():
-					vlanList.append(str(i[0]))
+					tag = string.upper(str(i[1][0]))
+					mytag = "%s(%s)" %(str(i[0]), tag )
+					vlanList.append(mytag)
 				
 				vlanMember = string.join(vlanList, ",")
-				print "%-5s%-10s%-10s%-2s/%-10s%-12s%-10s%-34s%-20s%s" % (resId, userName, host, cores,
memory,expire, hostname, image_name, vlanMember,combined_notes)
+				print "%-5s%-10s%-10s%-10s%-2s/%-10s%-12s%-10s%-34s%-20s%s" % (resId, userName, host,
domain, cores, memory,expire, hostname, image_name, vlanMember,combined_notes)
 			else:
-				print "%-10s%-10s%-2s/%-10s%-12s%s" % (userName, host, cores, memory,expire, combined_notes)
+				print "%-10s%-10s%-10s%-2s/%-10s%-12s%s" % (userName, host, domain, cores, memory,expire,
combined_notes)
 		print "\n%s systems allocated - %d cores| %d bytes RAM" % (str(result.rowcount), sum['totCores'],
sum['totMemory'])
 
 	def showReservation(self, userId=None):
@@ -881,7 +899,6 @@ class ResourceQuerySql(InfoStore):
 			mesg = "UPDATING Vlan: " 
 			self.log.info(mesg)
 			query = "update reservationinfo set vlan_num = " + vlanIsolate + " where reservation_id
= \"" + str(reservationId) + "\""
-			print "query is ", query
 			self.__updateDb(query)
 		if userId:
 			mesg = "UPDATING USER:"
@@ -973,8 +990,10 @@ class ResourceQuerySql(InfoStore):
 		#  Check that all the vlans exist
 		for i in vlanInfo.split(","):
 			v = i.split(":")[0]
-			if self.getVlanId(v) < 0:
-				return -1
+			try:
+				self.getVlanId(v)
+			except Exception, e:
+				print e
 
 		#  Insert to allocationinfo
 		nodeName = self.getLocationFromSysId(sysId)
@@ -988,7 +1007,7 @@ class ResourceQuerySql(InfoStore):
 		for i in vlanInfo.split(","):
 			v = i.split(":")[0]
 			t = i.split(":")[1]
-			self.addnodetovlan(nodeName, v, t)
+			self.addNodeToVlan(nodeName, v, t)
 
 		#  Insert into imagemap
 		query = "insert into imagemap (allocation_id, image_id) values ('%s', '%s')" % (allocationId,
imageId)
@@ -1000,6 +1019,15 @@ class ResourceQuerySql(InfoStore):
 		sysId = self.getSysIdFromLocation(nodeName)	
 		allocationId = self.__getSomething("allocation_id", "allocationinfo", "sys_id", sysId)
 		vId = self.getVlanId(v)
+		if t == "native":
+			query = "select vlan_id from vlanmembermap where allocation_id = %d and vlan_type = 'native'"
% (allocationId)
+			result = self.selectDb(query)
+			if result.rowcount > 0:
+				query = "update vlanmembermap set vlan_type = 'untagged' where allocation_id = %d and
vlan_id = %d" % (allocationId, result.fetchall()[0][0])
+			else:
+				query = "delete from vlanmembermap where allocation_id = %d and vlan_id = %d" % (allocationId,
vId)
+			result = self.selectDb(query)
+
 		if self.__checkDup("vlanmembermap", "vlan_id", vId, "allocation_id", allocationId):
 			self.log.error("Vlan %s already exists" % (v))
 			return -1
@@ -1024,13 +1052,6 @@ class ResourceQuerySql(InfoStore):
 	def __updateSysState(self, sysId, stateId):
 		query = "update sysinfo set state_id = '%s' where sys_id = '%s'" % (stateId, sysId)
 		return self.__updateDb(query)
-
-	def rgasstest(self, vlan_num):
-		query = "select * from vlaninfo where vlan_num = " + vlan_num
-		res = self.selectDb(query).fetchall()
-		print res
-		
-		
 			
 	def removeReservation(self, res):
 		mesg = "Removing reservation (%s)" % str(res)

Modified: incubator/tashi/trunk/src/zoni/hardware/dellswitch.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/hardware/dellswitch.py?rev=1180511&r1=1180510&r2=1180511&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/hardware/dellswitch.py (original)
+++ incubator/tashi/trunk/src/zoni/hardware/dellswitch.py Sun Oct  9 01:11:58 2011
@@ -271,6 +271,10 @@ class HwDellSwitch(HwSwitchInterface):
 		child.terminate()
 
 	def addNodeToVlan(self, vlan, tag="untagged"):
+		if tag == "native":
+			self.setNativeVlan(vlan)
+			tag = "untagged"
+		
 		mesg = "Adding switchport (%s:%s) to vlan %s:%s" % (str(self.host['hw_name']), str(self.host['hw_port']),
str(vlan), str(tag))
 		self.log.info(mesg)
 		

Modified: incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py?rev=1180511&r1=1180510&r2=1180511&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py (original)
+++ incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py Sun Oct  9 01:11:58 2011
@@ -163,11 +163,12 @@ def createTables(conn):
 	sys.stdout.write("Success\n")
 	#  Create domaininfo
 	sys.stdout.write("    Creating domaininfo...")
-	execQuery(conn, "CREATE TABLE IF NOT EXISTS `domaininfo` ( `domain_id` int(11) unsigned
NOT NULL auto_increment, `domain_name` varchar(64) NOT NULL, `domain_key` varchar(1024) NULL,
`domain_desc` varchar(256) NOT NULL, `reservation_id` int(11) unsigned NOT NULL,  PRIMARY
KEY  (`domain_id`), INDEX (reservation_id), FOREIGN KEY (reservation_id) REFERENCES reservationinfo(reservation_id)
on DELETE CASCADE) ENGINE=INNODB")
+	#execQuery(conn, "CREATE TABLE IF NOT EXISTS `domaininfo` ( `domain_id` int(11) unsigned
NOT NULL auto_increment, `domain_name` varchar(64) NOT NULL, `domain_key` varchar(1024) NULL,
`domain_desc` varchar(256) NOT NULL, `reservation_id` int(11) unsigned NOT NULL,  PRIMARY
KEY  (`domain_id`), INDEX (reservation_id), FOREIGN KEY (reservation_id) REFERENCES reservationinfo(reservation_id)
on DELETE CASCADE) ENGINE=INNODB")
+	execQuery(conn, "CREATE TABLE IF NOT EXISTS `domaininfo` ( `domain_id` int(11) unsigned
NOT NULL auto_increment, `domain_name` varchar(64) NOT NULL, `domain_key` varchar(1024) NULL,
`domain_desc` varchar(256) NOT NULL, PRIMARY KEY (`domain_id`)) ENGINE=INNODB")
 	sys.stdout.write("Success\n")
 	#  Create domainmap
 	sys.stdout.write("    Creating domainmembermap...")
-	execQuery(conn, "CREATE TABLE IF NOT EXISTS `domainmembermap` (`domain_id` int(11) unsigned
NOT NULL, `vlan_id` int(11) unsigned NOT NULL, INDEX (domain_id), FOREIGN KEY (domain_id)
REFERENCES domaininfo(domain_id) on DELETE CASCADE) ENGINE=INNODB")
+	execQuery(conn, "CREATE TABLE IF NOT EXISTS `domainmembermap` (`domain_id` int(11) unsigned
NOT NULL, `vlan_id` int(11) unsigned NOT NULL, `vlan_type` varchar(20) NULL, INDEX (domain_id),
FOREIGN KEY (domain_id) REFERENCES domaininfo(domain_id) on DELETE CASCADE) ENGINE=INNODB")
 	sys.stdout.write("Success\n")
 	#  Create system, domain member map
 	sys.stdout.write("    Creating sysdomainmembermap...")
@@ -175,7 +176,7 @@ def createTables(conn):
 	sys.stdout.write("Success\n")
  	#  Create allocationinfo
 	sys.stdout.write("    Creating allocationinfo...")
-	execQuery(conn, "CREATE TABLE IF NOT EXISTS `allocationinfo` ( `allocation_id` int(11) unsigned
NOT NULL auto_increment, `sys_id` int(11) unsigned NOT NULL, `reservation_id` int(11) unsigned
NOT NULL, `pool_id` int(11) unsigned NULL, `hostname` varchar(64) default NULL, `domain_id`
int(11) unsigned NOT NULL, `notes` tinytext, `expire_time` timestamp default 0 NOT NULL, PRIMARY
KEY  (`allocation_id`), INDEX (domain_id), FOREIGN KEY (domain_id) REFERENCES domaininfo (domain_id)
on DELETE CASCADE) ENGINE=INNODB")
+	execQuery(conn, "CREATE TABLE IF NOT EXISTS `allocationinfo` ( `allocation_id` int(11) unsigned
NOT NULL auto_increment, `sys_id` int(11) unsigned NOT NULL, `reservation_id` int(11) unsigned
NOT NULL, `pool_id` int(11) unsigned NULL, `hostname` varchar(64) default NULL, `domain_id`
int(11) unsigned NOT NULL, `notes` tinytext, `expire_time` timestamp default 0 NOT NULL, PRIMARY
KEY  (`allocation_id`)) ENGINE=INNODB")
 	sys.stdout.write("Success\n")
 	#  Create imagemap
 	sys.stdout.write("    Creating imagemap...")
@@ -230,33 +231,34 @@ def createRegistration(conn, config):
 		sys.stdout.write("    Success\n")
 
 	#  Initrd
-	checkVal =  entryExists(conn, "initrdinfo", "initrd_name", "zoni-register-64")
-	sys.stdout.write("    Checking existence of initrd...")
-	if not checkVal:
-		sys.stdout.write("No\n") 
-		optionList = "initrd=" + config['initrdRoot'] + "/x86_64/zoni-register-64.gz pxeserver="
+ config['pxeServerIP'] + " imageserver=" + config['imageServerIP'] + " defaultimage=amd64-tashi_nm
registerfile=register_node mode=register" 
-		sys.stdout.write("    Inserting default register image into DB...")
-		r = execQuery(conn, "INSERT into `initrdinfo` (initrd_name, initrd_arch, initrd_options)
values ('zoni-register-64','x86_64', '" + optionList + "')")
-		initrdId = str(r.lastrowid)
-		sys.stdout.write("Success\n")
-	else:
-		sys.stdout.write("Yes\n")    
-		initrdId = str(checkVal[1][0][0])
+	#checkVal =  entryExists(conn, "initrdinfo", "initrd_name", "zoni-register-64")
+	#sys.stdout.write("    Checking existence of initrd...")
+	#if not checkVal:
+		#sys.stdout.write("No\n") 
+#1,'initrd.img-2.6.38-10-server','x86_64','pxeserver=10.10.0.10 imageserver=10.10.0.10 defaultimage=x86_64-natty-hadoop-tashi_nm
registerfile=register_node mode=register zoniroot=zoni configipmi=1 verbose=0'
+		#optionList = "pxeserver=" + config['pxeServerIP'] + " imageserver=" + config['imageServerIP']
+ " defaultimage=amd64-tashi_nm registerfile=register_node mode=register zoniroot="  + config['registrationBaseDir']
+ "configipmi=1 verbose=0
+		#sys.stdout.write("    Inserting default register image into DB...")
+		#r = execQuery(conn, "INSERT into `initrdinfo` (initrd_name, initrd_arch, initrd_options)
values ('zoni-register-64','x86_64', '" + optionList + "')")
+		#initrdId = str(r.lastrowid)
+		#sys.stdout.write("Success\n")
+	#else:
+		#sys.stdout.write("Yes\n")    
+		#initrdId = str(checkVal[1][0][0])
 		
 	#  Interactive Registration
-	checkVal =  entryExists(conn, "initrdinfo", "initrd_name", "zoni-register-64-interactive")
-	sys.stdout.write("    Checking existence of interactive initrd...")
-	if not checkVal:
-		sys.stdout.write("No\n") 
-		sys.stdout.write("    Inserting default register-interactive image into DB...")
-		optionList = "initrd=" + config['initrdRoot'] + "/x86_64/zoni-register-64-interactive.gz
pxeserver=" + config['pxeServerIP'] + " imageserver=" + config['imageServerIP'] + " defaultimage=amd64-tashi_nm
registerfile=register_node mode=register verbose=1" 
-		r = execQuery(conn, "INSERT into `initrdinfo` (initrd_name, initrd_arch, initrd_options)
values ('zoni-register-64-interactive','x86_64', '" + optionList + "')")
-		initrdIdInteractive = str(r.lastrowid)
-		sys.stdout.write("Success\n")
-	else:
-		sys.stdout.write("Yes\n")    
-		initrdIdInteractive = str(checkVal[1][0][0])
-
+	#checkVal =  entryExists(conn, "initrdinfo", "initrd_name", "zoni-register-64-interactive")
+	#sys.stdout.write("    Checking existence of interactive initrd...")
+	#if not checkVal:
+		#sys.stdout.write("No\n") 
+		#sys.stdout.write("    Inserting default register-interactive image into DB...")
+		#optionList = "initrd=" + config['initrdRoot'] + "/x86_64/zoni-register-64-interactive.gz
pxeserver=" + config['pxeServerIP'] + " imageserver=" + config['imageServerIP'] + " defaultimage=amd64-tashi_nm
registerfile=register_node mode=register verbose=1" 
+		#r = execQuery(conn, "INSERT into `initrdinfo` (initrd_name, initrd_arch, initrd_options)
values ('zoni-register-64-interactive','x86_64', '" + optionList + "')")
+		#initrdIdInteractive = str(r.lastrowid)
+		#sys.stdout.write("Success\n")
+	#else:
+		#sys.stdout.write("Yes\n")    
+		#initrdIdInteractive = str(checkVal[1][0][0])
+#
 	#  Insert disk option
 	sys.stdout.write("    Adding Disk to imageinfo...")
 	query = "select * from imageinfo where image_name = 'disk'"
@@ -266,18 +268,18 @@ def createRegistration(conn, config):
 		sys.stdout.write("Success\n")
 
 	#  Link initrd and kernel to image
-	sys.stdout.write("    Registering initrd and kernel to registration image...")
-	query = "select * from imageinfo where image_name = 'zoni-register-64' and kernel_id = "
+ kernelId + " and initrd_id = " + initrdId
-	r = execQuery(conn, query)
-	if len(r.fetchall()) < 1:
-		execQuery(conn, "INSERT into `imageinfo` (image_name, dist, dist_ver, kernel_id, initrd_id)
values ('zoni-register-64', 'Ubuntu', 'Hardy', " + kernelId + ", " + initrdId + ")")
-
-	query = "select * from imageinfo where image_name = 'zoni-register-64-interactive' and kernel_id
= " + kernelId + " and initrd_id = " + initrdId
-	r = execQuery(conn, query)
-	if len(r.fetchall()) < 1:
-		execQuery(conn, "INSERT into `imageinfo` (image_name, dist, dist_ver, kernel_id, initrd_id)
values ('zoni-register-64-interactive', 'Ubuntu', 'Hardy', " + kernelId + ", " + initrdIdInteractive
+ ")")
-	sys.stdout.write("Success\n")
-
+	#sys.stdout.write("    Registering initrd and kernel to registration image...")
+	#query = "select * from imageinfo where image_name = 'zoni-register-64' and kernel_id =
" + kernelId + " and initrd_id = " + initrdId
+	#r = execQuery(conn, query)
+	#if len(r.fetchall()) < 1:
+		#execQuery(conn, "INSERT into `imageinfo` (image_name, dist, dist_ver, kernel_id, initrd_id)
values ('zoni-register-64', 'Ubuntu', 'Hardy', " + kernelId + ", " + initrdId + ")")
+#
+	#query = "select * from imageinfo where image_name = 'zoni-register-64-interactive' and
kernel_id = " + kernelId + " and initrd_id = " + initrdId
+	#r = execQuery(conn, query)
+	#if len(r.fetchall()) < 1:
+		#execQuery(conn, "INSERT into `imageinfo` (image_name, dist, dist_ver, kernel_id, initrd_id)
values ('zoni-register-64-interactive', 'Ubuntu', 'Hardy', " + kernelId + ", " + initrdIdInteractive
+ ")")
+	#sys.stdout.write("Success\n")
+#
 
 def addInitialConfig(conn, config):
 	sys.stdout.write("    Adding initial configuration info into DB...\n")
@@ -313,7 +315,7 @@ def addInitialConfig(conn, config):
 		#  Get the domainId 
 		domainId = str(checkVal[1][0][0])
 	else:
-		r = execQuery(conn, "INSERT into `domaininfo` (domain_name, domain_desc, reservation_id)
values ('Zoni', 'Zoni Home Domain',1)")
+		r = execQuery(conn, "INSERT into `domaininfo` (domain_name, domain_desc) values ('Zoni',
'Zoni Home Domain')")
 		domainId = str(r.lastrowid)
 		sys.stdout.write("Success\n")
 



Mime
View raw message