You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by rg...@apache.org on 2011/09/28 23:26:41 UTC

svn commit: r1177105 - in /incubator/tashi/branches/zoni-dev/trunk: etc/ src/zoni/bootstrap/ src/zoni/client/ src/zoni/data/ src/zoni/extra/ src/zoni/hardware/ src/zoni/system/registration/register/ src/zoni/system/registration/www/

Author: rgass
Date: Wed Sep 28 23:26:41 2011
New Revision: 1177105

URL: http://svn.apache.org/viewvc?rev=1177105&view=rev
Log:
Committing these changes for Luke.

Support for auto creation of zoni tftp boot menus
Changes to hwswitch which may break 52XX switches.  Fix later
Other Random changes to make the system work.  


Modified:
    incubator/tashi/branches/zoni-dev/trunk/etc/ZoniDefaults.cfg
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/bootstrap/pxe.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/resourcequerysql.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/usermanagement.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/extra/util.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/dellswitch.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/hwswitchinterface.py
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/register/register_node
    incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/www/zoni-register.php

Modified: incubator/tashi/branches/zoni-dev/trunk/etc/ZoniDefaults.cfg
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/etc/ZoniDefaults.cfg?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/etc/ZoniDefaults.cfg (original)
+++ incubator/tashi/branches/zoni-dev/trunk/etc/ZoniDefaults.cfg Wed Sep 28 23:26:41 2011
@@ -55,8 +55,9 @@ TFTP_UPDATE_FILE = /var/lib/tftpboot/pxe
 TFTP_BASE_FILE = /var/lib/tftpboot/pxelinux.cfg/base.zoni
 TFTP_BASE_MENU_FILE = /var/lib/tftpboot/pxelinux.cfg/base-menu
 PXE_SERVER_IP = IP_OF_PXE_SERVER_IN_DOMAIN_0
-#  Relative to TFTP_ROOT_DIR
-INITRD_ROOT = initrd
+#  Must be relative to TFTP_ROOT_DIR
+INITRD_ROOT = builds/initrd
+KERNEL_ROOT = builds/kernel
 
 [www]
 WWW_DOCUMENT_ROOT = /var/www

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/bootstrap/pxe.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/bootstrap/pxe.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/bootstrap/pxe.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/bootstrap/pxe.py Wed Sep 28 23:26:41 2011
@@ -25,12 +25,13 @@ import datetime
 import subprocess
 import MySQLdb
 import traceback
+import logging
 
-from zoni.extra.util import logit
+from zoni.extra.util import normalizeMac
 from zoni.bootstrap.bootstrapinterface import BootStrapInterface
 
 class Pxe(BootStrapInterface):
-	def __init__(self, config, verbose=None):
+	def __init__(self, config, data, verbose=None):
 		self.verbose  = verbose
 		self.host = config['dbHost']
 		self.user = config['dbUser']
@@ -43,8 +44,11 @@ class Pxe(BootStrapInterface):
 		self.tftpUpdateFile = config['tftpUpdateFile']
 		self.tftpBaseFile = config['tftpBaseFile']
 		self.tftpBaseMenuFile = config['tftpBaseMenuFile']
+		self.initrdRoot = config['initrdRoot']
+		self.kernelRoot = config['kernelRoot']
+
+		self.log = logging.getLogger(os.path.basename(__file__))
 
-		self.logFile = config['logFile']
 
 		if config['dbPort'] == "":
 			config['dbPort'] = 3306
@@ -52,10 +56,14 @@ class Pxe(BootStrapInterface):
 		self.port = config['dbPort']
 
 		self.vlan_max = config['vlanMax']
+		
+		self.data = data
 		#self.vlan_reserved = config['vlanReserved']
 		
+		#data = instantiateImplementation("zoni.data.resourcequerysql.ResourceQuerySql", configs, options.verbosity)
 		#  Connect to DB
-		self.conn = MySQLdb.connect(host = self.host, port = self.port, user = self.user, passwd = self.passwd, db = self.db)
+		#self.conn = MySQLdb.connect(host = self.ho st, port = self.port, user = self.user, passwd = self.passwd, db = self.db)
+
 		#cursor.execute ("SELECT VERSION()")
 		#print "server version:", row[0]
 		#mysql -Dirp-cluster -hrodimus -u reader -e "select * from hostinfo;"
@@ -97,4 +105,72 @@ class Pxe(BootStrapInterface):
 			os.system(cmd)
 		except Exception:
 			traceback.print_exc(sys.exc_info())
+
+	def generateBootOptions(self, image):
+		name = self.tftpBootOptionsDir + "/" + image
+		tftpdir = os.path.basename(self.tftpImageDir)
+		bootdir = os.path.basename(self.tftpBootOptionsDir)
+		imagedir = os.path.join(tftpdir, bootdir, image)
+
+		#  Write out boot image file
+		val = "DISPLAY boot-screens/boot.txt\n"
+		val += "DEFAULT vesamenu.c32\n"
+		val += "MENU BACKGROUND boot-screens/zoni_pxe.jpg\n"
+		val += "PROMPT 0\n"
+		
+		val += "MENU COLOR border 49;37 #00FFFFFF #00FFFFFF none\n"
+		val += "MENU INCLUDE %s-menu\n" % imagedir
+		f = open(name, "w")
+		f.write(val)
+		f.close()
+
+		
+		#  Write out the menu file
+		#  Eventually iterate over all images this machine should be able to select from
+		name = self.tftpBootOptionsDir + "/" + image + "-menu"
+		kOpt= self.data.getKernelOptions(image)
+		kernelPath = os.path.join(self.kernelRoot, kOpt['kernel_arch'], kOpt['kernel_name'])
+		val = "DISPLAY boot-screens/boot.txt\n\n"
+		val += "LABEL %s\n" % kOpt['image_name']
+		val += "	MENU DEFAULT\n"
+		val += "	kernel %s\n" % kernelPath
+		val += "	append %s\n" % kOpt['initrd_options']
+
+		f = open(name, "w")
+		f.write(val)
+		f.close()
+
+		
+
+	def setBootImage(self, mac, image):
+		mac_addr = "01-" + string.replace(normalizeMac(mac), ":", "-")
+		maclink = self.tftpImageDir + "/" + mac_addr
+		self.generateBootOptions(image)
+		#  Check if it exists first
+		if os.path.exists(maclink):
+			try:
+				os.unlink(maclink)
+			except Exception, e:
+				traceback.print_exc(sys.exc_info())
+				if OSError:
+					print OSError, e
+					mesg = "ERROR : %s\n" % e
+					self.log.error(mesg)
+					return 1
+				return 1
+		#  Create the boot option file
+		#  Relink
+		newlink = os.path.basename(self.tftpBootOptionsDir) + "/" + image
+		try:
+			os.symlink(newlink, maclink)
+			mesg = "Image assignment Successful %s -> %s " % (mac, image)
+			self.log.info(mesg)
+		except Exception, e:
+			if OSError:
+				#mesg = "Cannot modify file.  Please use sudo\n"
+				mesg = "ERROR : %s\n" % e
+				self.log.info(mesg)
+				return 1
+			return 1
+
 		

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py Wed Sep 28 23:26:41 2011
@@ -119,11 +119,12 @@ def main():
 	#  Admin Interface
 	group = optparse.OptionGroup(parser, "Admin Interface", "Administration Interface:")
 	group.add_option("--admin", dest="ADMIN", help="Enter Admin mode", action="store_true", default=False)
+	group.add_option("--setPortMode", "--setportmode", dest="setPortMode", help="Set port mode to access, trunk, or general")
 	group.add_option("--enableHostPort", "--enablehostport", dest="enableHostPort", help="Enable a switch port", action="store_true", default=False)
 	group.add_option("--disableHostPort", "--disablehostport", dest="disableHostPort", help="Disable a switch port", action="store_true", default=False)
-	group.add_option("--destroyVlan", "--destroyvlan", dest="removeVlanId", help="Remove vlan from all switches")
+	group.add_option("--destroyVlan", "--destroyvlan", dest="destroyVlanId", help="Remove vlan from all switches")
 	group.add_option("--createVlan", "--createvlan", dest="createVlanId", help="Create a vlan on all switches")
