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/10/06 22:47:11 UTC

svn commit: r1179892 - in /incubator/tashi/trunk/src/zoni: bootstrap/ client/ data/ extra/ system/registration/register/ system/registration/www/ system/registration/www/include/

Author: rgass
Date: Thu Oct  6 22:47:11 2011
New Revision: 1179892

URL: http://svn.apache.org/viewvc?rev=1179892&view=rev
Log:
change registration scripts to use only /bin/sh.
Add some debuging to the registration process
adding reservation templates.  Need to move stuff over later
adding support to write pxe tftpfiles 


Added:
    incubator/tashi/trunk/src/zoni/data/reservation.py
    incubator/tashi/trunk/src/zoni/data/reservationmanagementinterface.py
Modified:
    incubator/tashi/trunk/src/zoni/bootstrap/pxe.py
    incubator/tashi/trunk/src/zoni/client/zoni-cli.py
    incubator/tashi/trunk/src/zoni/data/resourcequerysql.py
    incubator/tashi/trunk/src/zoni/data/usermanagement.py
    incubator/tashi/trunk/src/zoni/extra/util.py
    incubator/tashi/trunk/src/zoni/system/registration/register/register_automate
    incubator/tashi/trunk/src/zoni/system/registration/register/register_node
    incubator/tashi/trunk/src/zoni/system/registration/www/include/zoni_functions.php
    incubator/tashi/trunk/src/zoni/system/registration/www/zoni-register.php

Modified: incubator/tashi/trunk/src/zoni/bootstrap/pxe.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/bootstrap/pxe.py?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/bootstrap/pxe.py (original)
+++ incubator/tashi/trunk/src/zoni/bootstrap/pxe.py Thu Oct  6 22:47:11 2011
@@ -115,8 +115,9 @@ class Pxe(BootStrapInterface):
 		#  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 += "TIMEOUT 2\n"
 		val += "PROMPT 0\n"
+		val += "MENU BACKGROUND boot-screens/zoni_pxe.jpg\n"
 		
 		val += "MENU COLOR border 49;37 #00FFFFFF #00FFFFFF none\n"
 		val += "MENU INCLUDE %s-menu\n" % imagedir

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=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/client/zoni-cli.py (original)
+++ incubator/tashi/trunk/src/zoni/client/zoni-cli.py Thu Oct  6 22:47:11 2011
@@ -27,6 +27,7 @@ import socket
 import logging.config
 import getpass
 import re
+import subprocess
 
 
 
@@ -443,7 +444,7 @@ def main():
 			host = data.getHostInfo(options.nodeName)
 			#  optparse does not pass multiple args that are quoted anymore?  
 			#  Used to work with python 2.5.2.  Doesn't work with python 2.6.5.  
-			data.allocateNode(options.reservationId, options.domain, host['sys_id'], options.vlanInfo, options.imageName, options.myNotes + " " + str(string.join(args[0:len(args)])))
+			data.allocateNode(options.reservationId, options.domain, host['sys_id'], options.vlanInfo, options.imageName, options.hostName, options.myNotes + " " + str(string.join(args[0:len(args)])))
 		else:
 			mesg = "USAGE: %s --allocateNode --nodeName nodeName --domain domainname --reservationId ID --vlanInfo vlanNums:info, --imageName imagename [--notes]\n" % (sys.argv[0])
 			mesg += "Options\n"
@@ -456,7 +457,6 @@ def main():
 			sys.stdout.write(mesg)
 			exit()
 		
-		exit()  #remove this
 		if not (options.reservationId) or not options.nodeName: 
 			mesg = "ERROR:  AllocateNode requires the following arguments...\n"
 			if not (options.nodeName):
@@ -471,8 +471,23 @@ def main():
 			sys.stderr.write(mesg)		
 			exit()
 
-		print host['sys_id']
-		data.allocateNode(options.reservationId, host['sys_id'], options.hostName,  vlanNum, options.ipAddr, options.Notes)
+		#  Reconfigure switchports
+		memberMap = data.getDomainMembership(host['sys_id'])
+		HwSwitch = HwDellSwitch
+		hwswitch = HwSwitch(configs, host)
+		for vlan, tag in memberMap.iteritems():
+			hwswitch.addNodeToVlan(vlan, tag)
+		#  Register node in DNS
+		if options.hostName:
+			#  Add cname
+			cmd = "zoni --addCname %s %s" % (options.hostName, host['location'])
+			subprocess.Popen(string.split(cmd))
+			
+		
+
+	
+		#data.allocateNode(options.reservationId, options.domain, host['sys_id'], options.vlanInfo, options.imageName, options.hostName, options.myNotes + " " + str(string.join(args[0:len(args)])))
+		#data.allocateNode(options.reservationId, host['sys_id'], options.hostName,  vlanNum, options.ipAddr, options.myNotes)
 		exit()
 
 	#  Update allocation
