Index: trunk/python/test-db.py
===================================================================
--- trunk/python/test-db.py	(revision 0)
+++ trunk/python/test-db.py	(revision 4)
@@ -0,0 +1 @@
+import txtdb
Index: trunk/python/ciab_common_vars.pyc
===================================================================
--- trunk/python/ciab_common_vars.pyc	(revision 0)
+++ trunk/python/ciab_common_vars.pyc	(revision 4)
@@ -0,0 +1,8 @@
+Ñò
+9hwNc@s+hdd6dd6dd6dd6dd	6d
+d6dd
+6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6dd*6d+d,6d-d.6d/d06d1d26d&d36d4d56d6d76d8d96Zeded:<eded;<ed3d<ed=<d>„Zed?joeƒnd@S(Asciab.lip.ens-lyon.frtCLUSTER_DOMAIN_NAMEs	192.168.1tCLUSTER_STATIC_NETWORK_PREFIXtinternaltCOMPUTE_NODE_BRIDGEscompute-nodes-cpustCOMPUTE_NODE_CPUS_FILEs/mnt/compute-node-system-disktCOMPUTE_NODE_DISK_MOUNT_POINTs/boot/vmlinuz-`uname -r`tCOMPUTE_NODE_KERNELs/boot/initrd.img-`uname -r`tCOMPUTE_NODE_RAMDISKs00:16:3E:0F:6AtCOMPUTE_NODE_MAC_ADDRESS_PREFIXt250tCOMPUTE_NODE_MAX_NUMt3072tCOMPUTE_NODE_MEMORYt252t)COMPUTE_NODE_MODEL_STATIC_NETWORK_POSTFIXscompute-node-modeltCOMPUTE_NODE_MODEL_NAMEs
+compute-node-tCOMPUTE_NODE_NAME_PREFIXt3tCOMPUTE_NODE_NUMt2tCOMPUTE_NODE_VCPUSsdhcp-hostsfiletDHCP_HOSTSFILE_BASENAMEt251t FRONT_END_STATIC_NETWORK_POSTFIXtfrontendtFRONT_END_NAMEthoststHOSTS_FILE_BASENAMEs/dev/vg_gueststSWAP_DISK_LOGICAL_VOLUMEs-swaptSWAP_DISK_POSTFIXtSWAP_DISK_PREFIXt1GtSWAP_DISK_SIZEs-disktSYSTEM_DISK_CLONE_POSTFIXt20GtSYSTEM_DISK_CLONE_SIZEtext3tSYSTEM_DISK_FILE_SYSTEMtSYSTEM_DISK_LOGICAL_VOLUMEt	templatest
+TEMPLATES_DIRsusers-home-disktUSERS_HOME_DISKt40GtUSERS_HOME_DISK_SIZEt"COMPUTE_NODE_STATIC_NETWORK_PREFIXtSYSTEM_DISK_CLONE_PREFIXs/compute-node-model-disktSYSTEM_DISK_MASTERcCs2x+ttiƒƒD]}|GdGt|GHqWdS(Ns = (tsortedtcommonVariablestkeys(tkey((s1/root/cluster-in-a-box/python/ciab_common_vars.pytmain,st__main__N(R0R3t__name__(((s1/root/cluster-in-a-box/python/ciab_common_vars.pyt<module>sJ
+	
+
\ No newline at end of file
Index: trunk/python/ciab_user_functions.py
===================================================================
--- trunk/python/ciab_user_functions.py	(revision 0)
+++ trunk/python/ciab_user_functions.py	(revision 4)
@@ -0,0 +1,24 @@
+import csv
+import re
+import string
+
+# Read common variables
+def read_common_variables(cvsFileName):
+  commonVariables = {}
+  commonVariablesFile=open(cvsFileName, "rb")
+  fileDialect = csv.Sniffer().sniff(commonVariablesFile.read(1024))
+#  fileDialect.skipinitialspace = True
+  commonVariablesFile.seek(0)
+  reader = csv.reader(commonVariablesFile, dialect=fileDialect)
+  continuation = 1
+  while (continuation):
+    try:
+      entry = reader.next()
+      if  len(entry) >= 2:
+        entry[0] = string.strip(entry[0])
+      	commonVariables[entry[0]] = string.strip(entry[1])
+      	print entry
+    except StopIteration:
+      continuation = 0
+      commonVariablesFile.close()
+  return commonVariables
Index: trunk/python/ciab_user_functions.pyc
===================================================================
--- trunk/python/ciab_user_functions.pyc	(revision 0)
+++ trunk/python/ciab_user_functions.pyc	(revision 4)
@@ -0,0 +1,9 @@
+Ñò
+³QwNc@s1ddkZddkZddkZd„ZdS(iÿÿÿÿNcCsòh}t|dƒ}tiƒi|idƒƒ}|idƒti|d|ƒ}d}x�|oˆy^|iƒ}t|ƒdjo;t	i
+|dƒ|d<t	i
+|dƒ||d<|GHnWq^tj
+od}|iƒq^Xq^W|S(Ntrbiitdialectii(
+topentcsvtSniffertsnifftreadtseektreadertnexttlentstringtstript
+StopIterationtclose(tcvsFileNametcommonVariablestcommonVariablesFiletfileDialectRtcontinuationtentry((s4/root/cluster-in-a-box/python/ciab_user_functions.pytread_common_variabless$
+
+(RtreRR(((s4/root/cluster-in-a-box/python/ciab_user_functions.pyt<module>s
\ No newline at end of file
Index: trunk/python/ciab-common-vars.csv
===================================================================
--- trunk/python/ciab-common-vars.csv	(revision 0)
+++ trunk/python/ciab-common-vars.csv	(revision 4)
@@ -0,0 +1,31 @@
+CLUSTER_DOMAIN_NAME,				ciab.lip.ens-lyon.fr
+CLUSTER_STATIC_NETWORK_PREFIX,			192.168.1
+COMPUTE_NODE_BRIDGE,				internal
+COMPUTE_NODE_CPUS_FILE,				compute-nodes-cpus
+COMPUTE_NODE_DISK_MOUNT_POINT,			/mnt/compute-node-system-disk
+COMPUTE_NODE_KERNEL,				/boot/vmlinuz-`uname -r`
+COMPUTE_NODE_RAMDISK,				/boot/initrd.img-`uname -r`
+COMPUTE_NODE_MAC_ADDRESS_PREFIX,		00:16:3E:0F:6A
+COMPUTE_NODE_MAX_NUM,				250
+COMPUTE_NODE_MEMORY,				3072
+COMPUTE_NODE_MODEL_STATIC_NETWORK_POSTFIX,	252
+COMPUTE_NODE_MODEL_NAME,			compute-node-model
+COMPUTE_NODE_NAME_PREFIX,			compute-node-
+COMPUTE_NODE_NUM,				3
+COMPUTE_NODE_VCPUS,				2
+DHCP_HOSTSFILE_BASENAME,			dhcp-hostsfile
+FRONT_END_STATIC_NETWORK_POSTFIX,		251
+FRONT_END_NAME,					frontend
+HOSTS_FILE_BASENAME,				hosts
+SWAP_DISK_LOGICAL_VOLUME,			/dev/vg_guests
+SWAP_DISK_POSTFIX,				-swap
+SWAP_DISK_PREFIX,				compute-node-
+SWAP_DISK_SIZE,					1G
+SYSTEM_DISK_CLONE_POSTFIX,			-disk
+SYSTEM_DISK_CLONE_SIZE,				20G
+SYSTEM_DISK_FILE_SYSTEM,			ext3
+SYSTEM_DISK_LOGICAL_VOLUME,			/dev/vg_guests
+TEMPLATES_DIR,					templates
+USERS_HOME_DISK,				users-home-disk
+USERS_HOME_DISK_SIZE				40G
+
Index: trunk/python/create-compute-node.py
===================================================================
--- trunk/python/create-compute-node.py	(revision 0)
+++ trunk/python/create-compute-node.py	(revision 4)
@@ -0,0 +1,38 @@
+#! /usr/bin/python
+#
+#
+# Define a main function to allow for function declaration in any order.
+def main():
+  # System modules
+  import sys
+  # Local modules (must live in the same directory).
+  import ciab_user_functions as cuf
+  from ciab_common_vars import (commonVariables)
+  #
+  # Variables
+  nodeNumberString = ''
+  
+  # Yep, the comma is correct: it's a list of variables!
+  nodeNumberString, = usage(sys.argv)
+  print commonVariables.keys()
+  print commonVariables.values()
+  print nodeNumberString
+# End main
+
+def usage(arguments):
+  import sys
+  if (len(arguments) < 2):
+    print
+    print
+    print 'Missing parameter. Aborting'
+    print
+    print 'Usage: ' + arguments[0] + ' node_number'
+    print
+    print
+    sys.exit(1)
+  nodeNumberString = arguments[1]
+  # Yep, the comma is correct: it's a list of variables!
+  return nodeNumberString,
+  
+if __name__ == "__main__":
+  main()

Property changes on: trunk/python/create-compute-node.py
___________________________________________________________________
Added: svn:executable
   + *

Index: trunk/python/ciab_common_vars.py
===================================================================
--- trunk/python/ciab_common_vars.py	(revision 0)
+++ trunk/python/ciab_common_vars.py	(revision 4)
@@ -0,0 +1,49 @@
+# Common configuration variables
+#
+commonVariables = {
+
+'CLUSTER_DOMAIN_NAME'				:'ciab.lip.ens-lyon.fr',
+'CLUSTER_STATIC_NETWORK_PREFIX'			:'192.168.1',
+'COMPUTE_NODE_BRIDGE'				:'internal',
+'COMPUTE_NODE_CPUS_FILE'			:'compute-nodes-cpus',
+'COMPUTE_NODE_DISK_MOUNT_POINT'			:'/mnt/compute-node-system-disk',
+'COMPUTE_NODE_KERNEL'				:'/boot/vmlinuz-`uname -r`',
+'COMPUTE_NODE_RAMDISK'				:'/boot/initrd.img-`uname -r`',
+'COMPUTE_NODE_MAC_ADDRESS_PREFIX'		:'00:16:3E:0F:6A',
+'COMPUTE_NODE_MAX_NUM'				:'250',
+'COMPUTE_NODE_MEMORY'				:'3072',
+'COMPUTE_NODE_MODEL_STATIC_NETWORK_POSTFIX'	:'252',
+'COMPUTE_NODE_MODEL_NAME'			:'compute-node-model',
+'COMPUTE_NODE_NAME_PREFIX'			:'compute-node-',
+'COMPUTE_NODE_NUM'				:'3',
+'COMPUTE_NODE_VCPUS'				:'2',
+'DHCP_HOSTSFILE_BASENAME'			:'dhcp-hostsfile',
+'FRONT_END_STATIC_NETWORK_POSTFIX'		:'251',
+'FRONT_END_NAME'				:'frontend',
+'HOSTS_FILE_BASENAME'				:'hosts',
+'SWAP_DISK_LOGICAL_VOLUME'			:'/dev/vg_guests',
+'SWAP_DISK_POSTFIX'				:'-swap',
+'SWAP_DISK_PREFIX'				:'compute-node-',
+'SWAP_DISK_SIZE'				:'1G',
+'SYSTEM_DISK_CLONE_POSTFIX'			:'-disk',
+'SYSTEM_DISK_CLONE_SIZE'			:'20G', # Half of the master size.
+'SYSTEM_DISK_FILE_SYSTEM'			:'ext3',
+'SYSTEM_DISK_LOGICAL_VOLUME'			:'/dev/vg_guests',
+'TEMPLATES_DIR'					:'templates',
+'USERS_HOME_DISK'				:'users-home-disk',
+'USERS_HOME_DISK_SIZE'				:'40G',
+}
+commonVariables['COMPUTE_NODE_STATIC_NETWORK_PREFIX'] = \
+		commonVariables['CLUSTER_STATIC_NETWORK_PREFIX']
+commonVariables['SYSTEM_DISK_CLONE_PREFIX'] = \
+		commonVariables['COMPUTE_NODE_NAME_PREFIX']
+commonVariables['SYSTEM_DISK_MASTER'] = \
+		commonVariables['SYSTEM_DISK_LOGICAL_VOLUME'] + \
+		'/compute-node-model-disk'
+
+def main():
+  for key in sorted(commonVariables.keys()):
+    print key, ' = ', commonVariables[key]
+
+if __name__ == "__main__":
+  main()