-	group.add_option("--addNodeToVlan", "--addnodetovlan", dest="add2Vlan", help="Add node to a vlan")
+	group.add_option("--addNodeToVlan", "--addnodetovlan", dest="add2Vlan", help="Add node to a vlan (:tagged)")
 	group.add_option("--removeNodeFromVlan", "--removenodefromvlan", dest="removeFromVlan", help="Remove node from a vlan")
 	group.add_option("--setNativeVlan", "--setnativevlan", dest="setNative", help="Configure native vlan")
 	group.add_option("--restoreNativeVlan", "--restorenativevlan", dest="restoreNative", help="Restore native vlan", action="store_true", default=False)
@@ -132,6 +133,8 @@ def main():
 	group.add_option("--interactiveSwitchConfig", "--interactiveswitchconfig", dest="interactiveSwitchConfig", help="Interactively configure a switch.  switchhname")
 	group.add_option("--showSwitchConfig", "--showswitchconfig", dest="showSwitchConfig", help="Show switch config for node", action="store_true", default=False)
 	group.add_option("--register", dest="register", help="Register hardware to Zoni", action="store_true", default=False)
+	group.add_option("--labelPort", dest="labelPort", help="Label switch port", action="store_true", default=False)
+	group.add_option("--saveConfig", dest="saveConfig", help="SWITCHNAME - Save Switch Config")
 	parser.add_option_group(group)
 
 
@@ -149,16 +152,18 @@ def main():
 	group.add_option("--addDomain", "--adddomain", dest="addDomain", help="Add new domain to Zoni", action="store_true", default=False)
 	group.add_option("--removeDomain", "--removedomain", dest="removeDomain", help="remove a domain from Zoni", action="store_true", default=False)
 	group.add_option("-V", "--showVlans", "--showvlans", dest="showVlans", help="Show an from Zoni", action="store_true", default=False)
-	group.add_option("--addVlan", "--addvlan", dest="addVlan", help="Add new vlan to Zoni", action="store_true", default=False)
-	group.add_option("--removeVlan", "--removevlan", dest="removeVlan", help="Remove an from Zoni", action="store_true", default=False)
+	#group.add_option("--addVlan", "--addvlan", dest="addVlan", help="Add new vlan to Zoni", action="store_true", default=False)
+	#group.add_option("--removeVlan", "--removevlan", dest="removeVlan", help="Remove an from Zoni", action="store_true", default=False)
 	group.add_option("--assignVlan", "--assignvlan", dest="assignVlan", help="Assign vlan to a domain")
 	parser.add_option_group(group)
 
 	#  Allocation Interface
 	group = optparse.OptionGroup(parser, "Allocation Interface", "Change current systems allocations:")
+	#group.add_option("--addReservation", "--addreservation", dest="addReservation", help="Add a Reservation", action="store_true", default=False)
 	group.add_option("--addImage", "--addimage", dest="addImage", help="Add image to Zoni - amd64-image:dist:dist_ver")
 	group.add_option("--delImage", "--delimage", dest="delImage", help="Delete PXE image")
 	#group.add_option("--addPxeImage", "--addpxeimage", dest="imageName", help="Add PXE image to database", action="store_true", default=False)
+	group.add_option("--assignImage", "--assignimage", dest="assignImage", help="Assign image to resource")
 	group.add_option("--imageName", "--imagename", dest="imageName", help="Assign image to resource")
 
 	group.add_option("--allocateNode", "--allocatenode", dest="allocateNode", help="Assign node to a user", action="store_true", default=False)
@@ -170,12 +175,15 @@ def main():
 	group.add_option("--releaseNode", "--releasenode", dest="releaseNode", help="Release current node allocation", action="store_true", default=False)
 	group.add_option("--reservationDuration", "--reservationduration", dest="reservationDuration", help="Specify duration of node reservation - YYYYMMDD format")
 	group.add_option("-r", "--reservationId", "--reservationid", dest="reservationId", help="Reservation ID")
-	group.add_option("--addReservation", "--addreservation", dest="addReservation", help="Add a Reservation", action="store_true", default=False)
 	group.add_option("--updateReservation", "--updatereservation", dest="updateReservation", help="Update Reservation", action="store_true", default=False)
 	group.add_option("--delReservation", "--delreservation", dest="delReservation", help="Delete Reservation")
 	group.add_option("--rgasstest", dest="rgasstest", help="Debug testing function", action="store_true", default=False)
 	parser.add_option_group(group)
 
+	group = optparse.OptionGroup(parser, "Reservation Interface", "Change current systems reservations:")
+	group.add_option("--createReservation", "--createreservation", dest="createReservation", help="Create a new Reservation", action="store_true", default=False)
+	parser.add_option_group(group)
+
 	#  Zoni Helpers
 	group = optparse.OptionGroup(parser, "Zoni Helpers", "Helper functions:")
 	group.add_option("--addDns", dest="addDns", help="Add a DNS entry", action="store_true", default=False)
@@ -197,6 +205,7 @@ def main():
 	#print "after tread"
 
 	data = instantiateImplementation("zoni.data.resourcequerysql.ResourceQuerySql", configs, options.verbosity)
+	reservation = instantiateImplementation("zoni.data.reservation.reservationMysql", configs, data, options.verbosity)
 	#query = zoni.data.resourcequerysql.ResourceQuerySql(configs, options.verbosity)
 
 	#  Get host info
@@ -373,7 +382,13 @@ def main():
 		exit()
 
 	#  Specify usermanagement, ldap or files
-	usermgt = usermanagement.ldap()
+	if configs['userManagement'] == "ldap":
+		usermgt = usermanagement.ldap()
+	elif configs['userManagement'] == "files":
+		usermgt = usermanagement.files()
+	else:
+		print "User management problem"
+		exit()
 
 
 	if (options.rgasstest):
@@ -400,9 +415,9 @@ def main():
 		#exit()
 
 	#  Create a reservation for a user
-	if (options.addReservation):
+	if (options.createReservation):
 		if not (options.userName or options.uid):
-			mesg = "ERROR:  AddReservation requires the following arguments...\n"
+			mesg = "ERROR:  CreateReservation requires the following arguments...\n"
 			if not (options.userName or options.uid):
 				mesg += "  Username:  --userName=username or --uid 1000\n"
 
@@ -412,11 +427,15 @@ def main():
 			exit()
 
 		userId = options.uid
-		if not options.uid:
+		if not userId:
 			userId = usermgt.getUserId(options.userName)
 
-		reservationId = data.addReservation(userId, options.reservationDuration, options.myNotes + " " + str(string.join(args[0:len(args)])))
+		if userId:
+			reservationId = reservation.createReservation(userId, options.reservationDuration, options.myNotes + " " + str(string.join(args[0:len(args)])))
 
+		else:
+			print "user doesn't exist"
+			exit()
 
 	#  Allocate node to user
 	if (options.allocateNode):
@@ -492,17 +511,19 @@ def main():
 		data.releaseNode(options.nodeName)
 		
 	#  Assign image to host
-	#if (options.assignImage):
-		#if not options.nodeName:
-			#usage = "Node not specified.  Please specify a node with --nodeName or -n"
-			#print usage
-			#exit()
+	if (options.assignImage):
+		if not options.nodeName:
+			usage = "Node not specified.  Please specify a node with --nodeName or -n"
+			print usage
+			exit()
+		#  need to fix this later
 		#if data.assignImagetoHost(host, options.assignImage):
 			#print "ERROR"
 			#exit()
-#
+
 		#  Update PXE 
-		#bootit = pxe.Pxe(configs, options.verbosity)
+		bootit = Pxe(configs, data, options.verbosity)
+		bootit.setBootImage(host['mac_addr'], options.assignImage)
 		#bootit.createPxeUpdateFile(data.getPxeImages())
 		#bootit.updatePxe()
 		
@@ -534,21 +555,21 @@ def main():
 
 	if (options.showVlans):
 		data.showVlans()
-	if (options.addVlan):
-		print len(args)
-		if len(args) > 0:
-			data.addVlan(args[0], string.join(args[1:len(args)]))
-		else:
-			mesg = "USAGE: %s --addVlan vlanNumber [VlanDesc]\n" % (sys.argv[0])
-			sys.stdout.write(mesg)
-			exit()
-	if (options.removeVlan):
-		if len(args) > 1:
-			data.removeVlan(args[0])
-		else:
-			mesg = "USAGE: %s --removeVlan VlanNumber\n" % (sys.argv[0])
-			sys.stdout.write(mesg)
-			exit()
+	#if (options.addVlan):
+		#print len(args)
+		#if len(args) > 0:
+			#data.addVlan(args[0], string.join(args[1:len(args)]))
+		#else:
+			#mesg = "USAGE: %s --addVlan vlanNumber [VlanDesc]\n" % (sys.argv[0])
+			#sys.stdout.write(mesg)
+			#exit()
+	#if (options.removeVlan):
+		#if len(args) > 0:
+			#data.removeVlan(args[0])
+		#else:
+			#mesg = "USAGE: %s --removeVlan VlanNumber\n" % (sys.argv[0])
+			#sys.stdout.write(mesg)
+			#exit()
 
 	if (options.assignVlan):
 		print len(args)