@@ -490,14 +505,13 @@ def main():
 			exit()
 
 		userId = None
-		if options.uid and options.userName:
+		if options.uid or options.userName:
 			#  Get the username from uid 
 			userId = options.uid
 			if not options.uid:
 				userId = usermgt.getUserId(options.userName)
 
-		print options.reservationId, userId, options.reservationDuration, options.vlanIsolate, options.Notes
-		data.updateReservation(options.reservationId, userId, options.reservationDuration, options.vlanIsolate, options.Notes)
+		data.updateReservation(options.reservationId, userId, options.reservationDuration, options.vlanIsolate, options.myNotes)
 
 	#  Release node allocation
 	if (options.releaseNode):

Added: incubator/tashi/trunk/src/zoni/data/reservation.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/reservation.py?rev=1179892&view=auto
==============================================================================
--- incubator/tashi/trunk/src/zoni/data/reservation.py (added)
+++ incubator/tashi/trunk/src/zoni/data/reservation.py Thu Oct  6 22:47:11 2011
@@ -0,0 +1,96 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.	
+#
+#  $Id:$ 
+#
+
+import sys
+import os 
+import string
+import logging
+
+from reservationmanagementinterface import ReservationManagementInterface
+
+class reservationMysql(ReservationManagementInterface):
+	def __init__(self, config, data, verbose=None):
+		self.config = config
+		self.data = data
+		self.verbose = verbose
+		self.log = logging.getLogger(__name__)
+
+
+
+	def createReservation (self, userId, reservationDuration=None, reservationNotes=None, vlan=None):
+		if not reservationDuration:
+			resDuration = str(15)
+		else:
+			resDuration = str(reservationDuration)
+
+		if len(resDuration) == 8:
+			expireDate = resDuration
+		elif len(resDuration) < 4:
+			numdays = resDuration
+			cmd = "date +%Y%m%d --date=\"" + numdays + " day\""
+			p = os.popen(cmd)
+			expireDate = string.strip(p.read())
+		else:
+			mesg = "ERROR: Invalid reservation duration\n"
+			self.log.info(mesg)
+			return
+		#  Create the reservation
+		print userId, expireDate,reservationNotes
+		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.data.insertDb(query)
+		#  Get the res_id
+		query = "select max(reservation_id) from reservationinfo"
+		res_id = self.data.selectDb(query).fetchone()[0]
+		mesg = "  Reservation created - ID : %s" % str(res_id)
+		self.log.info(mesg)
+
+		return res_id
+
+
+
+	
+
+	def createDomain (self, domain):
+		raise NotImplementedError
+
+	def destroyDomain (self, domain):
+		raise NotImplementedError
+
+	def addNode2Domain(self, userId):
+		raise NotImplementedError
+
+	def addVlan2Domain(self, userId):
+		raise NotImplementedError
+
+
+	def updateReservation (self, userId):
+		raise NotImplementedError
+
+	def delReservation (self, userId):
+		raise NotImplementedError
+	
+	def defineReservation():
+		raise NotImplementedError
+
+	def showReservation():
+		raise NotImplementedError
+

Added: incubator/tashi/trunk/src/zoni/data/reservationmanagementinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/reservationmanagementinterface.py?rev=1179892&view=auto
==============================================================================
--- incubator/tashi/trunk/src/zoni/data/reservationmanagementinterface.py (added)
+++ incubator/tashi/trunk/src/zoni/data/reservationmanagementinterface.py Thu Oct  6 22:47:11 2011
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.    
+#
+#  $Id:$
+#
+
+import sys
+import os 
+
+
+class ReservationManagementInterface(object):
+	"""  Interface description for reservation management
+    """
+	def __init__(self, config):
+		self.config = config
+
+
+	def createDomain (self, domain):
+		raise NotImplementedError
+
+	def destroyDomain (self, domain):
+		raise NotImplementedError
+
+	def addNode2Domain(self, userId):
+		raise NotImplementedError
+
+	def addVlan2Domain(self, userId):
+		raise NotImplementedError
+
+	def addReservation (self, userId):
+		raise NotImplementedError
+
+	def updateReservation (self, userId):
+		raise NotImplementedError
+
+	def delReservation (self, userId):
+		raise NotImplementedError
+	
+	def defineReservation():
+		raise NotImplementedError
+
+	def showReservation():
+		raise NotImplementedError
+