@@ -562,8 +583,9 @@ def main():
 	#  Admin Interface
 	#  snmpwalk -v2c -c zoni-domain sw0-r1r1 .1.3.6.1.2.1.17.7.1.4.3.1.5    
 	if (options.ADMIN):
+			
 
-		if not options.nodeName and not  options.createVlanId and not options.removeVlanId and not options.switchPort and not options.interactiveSwitchConfig:
+		if not options.nodeName and not  options.createVlanId and not options.destroyVlanId and not options.switchPort and not options.interactiveSwitchConfig and not options.saveConfig:
 			mesg = "\nERROR:  nodeName or switch not specified.  Please specify nodename with -n or --nodeName or --switchport\n"
 			parser.print_help()
 			sys.stderr.write(mesg)
@@ -585,20 +607,42 @@ def main():
 		if options.verbosity:
 			hwswitch.setVerbose(True)
 
-		#print "create vlan", options.createVlanId
-		if options.enableHostPort and options.nodeName:
+		if options.setPortMode:
+			hwswitch.setPortMode(options.setPortMode)
+
+		if options.saveConfig:
+			hwswitch.saveConfig(options.saveConfig, data)
+		if options.labelPort:
+			mydesc = None
+			if len(args) > 0:
+				mydesc = " ".join(["%s" % i for i in args])
+			hwswitch.labelPort(mydesc)
+			
+		if options.enableHostPort and (options.nodeName or options.switchPort):
 			hwswitch.enableHostPort()
 		if options.disableHostPort and (options.nodeName or options.switchPort):
 			hwswitch.disableHostPort()
+		#  Create a new vlan on all switches and add to db
 		if options.createVlanId:
+			print options.createVlanId
 			hwswitch.createVlans(options.createVlanId, data.getAllSwitches(), data)
-		if options.removeVlanId:
-			hwswitch.removeVlans(options.removeVlanId, data.getAllSwitches(), data)
+			data.addVlan(options.createVlanId, string.join(args[1:len(args)]))
+		#  Remove vlan on all switches and remove from db
+		if options.destroyVlanId:
+			hwswitch.removeVlans(options.destroyVlanId, data.getAllSwitches(), data)
+			data.removeVlan(options.destroyVlanId)
 
 		if options.add2Vlan and (options.nodeName or options.switchPort):
-			hwswitch.addNodeToVlan(options.add2Vlan)
+			tag=None
+			vlan = options.add2Vlan
+			if ":" in options.add2Vlan:
+				print options.add2Vlan
+				vlan = options.add2Vlan.split(":")[0]
+				tag = options.add2Vlan.split(":")[1]
+
+			hwswitch.addNodeToVlan(vlan, tag)
 
-		if options.removeFromVlan and options.nodeName:
+		if options.removeFromVlan and (options.nodeName or options.switchPort): 
 			hwswitch.removeNodeFromVlan(options.removeFromVlan)
 		if options.setNative and (options.nodeName or options.switchPort):
 			hwswitch.setNativeVlan(options.setNative)

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/resourcequerysql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/resourcequerysql.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/resourcequerysql.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/resourcequerysql.py Wed Sep 28 23:26:41 2011
@@ -78,7 +78,7 @@ class ResourceQuerySql(InfoStore):
 	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)
+		result = self.selectDb(query)
 		if result.rowcount < 1:
 			mesg = "Reservation does not exist : %s" % (reservationId)
 			self.log.error(mesg)
@@ -94,7 +94,7 @@ class ResourceQuerySql(InfoStore):
 		domainKey = createKey(name)
 		query = "insert into domaininfo (domain_name, domain_desc, domain_key, reservation_id) values ('%s','%s', '%s', '%s')" % (name, desc, domainKey, reservationId)
 		try:
-			result = self.__insertDb(query)
+			result = self.insertDb(query)
 			mesg = "Adding domain %s(%s)" % (name, desc)
 			self.log.info(mesg)
 		except Exception, e:
@@ -112,7 +112,7 @@ class ResourceQuerySql(InfoStore):
 	def showDomains(self):
 		usermgt = eval("usermanagement.%s" % (self.config['userManagement']) + "()")
 		query = "select r.reservation_id, r.user_id, d.domain_name, d.domain_desc from domaininfo d, allocationinfo a, reservationinfo r where d.domain_id = a.domain_id and a.reservation_id = r.reservation_id"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		desc = result.description
 		if result.rowcount > 0:
 			print "%s\t%s\t%s\t%s" % (result.description[0][0], result.description[1][0], result.description[2][0], result.description[3][0])
@@ -126,7 +126,13 @@ class ResourceQuerySql(InfoStore):
 			self.log.info(mesg)
 			return -1
 
-	def addVlan(self, vnumber, desc=None):
+	def addVlan(self, vnum, desc=None):
+		vnumber = vnum
+		if ":" in vnum:
+			vnumber = vnum.split(":")[0]
+			desc = vnum.split(":")[1:len(vnumber)][0]
+			print vnumber, desc
+		
 		if desc == None:
 			desc = "Created by Zoni"
 		if int(vnumber) > self.vlan_max:
@@ -138,7 +144,7 @@ class ResourceQuerySql(InfoStore):
 			return -1
 		query = "insert into vlaninfo (vlan_num, vlan_desc) values ('%s','%s')" % (vnumber, desc)
 		try:
-			result = self.__insertDb(query)
+			result = self.insertDb(query)
 			mesg = "Adding vlan %s(%s)" % (vnumber, desc)
 			self.log.info(mesg)
 		except Exception, e:
@@ -162,7 +168,7 @@ class ResourceQuerySql(InfoStore):
 	def showVlans (self):
 		query = "select vlan_num, vlan_desc from vlaninfo order by vlan_num"
 		try:
-			result = self.__selectDb(query)
+			result = self.selectDb(query)
 			print "%s\t%s\n-------------------------------------" % (result.description[0][0], result.description[1][0])
 			for row in result.fetchall():
 				print "%s\t\t%s" % (row[0], row[1])
@@ -176,24 +182,24 @@ class ResourceQuerySql(InfoStore):
 		domainId = self.__getSomething("domain_id", "domaininfo", "domain_name", domain)
 		vlanId = self.__getSomething("vlan_id", "vlaninfo", "vlan_num", vlan)
 		query = "select * from domainmembermap m, vlaninfo v, domaininfo d where d.domain_id = '%s' and v.vlan_id = %s and v.vlan_id = m.vlan_id and m.domain_id = d.domain_id" % (int(domainId), int(vlanId))
-		if self.__selectDb(query).rowcount > 0:
+		if self.selectDb(query).rowcount > 0:
 			self.log.warning("Vlan %s already assigned to domain %s" % (vlan, domain));
 			return 0
 
 		# warning if vlan already assigned to another domain
 		query = "select * from domainmembermap where vlan_id = %s" % (vlanId)
-		if self.__selectDb(query).rowcount > 0:
+		if self.selectDb(query).rowcount > 0:
 			self.log.warning("Vlan %s already assigned to a domain" % (vlan));
 			if not force:
 				return -1
 
 		self.log.info("Assigning vlan %s to domain %s" % (vlan, domain))
 		query = "insert into domainmembermap (domain_id, vlan_id) values (%s, %s)" % (domainId, vlanId)
-		self.__insertDb(query)
+		self.insertDb(query)
 
 	def __getSomething(self, fieldname, table, critField, crit):
 		query = "select %s from %s where %s = '%s'" % (fieldname, table, critField, crit)
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount == 0:
 			mesg = "No entry for '%s' found" % (crit)
 			self.log.error(mesg)
@@ -207,7 +213,7 @@ class ResourceQuerySql(InfoStore):
 		if (colname2 != None and value2 != None):
 			cond += " and %s = '%s'" % (colname2, value2)
 		query = "select * from %s %s" % (table, cond)
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount == 0:
 			return []
 		return result.fetchall()
@@ -263,10 +269,10 @@ class ResourceQuerySql(InfoStore):
 		queryopt = self.__create_queryopts(cmdargs)				
 				
 		#query = "show fields from sysinfo"
-		#results = self.__selectDb(query)
+		#results = self.selectDb(query)
 		
 		query = "select " + defaultFields + "from sysinfo " + queryopt
-		result = self.__selectDb(query)	
+		result = self.selectDb(query)	
 
 		line = ""
 		for i in defaultFields.split(","):
@@ -285,14 +291,14 @@ class ResourceQuerySql(InfoStore):
 		#  Maybe should add a status flag?
 
 		query = "select sys_id from allocationinfo"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		allocatedNodes = []
 		if result.rowcount:
 			for i in result.fetchall()[0]:
 				allocatedNodes.append(i)
 
 		query = "select sys_id, location, num_procs, num_cores, mem_total, clock_speed, proc_model from sysinfo where state_id = 0 or state_id = 1"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		desc = result.description
 		res = {}
 		for i in result.fetchall():
@@ -312,7 +318,7 @@ class ResourceQuerySql(InfoStore):
 
 	def getMyResources(self, key):
 		query = "select s.sys_id, s.location, s.num_procs, s.num_cores, s.mem_total, s.clock_speed, s.proc_model from sysinfo s, allocationinfo a, domaininfo d where a.sys_id = s.sys_id and  a.domain_id = d.domain_id and d.domain_key = '%s'" % key
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		desc = result.description
 		res = {}
 		for i in result.fetchall():
@@ -340,7 +346,7 @@ class ResourceQuerySql(InfoStore):
 	
 	def getLocationFromSysId (self, nodeId):
 		query = "select location from sysinfo where sys_id = \"" + str(nodeId) + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		return result.fetchall()[0][0]
 
 	def getSysIdFromLocation(self, location):
@@ -348,19 +354,19 @@ class ResourceQuerySql(InfoStore):
 
 	def getMacFromSysId(self, nodeId):
 		query = "select mac_addr from sysinfo where sys_id = \"" + str(nodeId) + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		return result.fetchall()[0][0]
 
 	def getIpFromSysId(self, nodeId):
 		query = "select ip_addr from sysinfo where sys_id = \"" + str(nodeId) + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		return result.fetchall()[0][0]
 		
 
 	def getAllSwitches(self):
 		switchList = []
 		query = "select hw_name from hardwareinfo where hw_type = \"switch\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		for switch in result.fetchall():
 			switchList.append(switch[0])
 
@@ -369,7 +375,7 @@ class ResourceQuerySql(InfoStore):
 	def getAvailableVlan(self):
 		#  Get list of available vlans
 		query = "select vlan_num from vlaninfo where domain = 'private'"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		for vlan in result.fetchall()[0]:
 			avail = self.isVlanAvailable(vlan)
 			if avail:
@@ -382,7 +388,7 @@ class ResourceQuerySql(InfoStore):
 	
 	def isVlanAvailable(self, vlan):
 		query = "select a.vlan_id, v.vlan_num from allocationinfo a, vlaninfo v where a.vlan_id = v.vlan_id and v.vlan_num = " + str(vlan)
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount > 1:
 			return 0
 		else:
@@ -390,7 +396,7 @@ class ResourceQuerySql(InfoStore):
 
 	def getVlanId(self, vlan):
 		query = "select vlan_id from vlaninfo where vlan_num = \"" +  str(vlan) + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		#print result.rowcount 
 		if result.rowcount > 0:
 			return result.fetchall()[0][0]
@@ -402,7 +408,7 @@ class ResourceQuerySql(InfoStore):
 	def isIpAvailable(self, ip_addr, vlan_id):
 		query = "select * from allocationinfo where ip_addr = \"" + str(ip_addr) + "\" and vlan_id = \"" + str(vlan_id) + "\""
 		#print "query ", query
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		#print "select row count is ", result.rowcount
 		if result.rowcount > 0:
 			return 0
@@ -413,7 +419,7 @@ class ResourceQuerySql(InfoStore):
 	def getDomainIp(self, vlan):
 		ip_start = 30
 		query = "select ip_network from vlaninfo where vlan_num = " + str(vlan)
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		ip_network = result.fetchall()[0][0]
 		v = ip_network.split(".")
 		ip_base = v[0] + "." + v[1] + "." + v[2]
@@ -423,7 +429,7 @@ class ResourceQuerySql(InfoStore):
 		#print "ip is ", ip_network 
 
 		query = "select a.ip_addr from allocationinfo a, vlaninfo v where a.vlan_id = v.vlan_id and v.vlan_num = " + str(vlan);
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		#print "row count is ", result.rowcount
 		if result.rowcount > 0:
 			for ip in xrange(ip_start, 255):
@@ -465,7 +471,7 @@ class ResourceQuerySql(InfoStore):
 
 		query += "order by r.reservation_id asc, s.location"
 
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		
 		print "NODE ALLOCATION\n"
 		if self.verbose:
@@ -493,7 +499,7 @@ class ResourceQuerySql(InfoStore):
 			combined_notes = str(rnotes) + "|" + str(anotes)
 			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);
-				vlanRes = self.__selectDb(query)
+				vlanRes = self.selectDb(query)
 				vlanList = []
 				for i in vlanRes.fetchall():
 					vlanList.append(str(i[0]))
@@ -531,7 +537,7 @@ class ResourceQuerySql(InfoStore):
 
 		#query += "order by r.user_id, s.location"
 
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		
 		print "RESERVATIONS"
 		print "---------------------------------------------------------------------------------"
@@ -563,7 +569,7 @@ class ResourceQuerySql(InfoStore):
 	
 	def getPxeImages(self):
 		query = "select image_name from imageinfo"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		row = result.fetchall()
 		desc = result.description
 
@@ -576,13 +582,28 @@ class ResourceQuerySql(InfoStore):
 		
 	def showPxeImages(self):
 		query = "select image_name, dist, dist_ver  from imageinfo"
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		row = result.fetchall()
 		desc = result.description
 
 		for i in row:
 			print i
 
+	def getKernelOptions(self,image):
+		val = {}
+		query = "select i.image_name, k.kernel_name, k.kernel_arch, n.initrd_name, n.initrd_options from imageinfo i, kernelinfo k, initrdinfo n where k.kernel_id = i.kernel_id and i.initrd_id = n.initrd_id and i.image_name = '%s'" % image
+		result = self.selectDb(query)
+		row = result.fetchone()
+		desc = result.description
+		val[desc[0][0]] = row[0]
+		val[desc[1][0]] = row[1]
+		val[desc[2][0]] = row[2]
+		val[desc[3][0]] = row[3]
+		val[desc[4][0]] = row[4]
+		return val
+			
+		
+
 
 	def showPxeImagesToSystemMap(self, cmdargs):
 		extra = "j.image_id = i.image_id"
@@ -590,7 +611,7 @@ class ResourceQuerySql(InfoStore):
 
 		query = "select  s.location, s.mac_addr, i.image_name from sysinfo s , imageinfo i, imagemap j " + queryopt + " order by s.location"
 		#print query
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 
 		for i in result.fetchall():
 			print i
@@ -608,14 +629,15 @@ class ResourceQuerySql(InfoStore):
 	def getHostInfo(self, node):
 		host = {}
 		query = "select sys_id, mac_addr, num_procs, num_cores, mem_total, clock_speed, sys_vendor, sys_model, proc_vendor, proc_model, proc_cache, cpu_flags, bios_rev, location, system_serial_number, ip_addr from sysinfo where location = \"" + node + "\"" 
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount > 1:
-			print "Multiple entries for system exist.  Please correct"
-			return 
+			mesg = "Multiple entries for system exist.  Please correct"
+			self.log.info(mesg)
+			exit
 		if result.rowcount < 1:
 			mesg = "node does not exist :" + str(node) + "\n"
-			sys.stderr.write(mesg)
-			return 
+			self.log.error(mesg)
+			exit()
 		
 		for i in result.fetchall():
 			host['mac_addr'] = host.get("mac_addr", "")
@@ -642,7 +664,7 @@ class ResourceQuerySql(InfoStore):
 		
 		#  Get IPMI info
 		query = "select h.hw_userid, h.hw_password, h.hw_ipaddr from hardwareinfo h, portmap p, sysinfo s where p.sys_id = s.sys_id and h.hw_id = p.hw_id and h.hw_type = 'ipmi' and s.sys_id = " + str(host['sys_id']) + "" 
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount> 1:
 			print "Multiple entries for system exist.  Please correct"
 			return 