Modified: incubator/tashi/trunk/src/zoni/data/resourcequerysql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/resourcequerysql.py?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/data/resourcequerysql.py (original)
+++ incubator/tashi/trunk/src/zoni/data/resourcequerysql.py Thu Oct  6 22:47:11 2011
@@ -102,6 +102,17 @@ class ResourceQuerySql(InfoStore):
 			self.log.error(mesg)
 		
 
+	def getDomainMembership(self, sys_id):
+		query = "select v.vlan_num, q.vlan_type from allocationinfo a, vlanmembermap q, vlaninfo v where q.vlan_id = v.vlan_id and a.allocation_id = q.allocation_id and sys_id = '%s'" % (sys_id)
+		result = self.selectDb(query)
+		data = {}
+		if result.rowcount:
+			for i in result.fetchall():
+				data[int(i[0])] = i[1]
+			return data
+		else:
+			return -1
+
 	def removeDomain(self, name):
 		mesg = "Removing domain %s" % (name)
 		self.log.info(mesg)
@@ -479,6 +490,7 @@ class ResourceQuerySql(InfoStore):
 		else:
 			print "%-10s%-10s%-13s%-12s%s" % ("User", "Node", "Cores/Mem","Expiration", "Notes")
 
+		print "ros ", result.rowcount
 		for i in result.fetchall():
 			uid = i[0]
 			domain = i[1]
@@ -914,7 +926,8 @@ class ResourceQuerySql(InfoStore):
 #
 		#self.insertDb(query)
 
-	def allocateNode(self, reservationId, domain, sysId, vlanInfo, imageName, notes=None):
+
+	def allocateNode(self, reservationId, domain, sysId, vlanInfo, imageName, newHostName=None, notes=None):
 		print "reservationId", reservationId, domain, sysId, vlanInfo, imageName, notes
 
 		#  Check if node is already allocated
@@ -956,7 +969,7 @@ class ResourceQuerySql(InfoStore):
 		nodeName = self.getLocationFromSysId(sysId)
 		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)
+		query = "insert into allocationinfo (sys_id, reservation_id, domain_id, hostname, notes) values ('%s', '%s', '%s', '%s', '%s')" % (sysId, reservationId, domainId, newHostName, notes)
 		result = self.insertDb(query)
 		allocationId = result.lastrowid
 
@@ -977,6 +990,7 @@ class ResourceQuerySql(InfoStore):
 	
 		self.__updateSysState(sysId, 1)
 
+
 		
 	def __updateSysState(self, sysId, stateId):
 		query = "update sysinfo set state_id = '%s' where sys_id = '%s'" % (stateId, sysId)

Modified: incubator/tashi/trunk/src/zoni/data/usermanagement.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/usermanagement.py?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/data/usermanagement.py (original)
+++ incubator/tashi/trunk/src/zoni/data/usermanagement.py Thu Oct  6 22:47:11 2011
@@ -131,7 +131,7 @@ class files(UserManagementInterface):
 		cmd = "cat /etc/passwd "
 		a = os.popen(cmd)
 		for line in a.readlines():
-			if userName in line :
+			if str(userId) in line :
 				return line.split(":")[0]
 
 		return 0

Modified: incubator/tashi/trunk/src/zoni/extra/util.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/extra/util.py?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/extra/util.py (original)
+++ incubator/tashi/trunk/src/zoni/extra/util.py Thu Oct  6 22:47:11 2011
@@ -39,7 +39,7 @@ def loadConfigFile(parser):
 	config['logFile'] = parser.get("logging", "LOG_FILE").split()[0]
 	
 	#  Management
-	#config['userManagement'] = parser.get("management", "USER_MANAGEMENT").split()[0]
+	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]
 	

Modified: incubator/tashi/trunk/src/zoni/system/registration/register/register_automate
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/system/registration/register/register_automate?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/system/registration/register/register_automate (original)
+++ incubator/tashi/trunk/src/zoni/system/registration/register/register_automate Thu Oct  6 22:47:11 2011
@@ -63,17 +63,17 @@ SVC_TAG=$1
 REQUEST=$2
 
 res=""