@@ -653,7 +675,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  Get image info
 		query = "select image_name from imagemap i, imageinfo j where i.image_id = j.image_id" 
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount == 0:
 			host['pxe_image_name'] = "None"
 		else:
@@ -662,7 +684,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  Get switch info
 		query = "select h.hw_id, h.hw_name, h.hw_model, h.hw_ipaddr, h.hw_userid, h.hw_password, p.port_num from hardwareinfo h, portmap p where p.hw_id = h.hw_id and hw_type = 'switch' and sys_id = " +  str(host['sys_id'])
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		for i in result.fetchall():
 			host['hw_id'] = int(i[0])
 			host['hw_name'] = i[1]
@@ -674,7 +696,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  Get drac info
 		query = "select h.hw_id, h.hw_name, h.hw_model, h.hw_ipaddr, h.hw_userid, h.hw_password, p.port_num from hardwareinfo h, portmap p where p.hw_id = h.hw_id and hw_type = 'drac' and sys_id = " +  str(host['sys_id'])
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount > 0:
 			for i in result.fetchall():
 				host['drac_id'] = int(i[0])
@@ -687,7 +709,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  Get PDU info
 		query = "select h.hw_id, h.hw_name, h.hw_model, h.hw_ipaddr, h.hw_userid, h.hw_password, p.port_num from hardwareinfo h, portmap p where p.hw_id = h.hw_id and h.hw_type = 'pdu' and p.sys_id = " +  str(host['sys_id'])
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		for i in result.fetchall():
 			host['pdu_id'] = int(i[0])
 			host['pdu_name'] = i[1]
@@ -706,7 +728,7 @@ class ResourceQuerySql(InfoStore):
 		#  Get switch info
 		#switchList = self.getAllSwitches()
 		query = "select h.hw_id, h.hw_name, h.hw_model, h.hw_ipaddr, h.hw_userid, h.hw_password from hardwareinfo h where h.hw_name  = \"" +  str(switchName) + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		for i in result.fetchall():
 			host['hw_id'] = int(i[0])
 			host['hw_name'] = i[1]
@@ -746,7 +768,7 @@ class ResourceQuerySql(InfoStore):
 			return 
 		return cursor
 
-	def __selectDb(self, query):
+	def selectDb(self, query):
 		self.conn.ping(True)
 		cursor = self.conn.cursor()
 		try:
@@ -788,7 +810,7 @@ class ResourceQuerySql(InfoStore):
 			return -1
 		return cursor
 
-	def __insertDb(self, query):
+	def insertDb(self, query):
 		self.conn.ping(True)
 		cursor = self.conn.cursor()
 		try:
@@ -870,10 +892,10 @@ class ResourceQuerySql(InfoStore):
 		query = "insert into reservationinfo (user_id, reservation_expiration, notes) values ('%s', '%s', '%s')" % (str(userId), str(expireDate), str(reservationNotes))
 		mesg = "Creating new reservation : %s" % query
 		self.log.info(mesg)
-		self.__insertDb(query)
+		self.insertDb(query)
 		#  Get the res_id
 		query = "select max(reservation_id) from reservationinfo"
-		res_id = self.__selectDb(query).fetchone()[0]
+		res_id = self.selectDb(query).fetchone()[0]
 		mesg = "  Reservation created - ID : %s" % str(res_id)
 		self.log.info(mesg)
 
@@ -890,7 +912,7 @@ class ResourceQuerySql(InfoStore):
 				#str(user_id) + "\", \"" + str(reservation_type) + "\", \"" + \
 				#str(combined_notes) + "\")" 
 #
-		#self.__insertDb(query)
+		#self.insertDb(query)
 
 	def allocateNode(self, reservationId, domain, sysId, vlanInfo, imageName, notes=None):
 		print "reservationId", reservationId, domain, sysId, vlanInfo, imageName, notes
@@ -935,7 +957,7 @@ class ResourceQuerySql(InfoStore):
 		mesg = "allocateNode %s : domain %s : reservation %s(%s)" % (nodeName, domain, reservationId, resinfo[4])
 		self.log.info(mesg)
 		query = "insert into allocationinfo (sys_id, reservation_id, domain_id, notes) values ('%s', '%s', '%s', '%s')" % (sysId, reservationId, domainId, notes)
-		result = self.__insertDb(query)
+		result = self.insertDb(query)
 		allocationId = result.lastrowid
 
 		#  Parse vlan info and add to vlanmembermap
@@ -945,13 +967,13 @@ class ResourceQuerySql(InfoStore):
 			vId = self.getVlanId(v)
 			t = i.split(":")[1]
 			query = "insert into vlanmembermap (allocation_id, vlan_id, vlan_type) values ('%s', '%s', '%s')" % (allocationId, vId, t)
-			result = self.__insertDb(query)
+			result = self.insertDb(query)
 			mesg = "Adding vlan %s to node %s" % (v, nodeName)
 			self.log.info(mesg)
 
 		#  Insert into imagemap
 		query = "insert into imagemap (allocation_id, image_id) values ('%s', '%s')" % (allocationId, imageId)
-		result = self.__insertDb(query)
+		result = self.insertDb(query)
 	
 		self.__updateSysState(sysId, 1)
 
@@ -962,12 +984,14 @@ class ResourceQuerySql(InfoStore):
 
 	def rgasstest(self, vlan_num):
 		query = "select * from vlaninfo where vlan_num = " + vlan_num
-		res = self.__selectDb(query).fetchall()
+		res = self.selectDb(query).fetchall()
 		print res
 		
 		
 			
 	def removeReservation(self, res):
+		mesg = "Removing reservation (%s)" % str(res)
+		self.log.info(mesg)
 		query = "delete from reservationinfo where reservation_id = " + str(res)
 		self.__updateDb(query)
 		query = "delete from allocationinfo where reservation_id = " + str(res)
@@ -978,7 +1002,7 @@ class ResourceQuerySql(InfoStore):
 		#  Get the nodeId
 		sysId = self.__getSomething("sys_id", "sysinfo", "location", location)
 		query = "select * from allocationinfo where sys_id = '%s'" % (sysId)
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount == 0:
 			mesg = "Node %s not allocated" % (location)
 			self.log.error(mesg)
@@ -1008,7 +1032,7 @@ class ResourceQuerySql(InfoStore):
 			dist_ver = imageName.split(":")[2]
 
 		query = "select * from imageinfo where image_name = \"" + name + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount > 0:
 			mesg = "ERROR:  Image already exists\n"
 			sys.stderr.write(mesg)
@@ -1023,7 +1047,7 @@ class ResourceQuerySql(InfoStore):
 			return 
 
 		query = "insert into imageinfo (image_name, dist, dist_ver) values(\"" + name + "\", \"" + dist + "\", \"" + dist_ver + "\")"
-		self.__insertDb(query)
+		self.insertDb(query)
 
 
 	def delImage(self, imageName):
@@ -1050,7 +1074,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  check for entry and delete in exists
 		query = "select * from imagemap where mac_addr = \"" + host['mac_addr'] + "\""
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		if result.rowcount > 0:
 			query = "delete from imagemap where mac_addr = \"" + host['mac_addr'] + "\""
 			result = self.__deleteDb(query)
@@ -1058,7 +1082,7 @@ class ResourceQuerySql(InfoStore):
 
 		#  update the database entry with the new image for the host
 		query = "insert into imagemap (mac_addr, image_id) values (\"" + host['mac_addr'] + "\", " + new_image_id + ")"
-		self.__insertDb(query)
+		self.insertDb(query)
 		
 
 		#  Update tftp link
@@ -1104,7 +1128,7 @@ class ResourceQuerySql(InfoStore):
 
 		sysId = self.getSysIdFromLocation(nodeName)	
 		query = "select h.hw_type, h.hw_userid, h.hw_password from hardwareinfo h, portmap p where p.hw_id = h.hw_id and p.sys_id = '%s'" % sysId
-		result = self.__selectDb(query)
+		result = self.selectDb(query)
 		cap = []
 		val = []
 		for i in result.fetchall():
@@ -1151,7 +1175,7 @@ class ResourceQuerySql(InfoStore):
 					statement += "'" + i + "') "
 				count += 1
 			try:
-				self.__insertDb(statement)
+				self.insertDb(statement)
 				mesg = "Device (%s) registered successfully\n" % (data['hw_name'])
 				self.log.info(mesg)
 			except Exception, e:

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/usermanagement.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/usermanagement.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/usermanagement.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/data/usermanagement.py Wed Sep 28 23:26:41 2011
@@ -111,11 +111,31 @@ class ldap(UserManagementInterface):
 
 class files(UserManagementInterface):
 	def __init__(self):
-		raise NotImplementedError
+		pass
 
 
-	def getUserId(self):
-		raise NotImplementedError
+	def getUserId(self, userName=None):
+		if userName == None:
+			return os.getuid()
+		cmd = "cat /etc/passwd "
+		a = os.popen(cmd)
+		for line in a.readlines():
+			if userName in line :
+				return line.split(":")[2]
+		return 0
+
+
+	def getUserName(self, userId=None):
+		if userId == None:
+			return os.getenv('USERNAME')
+		cmd = "cat /etc/passwd "
+		a = os.popen(cmd)
+		for line in a.readlines():
+			if userName in line :
+				return line.split(":")[0]
+
+		return 0
+
 
 	def getGroupId(self):
-		raise NotImplementedError
+		pass

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/extra/util.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/extra/util.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/extra/util.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/extra/util.py Wed Sep 28 23:26:41 2011
@@ -41,6 +41,7 @@ def loadConfigFile(parser):
 	#  Management
 	config['userManagement'] = parser.get("management", "USER_MANAGEMENT").split()[0]
 	config['infoStore'] = parser.get("management", "INFO_STORE").split()[0]
+	config['pickleFile'] = parser.get("management", "PICKLE_FILE").split()[0]
 	
 	#  DB connection
 	config['dbUser'] = parser.get("dbConnection", "DB_USER").split()[0]
@@ -60,6 +61,7 @@ def loadConfigFile(parser):
 	config['tftpBaseMenuFile'] = parser.get("pxe", "TFTP_BASE_MENU_FILE").split()[0]
 	config['pxeServerIP'] = parser.get("pxe", "PXE_SERVER_IP").split()[0]
 	config['initrdRoot'] = parser.get("pxe", "INITRD_ROOT").split()[0]
+	config['kernelRoot'] = parser.get("pxe", "KERNEL_ROOT").split()[0]
 
 	#  Image store
 	config['imageServerIP'] = parser.get("imageStore", "IMAGE_SERVER_IP").split()[0]

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/dellswitch.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/dellswitch.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/dellswitch.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/dellswitch.py Wed Sep 28 23:26:41 2011
@@ -48,6 +48,11 @@ class HwDellSwitch(HwSwitchInterface):
 		self.verbose = False
 		self.log = logging.getLogger(os.path.basename(__file__))
 
+		try:
+			self.switchModel = host['hw_model']
+		except:
+			pass
+
 
  	def setVerbose(self, verbose):
 		self.verbose = verbose
@@ -68,7 +73,14 @@ class HwDellSwitch(HwSwitchInterface):
 		if self.verbose:
 			child.logfile = sys.stdout
 
-		opt = child.expect(['Name:', 'assword:', 'Are you sure.*', 'User:', pexpect.EOF, pexpect.TIMEOUT])
+		opt = child.expect(['Name:', 'assword:', 'Are you sure.*', 'User:', 'No route to host', pexpect.EOF, pexpect.TIMEOUT])
+
+		#  Unable to connect
+		if opt == 4:
+			mesg = "ERROR:  Login to %s failed\n" % (self.host['hw_name'])
+			self.log.error(mesg)
+			exit(1)
+			
 		#XXX  Doesn't seem to do what I want:(
 		child.setecho(False)
 
@@ -92,6 +104,8 @@ class HwDellSwitch(HwSwitchInterface):
 			child.sendline(self.host['hw_password'])
 			i=child.expect(['console','>', 'Name:', pexpect.EOF, pexpect.TIMEOUT])
 			#  on the 6448 dell, need to send enable, just send to all
+		
+		if opt == 1 or opt == 3:
 			child.sendline('enable')
 			i=child.expect(['#', pexpect.EOF, pexpect.TIMEOUT])
 
@@ -101,26 +115,51 @@ class HwDellSwitch(HwSwitchInterface):
 		dadate = datetime.datetime.now().strftime("%Y%m%d-%H%M-%S")
 		return "Zoni_" + dadate
 
+	def __genPortName(self, port):
+		if "62" in self.switchModel:
+			return "1/g%s" % str(port)
+		elif "54" in self.switchModel:
+			return "g%s" % str(port)
+		else:
+			return "g%s" % str(port)
+
+	def labelPort(self, desc=None):
+		mydesc = "%s-%s" % (self.host['location'], desc)
+		if desc == None or desc == " ":
+			mydesc = "%s" % (self.host['location'])
+		child = self.__login()
+		child.sendline('config')
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
+		child.sendline(cmd)
+		cmd = "description \"%s\"" % mydesc
+		child.sendline(cmd)
+		child.sendline('exit')
+		child.terminate()
 	
 	def enableHostPort(self):
 		child = self.__login()
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
 		cmd = "no shutdown" 
 		child.sendline(cmd)
 		child.sendline('exit')
 		child.terminate()
+		self.log.info("Host port enabled %s:%s" % (self.host['hw_name'], self.host['hw_port']))
 		
 	def disableHostPort(self):
 		child = self.__login()
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
 		cmd = "shutdown"
 		child.sendline(cmd)
 		child.sendline('exit')
 		child.terminate()
+		self.log.info("Host port disabled %s:%s" % (self.host['hw_name'], self.host['hw_port']))
 
 	def removeVlan(self, num):
 		#  Check for important vlans
@@ -132,6 +171,7 @@ class HwDellSwitch(HwSwitchInterface):
 		child.sendline(cmd)
 		child.sendline('exit')
 		child.terminate()
+		self.log.info("Vlan %s removed from switch %s" % (num, self.host['hw_name']))
 	
 	def addVlanToTrunk(self, vlan):
 		mesg = "Adding Vlan %s to trunks on switch" % (vlan)
@@ -230,24 +270,32 @@ class HwDellSwitch(HwSwitchInterface):
 
 		child.terminate()
 
-	def addNodeToVlan(self, vlan):
-		mesg = "Adding Node to vlan %s" % (str(vlan))
+	def addNodeToVlan(self, 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)
 		
 		child = self.__login()
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
 		child.expect(["config-if", pexpect.EOF])
-		cmd = "switchport trunk allowed vlan add " + vlan
+		#cmd = "switchport trunk allowed vlan add " + vlan
+		cmd = "switchport mode general"
+		child.sendline(cmd)
+		cmd = "switchport general allowed vlan add %s %s" % (str(vlan), str(tag))
 		child.sendline(cmd)
-		child.sendline('exit')
 
 		NOVLAN = "VLAN was not created by user."
-		i=child.expect(['config-if',NOVLAN, pexpect.EOF, pexpect.TIMEOUT])
+		#  XXX this has problems with 62xx switches.  Need to catch the error if a vlan doesn't exist. 
+		#  Currently you can leave out the 'config-if' and it will work but will require you to wait for 
+		#  the timeout when you finally create and add the node to the vlan.  Leaving out support for 62xx switches
+		#  for now.
+		NOVLAN62 = "ERROR"
+		i=child.expect(['config-if',NOVLAN, NOVLAN62, pexpect.EOF, pexpect.TIMEOUT])
 		#  Vlan must exist in order to add a host to it.  
 		#  If it doesn't exist, try to create it
-		if i == 1:
+		if i == 1 or i == 2:
 			self.log.warning("WARNING:  Vlan %sdoesn't exist, trying to create" % (vlan))
 			#  Add a tag showing this was created by PRS
 			newvlan = vlan + ":" + self.__getPrsLabel()
@@ -259,13 +307,14 @@ class HwDellSwitch(HwSwitchInterface):
 		child.terminate()
 
 	def removeNodeFromVlan(self, vlan):
-		mesg = "Removing Node from vlan %s" % (str(vlan))
+		mesg = "Removing switchport (%s:%s) from vlan %s" % (str(self.host['hw_name']), str(self.host['hw_port']), str(vlan))
 		self.log.info(mesg)
 		child = self.__login()
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
-		cmd = "switchport trunk allowed vlan remove " + vlan
+		cmd = "switchport general allowed vlan remove " + vlan
 		child.sendline(cmd)
 		child.sendline('exit')
 		child.sendline('exit')
@@ -284,19 +333,37 @@ class HwDellSwitch(HwSwitchInterface):
 			##self.createVlan(newvlan)
 			##self.setNativeVlan(vlan)
 			