-if [[ "$REQUEST" == "location" ]]; then
+if [ "$REQUEST" = "location" ]; then
     res=`cat /register_automate | grep -i "^#$SVC_TAG" | awk '{print $2}'`
-elif [[ "$REQUEST" == "switchinfo" ]]; then
+elif [ "$REQUEST" = "switchinfo" ]; then
     res=`cat /register_automate | grep -i "^#$SVC_TAG" | awk '{print $3}'`
-elif [[ "$REQUEST" == "pduinfo" ]]; then
+elif [ "$REQUEST" = "pduinfo" ]; then
     res=`cat /register_automate | grep -i "^#$SVC_TAG" | awk '{print $4}'`
-elif [[ "$REQUEST" == "image" ]]; then
+elif [ "$REQUEST" = "image" ]; then
     res=`cat /register_automate | grep -i "^#$SVC_TAG" | awk '{print $5}'`
 fi
 
-if [[ `echo -n $res | wc -c` -gt 1 ]]; then
+if [ `echo -n $res | wc -c` -gt 1 ]; then
     echo $res
     exit 0
 else

Modified: incubator/tashi/trunk/src/zoni/system/registration/register/register_node
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/system/registration/register/register_node?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/system/registration/register/register_node (original)
+++ incubator/tashi/trunk/src/zoni/system/registration/register/register_node Thu Oct  6 22:47:11 2011
@@ -23,6 +23,7 @@
 DEBUG () {
 	if [ $VERBOSE ] && [ $VERBOSE -eq 1 ];then 
 		echo DEBUG: $*
+		echo DEBUG: $* >> /tmp/output.log
 	fi
 }
 
@@ -134,7 +135,7 @@ wget -O- "http://${IMAGE_URL}/zoni-regis
 
 #  Get more info either from cheat file or from user entered info
 ec=1
-if [[ -e /register_automate ]]; then
+if [ -e /register_automate ]; then
 	switchinfo=`/register_automate $SYSTEM_SERIAL_NUMBER switchinfo`
 	switchport=$(echo $switchinfo | cut -d ":" -f 2)
 	switch=$(echo $switchinfo | cut -d ":" -f 1)
@@ -159,9 +160,9 @@ fi
 #if [ $val -gt 0 ];then
 
 #  No automate entry found, prompt user for info
-if [[ $ec -ne 0 ]]; then
+if [ $ec -ne 0 ]; then
 	ans=n;
-	while [ $ans == "n" ] || [ $ans == "N" ]; do
+	while [ $ans = "n" ] || [ $ans = "N" ]; do
 		echo -n "Please enter the location/hostname for this node: "
 		read location
 		#echo -n "Please enter the IP address for this node: "

Modified: incubator/tashi/trunk/src/zoni/system/registration/www/include/zoni_functions.php
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/system/registration/www/include/zoni_functions.php?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/system/registration/www/include/zoni_functions.php (original)
+++ incubator/tashi/trunk/src/zoni/system/registration/www/include/zoni_functions.php Thu Oct  6 22:47:11 2011
@@ -21,11 +21,12 @@
 function DEBUG($verbose, $val) {
 	if ($verbose == 1) {
 		if (is_array($val)) {
-			print "DEBUG:";
-			print_r($val);
+			$mesg = "DEBUG: " . print_r($val,true) . "<br>\n";
 		} else {
-			print "DEBUG: $val<br>\n";
+			$mesg = "DEBUG: " . $val . "<br>\n";
+			
 		}
+		file_put_contents("/tmp/zoni_register.log", $mesg, FILE_APPEND);
 
 	}
 }

Modified: incubator/tashi/trunk/src/zoni/system/registration/www/zoni-register.php
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/system/registration/www/zoni-register.php?rev=1179892&r1=1179891&r2=1179892&view=diff
==============================================================================
--- incubator/tashi/trunk/src/zoni/system/registration/www/zoni-register.php (original)
+++ incubator/tashi/trunk/src/zoni/system/registration/www/zoni-register.php Thu Oct  6 22:47:11 2011
@@ -26,6 +26,7 @@
 	$PYTHONPATH=$G['ZONI_BASE_DIR'] . "/src";
     $verbose = (isset($_GET['verbose'])) ? $_GET['verbose']: 0;
 
+	print "verbose is $verbose";
     DEBUG($verbose, "<pre>");
     DEBUG($verbose, $G);
 
@@ -168,10 +169,9 @@
 			$query .= "chassis_serial_number = '$chassis_serial_number', ";
 			$query .= "system_uuid = '$system_uuid', ";
             $query .= "cpu_flags = '$cpu_flags', ";
-			$query .= "last_update = now() ";
+            $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);
             $result = mysql_query($query)
                 or die('Update system query failed: ' . mysql_error());
 		}
@@ -210,7 +210,6 @@
 	if ($action == "addip") {
 		$query = "update sysinfo set ip_addr = '$ip_addr' where mac_addr = '$mac_addr'";
 		DEBUG($verbose, "addip query is $query <br>\n");
-		#file_put_contents("/tmp/updatequery.txt", $query);
 		$result = $myconn->run_query($query);
 	}
 	#  add the location
@@ -218,7 +217,6 @@
 		$query = "update sysinfo set location = '$location' where mac_addr = '$mac_addr'";
 		#DEBUG($verbose, "addip query is $query <br>\n");
 		print "query is $query";
-		#file_put_contents("/tmp/updatequery.txt", $query);
 		$result = $myconn->run_query($query);
 	}
 
@@ -232,28 +230,30 @@
         DEBUG($verbose, $results);
         $num_rows = $myconn->get_num_rows();
 		DEBUG($verbose, "num rows is $num_rows<br>\n");
+		$sys_id = $myconn->get_sys_id($mac_addr);
+		$allocation_id = $myconn->get_something("allocation_id", "allocationinfo", "sys_id", $sys_id);
 
         if ($num_rows == 1) {
 			$image_id = $results[0][0];
+			DEBUG($verbose, "imageid is $image_id,m allocation is $allocation_id");
 
-            if ($myconn->check_dup("imagemap", "mac_addr", $mac_addr)) {
+            if ($myconn->check_dup("imagemap", "allocation_id", $allocation_id)) {
                 $query = "delete from imagemap ";
-                $query .= "where mac_addr = '$mac_addr' ";
+                $query .= "where allocation_id = '$allocation_id' ";
+				DEBUG($verbose, "check_dup query is $query");
                 $result = $myconn->run_query($query);
             }
-		}else {
-			$query = "insert into imagemap ";
-			$query .= "(mac_addr, image_id) ";
-			$query .= "values ('$mac_addr', '$image_id')";
-			DEBUG($verbose, "inserting $query<br>\n");
-			$result = $myconn->run_query($query);
 		}
+		$query = "insert into imagemap ";
+		$query .= "(allocation_id, image_id) ";
+		$query .= "values ('$allocation_id', '$image_id')";
+		$result = $myconn->run_query($query);
 
 		$sys_id = $myconn->get_sys_id($mac_addr);
 		$location = $myconn->get_location($sys_id);
 
 		DEBUG($verbose, "creating link in pxe");
-		print shell_exec("cd {$G['ZONI_BASE_DIR']}; sudo ./bin/zoni-cli.py --assignimage $image_name --nodeName $location");
+		print shell_exec("cd {$G['ZONI_BASE_DIR']}; sudo zoni --assignimage $image_name --nodeName $location");
 		DEBUG($verbose, "finished linking in pxe");
 	}
 
@@ -378,9 +378,6 @@
 		}
 		DEBUG($verbose, "location is $location");
 		DEBUG($verbose, "doing the dns and dhcp updates");
-		#print shell_exec("cd {$G['ZONI_BASE_DIR']}; sudo ./bin/zoni-cli.py --addDns $location $ip_addr");
-		#print shell_exec("cd {$G['ZONI_BASE_DIR']}; sudo ./bin/zoni-cli.py --addDhcp $location $ip_addr $mac_addr");
-		#print "location is " + $location + " and ip is " + $ip_addr;
 		print shell_exec("PYTHONPATH=$PYTHONPATH zoni --addDns $location $ip_addr");
 		print shell_exec("PYTHONPATH=$PYTHONPATH zoni --addDhcp $location $ip_addr $mac_addr");
 	}
@@ -414,7 +411,8 @@
 
 			echo "creating link in pxe";
 			#  Try to use prs to do this...
-			print shell_exec("cd /home/rgass/projects/prs/; sudo ./zoni-client.py --assignimage $next_image --nodeName $location");
+			#  Old version, need to fix later
+			#print shell_exec("cd /home/rgass/projects/prs/; sudo ./zoni-client.py --assignimage $next_image --nodeName $location");
 			#print shell_exec("cd /var/www/cluster/scripts/; sudo ./add_pxe_from_db $location");
 			DEBUG($verbose, "finished linking in pxe");
         }