+	def setPortMode (self, mode):
+		child = self.__login()
+		child.logfile = sys.stdout
+		child.sendline('config')
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
+		child.sendline(cmd)
+		i=child.expect(['config-if', pexpect.EOF, pexpect.TIMEOUT])
+		if i > 0:
+			self.log.error("setPortMode %s failed" % (cmd))
+
+		cmd = "switchport mode %s" % mode
+		child.sendline(cmd)
+		i=child.expect(['config-if', pexpect.EOF, pexpect.TIMEOUT])
+		child.sendline('exit')
+		child.sendline('exit')
+		child.terminate()
 
 	def setNativeVlan(self, vlan):
 		child = self.__login()
 		child.logfile = sys.stdout
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
 		i=child.expect(['config-if', pexpect.EOF, pexpect.TIMEOUT])
 		if i > 0:
 			self.log.error("setNativeVlan %s failed" % (cmd))
 
 		NOVLAN = "VLAN was not created by user."
-		cmd = "switchport trunk native vlan " + vlan
+		cmd = "switchport general pvid " + vlan
 		child.sendline(cmd)
 		i=child.expect(['config-if', NOVLAN, pexpect.EOF, pexpect.TIMEOUT])
 		#  Vlan must exist in order to add a host to it.  
@@ -313,19 +380,22 @@ class HwDellSwitch(HwSwitchInterface):
 		child.terminate()
 
 	#  Restore Native Vlan.  In Dell's case, this is vlan 1
-	def restoreNativeVlan(self):
-		child = self.__login()
-		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
-		child.sendline(cmd)
-		cmd = "switchport trunk native vlan 1"
-		child.sendline(cmd)
-		child.sendline('exit')
-		child.sendline('exit')
+	#  Removing this 
+	#def restoreNativeVlan(self):
+		#child = self.__login()
+		#child.sendline('config')
+		#portname = self.__genPortName(self.host['hw_port'])
+		#cmd = "interface ethernet %s" % str(portname)
+		#child.sendline(cmd)
+		##cmd = "switchport trunk native vlan 1"
+		#cmd = "switchport general pvid 1"
+		#child.sendline(cmd)
+		#child.sendline('exit')
+		#child.sendline('exit')
+		##child.terminate()
 		#child.terminate()
-		child.terminate()
 
-	#  Setup the switch for node allocation
+	##  Setup the switch for node allocation
 	def allocateNode(self):
 		pass
 
@@ -334,7 +404,8 @@ class HwDellSwitch(HwSwitchInterface):
 		child = self.__login()
 		child.logfile = sys.stdout
 		child.sendline('config')
-		cmd = "interface ethernet g" + str(self.host['hw_port'])
+		portname = self.__genPortName(self.host['hw_port'])
+		cmd = "interface ethernet %s" % str(portname)
 		child.sendline(cmd)
 		i=child.expect(['config-if', pexpect.EOF, pexpect.TIMEOUT])
 		if i > 0:
@@ -360,9 +431,16 @@ class HwDellSwitch(HwSwitchInterface):
 		print "NODE   - " + self.host['location']
 		print "------------------------------------\n"
 		child.logfile = sys.stdout
-		cmd = "show interface switchport ethernet g" + str(self.host['hw_port'])
+		
+		portname = self.__genPortName(self.host['hw_port'])
+
+		cmd = "show interface switchport ethernet %s" % str(portname)
 		child.sendline(cmd)
-		i = child.expect(['#', pexpect.EOF, pexpect.TIMEOUT])
+		i = child.expect(['#','--More--', pexpect.EOF, pexpect.TIMEOUT])
+		#  send a space for more
+		while i == 1:
+			child.sendline(" ")
+			i = child.expect(['#','--More--', pexpect.EOF, pexpect.TIMEOUT])
 		child.terminate()
 
 	def interactiveSwitchConfig(self):
@@ -375,6 +453,23 @@ class HwDellSwitch(HwSwitchInterface):
 		#child.logfile = sys.stdout
 		child.sendline(self.host['hw_password'])
 		child.interact(escape_character='\x1d', input_filter=None, output_filter=None)
+
+	def saveConfig(self, switch, query):
+		self.host = query.getSwitchInfo(switch)
+		child = self.__login()
+		cmd = "copy running-config startup-config"
+		child.sendline(cmd)
+		i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
+		child.sendline("y")
+		child.terminate()
+
+	def __saveConfig(self):
+		cmd = "copy running-config startup-config"
+		child.sendline(cmd)
+		i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
+		child.sendline("y")
+		child.terminate()
+
 	
 	def registerToZoni(self, user, password, host):
 		self.setVerbose(True)

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/hwswitchinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/hwswitchinterface.py?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/hwswitchinterface.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/hwswitchinterface.py Wed Sep 28 23:26:41 2011
@@ -48,7 +48,7 @@ class HwSwitchInterface(object):
 	def createVlan(self, vlan):
 		raise NotImplementedError
 
-	def addNode2Vlan(self, vlan):
+	def addNode2Vlan(self, vlan, taginfo):
 		raise NotImplementedError
 
 	def removeNodeFromVlan(self, vlan):

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/register/register_node
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/register/register_node?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/register/register_node (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/register/register_node Wed Sep 28 23:26:41 2011
@@ -41,6 +41,9 @@ for x in $(cat /proc/cmdline); do
     zoniroot=*)
         ZONIROOT=${x#zoniroot=}
         ;;
+    configipmi=*)
+        CONFIGIPMI=${x#configipmi=}
+        ;;
     verbose=*)
         VERBOSE=${x#verbose=}
         ;;
@@ -127,7 +130,7 @@ DEBUG DISK_INFO - ${DISK_INFO}
 
 #  Register sysinfo to DB
 DEBUG "wget -O- http://${IMAGE_URL}/zoni-register.php?action=register_system&mac=$MAC&mod_mac=$MOD_MAC&sys_model=$SYS_MODEL&bios_rev=$BIOS_REV&system_serial_number=$SYSTEM_SERIAL_NUMBER&chassis_serial_number=${CHASSIS_SERIAL_NUMBER}&system_uuid=$SYSTEM_UUID&sys_vendor=$SYS_VENDOR&proc_vendor=$PROC_VENDOR&proc_model=$PROC_MODEL&clock_speed=$CLOCK_SPEED&proc_cache=$PROC_CACHE&num_procs=$NUM_PROCS&num_cores=$NUM_CORES&mem_total=$MEM_TOTAL&cpu_flags=$CPU_FLAGS&num_disks=${NUM_DISKS}&disk_info=${DISK_INFO}"
-wget "http://${IMAGE_URL}/zoni-register.php?action=register_system&mac=$MAC&mod_mac=$MOD_MAC&sys_model=$SYS_MODEL&bios_rev=$BIOS_REV&system_serial_number=$SYSTEM_SERIAL_NUMBER&chassis_serial_number=${CHASSIS_SERIAL_NUMBER}&system_uuid=$SYSTEM_UUID&sys_vendor=$SYS_VENDOR&proc_vendor=$PROC_VENDOR&proc_model=$PROC_MODEL&clock_speed=$CLOCK_SPEED&proc_cache=$PROC_CACHE&num_procs=$NUM_PROCS&num_cores=$NUM_CORES&mem_total=$MEM_TOTAL&cpu_flags=$CPU_FLAGS&num_disks=${NUM_DISKS}&disk_info=${DISK_INFO}"
+wget -O- "http://${IMAGE_URL}/zoni-register.php?action=register_system&mac=$MAC&mod_mac=$MOD_MAC&sys_model=$SYS_MODEL&bios_rev=$BIOS_REV&system_serial_number=$SYSTEM_SERIAL_NUMBER&chassis_serial_number=${CHASSIS_SERIAL_NUMBER}&system_uuid=$SYSTEM_UUID&sys_vendor=$SYS_VENDOR&proc_vendor=$PROC_VENDOR&proc_model=$PROC_MODEL&clock_speed=$CLOCK_SPEED&proc_cache=$PROC_CACHE&num_procs=$NUM_PROCS&num_cores=$NUM_CORES&mem_total=$MEM_TOTAL&cpu_flags=$CPU_FLAGS&num_disks=${NUM_DISKS}&disk_info=${DISK_INFO}"
 
 #  Get more info either from cheat file or from user entered info
 ec=1
@@ -229,55 +232,59 @@ fi
 
 #  Setup the management interface, if any
 
-#  Check for ipmi
-#  Check for the existance of the module.  
-cat /proc/modules | grep ipmi_si 
-if [ $? -eq 0 ];then 
-	#  Assigning IP address to IPMI card since they don't seem to every accept an address from DHCP
-	#  Subnet is selected from config file
-	#  Get IPMI card mac address
-	ipmi_mac=$(ipmitool lan print |  grep -i "MAC Address" | awk -F ": " '{print $2}')
-	ipmi_ver=$(ipmitool mc info |  grep -i "IPMI Version" | awk -F ": " '{print $2}')
-	ipmi_rev=$(ipmitool mc info |  grep -i "Firmware Revision" | awk -F ": " '{print $2}')
-
-	vlan_disable=$(ipmitool lan print |  grep -i "Vlan" | awk -F ": " '{print $2}')
-
-	#  Add IPMI info 
-	echo "wget -O/outfile.txt 'http://${IMAGE_URL}/zoni-register.php?action=add_ipmi&verbose=${VERBOSE}&mac=$MAC&location=${location}&ip_addr=${IPADDR}&ipmi_mac=${ipmi_mac}&ipmi_ver=${ipmi_ver}&ipmi_rev=${ipmi_rev}'"
-	wget -O/outfile.txt "http://${IMAGE_URL}/zoni-register.php?action=add_ipmi&verbose=${VERBOSE}&mac=$MAC&location=${location}&ip_addr=${IPADDR}&ipmi_mac=${ipmi_mac}&ipmi_ver=${ipmi_ver}&ipmi_rev=${ipmi_rev}"
-	IPMI_ADDR=$(cat /outfile.txt | grep IPMI_ADDR | awk '{print $2}')
-	IPMI_PASSWORD=$(cat /outfile.txt | grep IPMI_PASSWORD | awk '{print $2}')
-	IPMI_DOMAIN=$(cat /outfile.txt | grep IPMI_DOMAIN| awk '{print $2}')
-	IPMI_NETMASK=$(cat /outfile.txt | grep IPMI_NETMASK| awk '{print $2}')
-	IPMI_GATEWAY=$(cat /outfile.txt | grep IPMI_GATEWAY| awk '{print $2}')
-
-
-	
-	if [ ${IPMI_DOMAIN} -eq 1 ];then 
-		IPMI_DOMAIN="off"
+if [ $configipmi ] && [ $configipmi -eq 1 ];then 
+
+	#  Check for ipmi
+	#  Check for the existance of the module.  
+	cat /proc/modules | grep ipmi_si 
+	if [ $? -eq 0 ];then 
+		#  Assigning IP address to IPMI card since they don't seem to every accept an address from DHCP
+		#  Subnet is selected from config file
+		#  Get IPMI card mac address
+		ipmi_mac=$(ipmitool lan print |  grep -i "MAC Address" | awk -F ": " '{print $2}')
+		ipmi_ver=$(ipmitool mc info |  grep -i "IPMI Version" | awk -F ": " '{print $2}')
+		ipmi_rev=$(ipmitool mc info |  grep -i "Firmware Revision" | awk -F ": " '{print $2}')
+
+		vlan_disable=$(ipmitool lan print |  grep -i "Vlan" | awk -F ": " '{print $2}')
+
+		#  Add IPMI info 
+		echo "wget -O/outfile.txt 'http://${IMAGE_URL}/zoni-register.php?action=add_ipmi&verbose=${VERBOSE}&mac=$MAC&location=${location}&ip_addr=${IPADDR}&ipmi_mac=${ipmi_mac}&ipmi_ver=${ipmi_ver}&ipmi_rev=${ipmi_rev}'"
+		wget -O/outfile.txt "http://${IMAGE_URL}/zoni-register.php?action=add_ipmi&verbose=${VERBOSE}&mac=$MAC&location=${location}&ip_addr=${IPADDR}&ipmi_mac=${ipmi_mac}&ipmi_ver=${ipmi_ver}&ipmi_rev=${ipmi_rev}"
+		IPMI_ADDR=$(cat /outfile.txt | grep IPMI_ADDR | awk '{print $2}')
+		IPMI_PASSWORD=$(cat /outfile.txt | grep IPMI_PASSWORD | awk '{print $2}')
+		IPMI_DOMAIN=$(cat /outfile.txt | grep IPMI_DOMAIN| awk '{print $2}')
+		IPMI_NETMASK=$(cat /outfile.txt | grep IPMI_NETMASK| awk '{print $2}')
+		IPMI_GATEWAY=$(cat /outfile.txt | grep IPMI_GATEWAY| awk '{print $2}')
+
+
+		
+		if [ ${IPMI_DOMAIN} -eq 1 ];then 
+			IPMI_DOMAIN="off"
+		fi
+		DEBUG "ip $IPMI_ADDR pass $IPMI_PASSWORD domain $IPMI_DOMAIN netmask $IPMI_NETMASK gateway $IPMI_GATEWAY "
+		ipmitool lan set 1 ipsrc static
+		ipmitool lan set 1 ipaddr ${IPMI_ADDR}
+		ipmitool lan set 1 vlan id ${IPMI_DOMAIN}
+		ipmitool lan set 1 defgw ipaddr ${IPMI_GATEWAY}
+		ipmitool lan set 1 netmask ${IPMI_NETMASK}
+		ipmitool lan set 1 password ${IPMI_PASSWORD}
+		ipmitool lan set 1 access on
+
+		#  Make user 2 be root with random password
+		ipmitool user set name 2 root
+		ipmitool user set password 2 $IPMI_PASSWORD
+		ipmitool channel setaccess 1 2 callin=on ipmi=on link=on privilege=4
+		ipmitool user enable 2
+
+		#Already done in add_ipmi
+		#DEBUG "adding to dhcp and dns"
+		#DEBUG "wget -O- http://${IMAGE_URL}/zoni-register.php?action=updatednsdhcp&verbose=${VERBOSE}&mac=${ipmi_mac}&location=${location}$&ip_addr=${IPMI_ADDR}"
+		#wget -O- "http://${IMAGE_URL}/zoni-register.php?action=updatednsdhcp&verbose=${VERBOSE}&mac=${ipmi_mac}&location=${location}&ip_addr=${IPMI_ADDR}"
+
+	else
+		DEBUG "IPMI interface not found"
 	fi
-	DEBUG "ip $IPMI_ADDR pass $IPMI_PASSWORD domain $IPMI_DOMAIN netmask $IPMI_NETMASK gateway $IPMI_GATEWAY "
-	ipmitool lan set 1 ipsrc static
-	ipmitool lan set 1 ipaddr ${IPMI_ADDR}
-	ipmitool lan set 1 vlan id ${IPMI_DOMAIN}
-	ipmitool lan set 1 defgw ipaddr ${IPMI_GATEWAY}
-	ipmitool lan set 1 netmask ${IPMI_NETMASK}
-	ipmitool lan set 1 password ${IPMI_PASSWORD}
-	ipmitool lan set 1 access on
-
-	#  Make user 2 be root with random password
-	ipmitool user set name 2 root
-	ipmitool user set password 2 $IPMI_PASSWORD
-	ipmitool channel setaccess 1 2 callin=on ipmi=on link=on privilege=4
-	ipmitool user enable 2
-
-	#Already done in add_ipmi
-	#DEBUG "adding to dhcp and dns"
-	#DEBUG "wget -O- http://${IMAGE_URL}/zoni-register.php?action=updatednsdhcp&verbose=${VERBOSE}&mac=${ipmi_mac}&location=${location}$&ip_addr=${IPMI_ADDR}"
-	#wget -O- "http://${IMAGE_URL}/zoni-register.php?action=updatednsdhcp&verbose=${VERBOSE}&mac=${ipmi_mac}&location=${location}&ip_addr=${IPMI_ADDR}"
 
-else
-	DEBUG "IPMI interface not found"
 fi
 
 

Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/www/zoni-register.php
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/www/zoni-register.php?rev=1177105&r1=1177104&r2=1177105&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/www/zoni-register.php (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/system/registration/www/zoni-register.php Wed Sep 28 23:26:41 2011
@@ -167,7 +167,8 @@
 			$query .= "bios_rev = '$bios_rev', ";
 			$query .= "chassis_serial_number = '$chassis_serial_number', ";
 			$query .= "system_uuid = '$system_uuid', ";
-            $query .= "cpu_flags = '$cpu_flags' ";
+            $query .= "cpu_flags = '$cpu_flags', ";
+			$query .= "last_update = now() ";
             $query .= " where system_serial_number = '$system_serial_number'";
             DEBUG($verbose, "<br>query is $query <br>\n");
 			file_put_contents("/tmp/updatequery.txt", $query);