[Rocks-Discuss] "list index out of range" error with "rocks sync config" DNS build in Rocks 5.0.3

Hamilton, Scott L. hamiltonsl at mst.edu
Mon Dec 8 08:58:29 PST 2008


Chris,

I found this bug as well.  I submitted a patch, but it never got released.  It has to do with the netmask.  They assume in the rocks scripts that generate the DNS configuration that your private network netmask will always end in zero, be no smaller that a CLASS C network 255.255.255.0  if you use 255.255.255.128 for example, it breaks the dns part of their scripts.  You have two options to fix this.

(1)  Fix their DNS script by following my instructions.

(2) Reconfigure your networks to be class C networks.

I choose to fix the dns script by doing the following:

Edit the following files.  If you are installing multiple clusters I suggest editing them in the base roll and rebuilding the roll.  If you have only this cluster then just make the changes directly to your head node.

/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/plugin_dns.py

Find this subroutine and make the noted changes:

	def reverseIP(self, addr, mask):
		"Reverses the elements of a dot-decimal address."

		if type(addr) != types.ListType:
			addr = string.split(addr,".")

		addr.reverse()

		clip = mask/8
		if (mask % 8):
			clip += 1
		# I added this section to fix a bug that breaks the dns configuration when 
		# isntalling on subnets smaller than 255.255.255.0
		if (clip == 4):
			clip = 3
		# Only show the host portion of the address.
		addr = addr[:-clip]

		reversed = addr[0]
		for i in addr[1:]:
			reversed = "%s.%s" % (reversed, i)

		return reversed

Then in the file:
/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/__init__.py

Find and modify this subroutine.

	def getSubnets(self):
		list = []

		network = self.getNetwork()
		netmask = self.getNetmask()

		w = string.split(network, '.')
		work = []
		for i in w:
			work.append(int(i))

		for i in range(0,4):
			# Added this section to fix a bug when subnet was smaller than class C.
			if netmask < 8:
				break
			else:
				netmask -= 8

		octet_index = i
		octet_value = work[i]

		if netmask < 8:
			#
			# no subnetting
			#
			subnet = []

			for j in range(0, octet_index):
				subnet.append('%d' % (work[j]))

			list = [ subnet ]
		else:
			for i in range(0, 2**(8-netmask)):
				work[octet_index] = octet_value + i
				if work[octet_index] > 254:
					break

				subnet = []
				for j in range(0, octet_index+1):
					subnet.append('%d' % (work[j]))

				if list == []:
					list = [ subnet ]
				else:
					list.append(subnet)

		return list


I can place the modified files on a web site for you if you desire, just drop me an e-mail.  I think this may be considered a hack by the ROCKS community because it actually creates a dns zone for the entire class C network, but it does work around this issue which is probably why the patch was not added to the source tree.

Thanks,

Scott L. Hamilton
Missouri S&T IT 
System Administrator
Phone: (573) 341-6117
e-mail: hamiltonsl at mst.edu




-----Original Message-----
From: npaci-rocks-discussion-bounces at sdsc.edu on behalf of Christopher J. Tengi
Sent: Mon 12/8/2008 9:12 AM
To: npaci-rocks-discussion at sdsc.edu
Subject: [Rocks-Discuss] "list index out of range" error with "rocks sync config" DNS build in Rocks 5.0.3
 
I am working on (finally) getting Rocks 5 deployed in production and
I've run into a snag that I believe is related to the way I add compute
nodes.  Because each node needs 2 active network interfqaces (one for
cluster/MPI stuff and one for NFS), I manually add hosts with commands
of the following format:

========
rocks add network nfs subnet=172.17.30.128 netmask=255.255.255.128

rocks add host interface c3-0-0 eth0 \
        ip=172.17.30.126 \
        name=c3-0-0 \
        mac=00:14:4f:0f:76:d2 \
        module=e1000 \
        subnet=private

rocks add host interface c3-0-0 eth1 \
        ip=172.17.30.254 \
        name=c3-nfs-0-0 \
        mac=00:14:4f:0f:76:d3 \
        module=e1000 \
        subnet=nfs

rocks add host interface c3-0-0 eth2 \
        mac=00:14:4f:0f:76:d4 \
        module=e1000

rocks add host interface c3-0-0 eth3 \
        mac=00:14:4f:0f:76:d5 \
        module=e1000
========

When I run "rocks sync config" or "rocks sync dns" I get error output
like this:

========

Traceback (most recent call last):
  File "/opt/rocks/bin/rocks", line 223, in ?
    command.runWrapper(name, args[i:])
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/__init__.py", line 1459, in runWrapper
    self.run(self._params, self._args)
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/__init__.py", line 165, in run
    self.runPlugins()
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/__init__.py", line 1210, in runPlugins
    plugin.run(args)
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/plugin_dns.py", line 274, in run
    self.writeReverse(serial)
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/plugin_dns.py", line 262, in writeReverse
    self.reversehostlines(file, forward_sn)
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/plugin_dns.py", line 234, in reversehostlines
    file.write("%s PTR %s.%s.\n" %
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/sync/dns/plugin_dns.py", line 206, in reverseIP
    reversed = addr[0]
IndexError: list index out of range


========

I'm fairly certain that this is a result of doing manual node additions
instead of using insert-ethers, but I think that insert-ethers is not
really an option for me if I want to get both interfaces on each node
configured the way I need them to be.  Assuming that you might want the
output of "rocks list host" and "rocks list host interface" I am
including them below.

Is it possible that having all 4 compute node interfaces defined but
only having IP addresses for 2 of them is the problem?  I was putting
everything in for completeness and possible future use, so I don't
*need* to add interface eth2 and eth3.  Do I need to remove all the
nodes and start over?  Is there some already-existing patch I can apply
to the python code?

                Thanks,
                            /Chris

========
[root at c3 ~]# rocks list host
HOST     MEMBERSHIP CPUS RACK RANK COMMENT
c3:      Frontend   1    0    0    -------
c3-0-0:  Compute    4    0    0    -------
c3-0-1:  Compute    4    0    1    -------
c3-0-2:  Compute    4    0    2    -------
c3-0-3:  Compute    8    0    3    -------
c3-0-4:  Compute    8    0    4    -------
c3-0-5:  Compute    8    0    5    -------
c3-0-6:  Compute    8    0    6    -------
c3-0-7:  Compute    8    0    7    -------
c3-0-8:  Compute    8    0    8    -------
c3-0-9:  Compute    8    0    9    -------
c3-0-10: Compute    8    0    10   -------
c3-0-11: Compute    8    0    11   -------
c3-0-12: Compute    8    0    12   -------
c3-0-13: Compute    8    0    13   -------
========

========
[root at c3 ~]# rocks list host interface
HOST     SUBNET  IFACE MAC               IP              NETMASK         GATEWAY         MODULE    NAME               
c3:      private eth0  00:14:4f:0f:78:9a 172.17.30.2     255.255.255.128 --------------- e1000     c3                 
c3:      public  eth1  00:14:4f:0f:78:9b 128.112.155.137 255.255.255.192 128.112.155.129 e1000     c3.cs.princeton.edu
c3:      ------- eth2  00:14:4f:0f:78:9c --------------- --------------- --------------- e1000     -------------------
c3:      ------- eth3  00:14:4f:0f:78:9d --------------- --------------- --------------- e1000     -------------------
c3-0-0:  private eth0  00:14:4f:0f:76:d2 172.17.30.126   255.255.255.128 --------------- e1000     c3-0-0             
c3-0-0:  nfs     eth1  00:14:4f:0f:76:d3 172.17.30.254   255.255.255.128 --------------- e1000     c3-nfs-0-0         
c3-0-0:  ------- eth2  00:14:4f:0f:76:d4 --------------- --------------- --------------- e1000     -------------------
c3-0-0:  ------- eth3  00:14:4f:0f:76:d5 --------------- --------------- --------------- e1000     -------------------
c3-0-1:  private eth0  00:14:4f:0f:78:a2 172.17.30.125   255.255.255.128 --------------- e1000     c3-0-1             
c3-0-1:  nfs     eth1  00:14:4f:0f:78:a3 172.17.30.253   255.255.255.128 --------------- e1000     c3-nfs-0-1         
c3-0-1:  ------- eth2  00:14:4f:0f:78:a4 --------------- --------------- --------------- e1000     -------------------
c3-0-1:  ------- eth3  00:14:4f:0f:78:a5 --------------- --------------- --------------- e1000     -------------------
c3-0-2:  private eth0  00:14:4f:0f:b0:c2 172.17.30.124   255.255.255.128 --------------- e1000     c3-0-2             
c3-0-2:  nfs     eth1  00:14:4f:0f:b0:c3 172.17.30.252   255.255.255.128 --------------- e1000     c3-nfs-0-2         
c3-0-2:  ------- eth2  00:14:4f:0f:b0:c4 --------------- --------------- --------------- e1000     -------------------
c3-0-2:  ------- eth3  00:14:4f:0f:b0:c5 --------------- --------------- --------------- e1000     -------------------
c3-0-3:  private eth0  00:14:4f:ed:c7:34 172.17.30.123   255.255.255.128 --------------- forcedeth c3-0-3             
c3-0-3:  nfs     eth1  00:14:4f:ed:c7:35 172.17.30.251   255.255.255.128 --------------- forcedeth c3-nfs-0-3         
c3-0-3:  ------- eth2  00:14:4f:ed:c7:36 --------------- --------------- --------------- forcedeth -------------------
c3-0-3:  ------- eth3  00:14:4f:ed:c7:37 --------------- --------------- --------------- forcedeth -------------------
c3-0-4:  private eth0  00:14:4f:ed:c4:0c 172.17.30.122   255.255.255.128 --------------- forcedeth c3-0-4             
c3-0-4:  nfs     eth1  00:14:4f:ed:c4:0d 172.17.30.250   255.255.255.128 --------------- forcedeth c3-nfs-0-4         
c3-0-4:  ------- eth2  00:14:4f:ed:c4:0e --------------- --------------- --------------- forcedeth -------------------
c3-0-4:  ------- eth3  00:14:4f:ed:c4:0f --------------- --------------- --------------- forcedeth -------------------
c3-0-5:  private eth0  00:14:4f:ed:c4:14 172.17.30.121   255.255.255.128 --------------- forcedeth c3-0-5             
c3-0-5:  nfs     eth1  00:14:4f:ed:c4:15 172.17.30.249   255.255.255.128 --------------- forcedeth c3-nfs-0-5         
c3-0-5:  ------- eth2  00:14:4f:ed:c4:16 --------------- --------------- --------------- forcedeth -------------------
c3-0-5:  ------- eth3  00:14:4f:ed:c4:17 --------------- --------------- --------------- forcedeth -------------------
c3-0-6:  private eth0  00:14:4f:ed:c7:28 172.17.30.120   255.255.255.128 --------------- --------- c3-0-6             
c3-0-6:  nfs     eth1  00:14:4f:ed:c7:29 172.17.30.248   255.255.255.128 --------------- --------- c3-nfs-0-6         
c3-0-6:  ------- eth2  00:14:4f:ed:c7:2a --------------- --------------- --------------- --------- -------------------
c3-0-6:  ------- eth3  00:14:4f:ed:c7:2b --------------- --------------- --------------- --------- -------------------
c3-0-7:  private eth0  00:14:4f:ed:c7:6c 172.17.30.119   255.255.255.128 --------------- --------- c3-0-7             
c3-0-7:  nfs     eth1  00:14:4f:ed:c7:6d 172.17.30.247   255.255.255.128 --------------- --------- c3-nfs-0-7         
c3-0-7:  ------- eth2  00:14:4f:ed:c7:6e --------------- --------------- --------------- --------- -------------------
c3-0-7:  ------- eth3  00:14:4f:ed:c7:6f --------------- --------------- --------------- --------- -------------------
c3-0-8:  private eth0  00:14:4f:ed:bd:8c 172.17.30.118   255.255.255.128 --------------- --------- c3-0-8             
c3-0-8:  nfs     eth1  00:14:4f:ed:bd:8d 172.17.30.246   255.255.255.128 --------------- --------- c3-nfs-0-8         
c3-0-8:  ------- eth2  00:14:4f:ed:bd:8e --------------- --------------- --------------- --------- -------------------
c3-0-8:  ------- eth3  00:14:4f:ed:bd:8f --------------- --------------- --------------- --------- -------------------
c3-0-9:  private eth0  00:14:4f:ed:bd:14 172.17.30.117   255.255.255.128 --------------- --------- c3-0-9             
c3-0-9:  nfs     eth1  00:14:4f:ed:bd:15 172.17.30.245   255.255.255.128 --------------- --------- c3-nfs-0-9         
c3-0-9:  ------- eth2  00:14:4f:ed:bd:16 --------------- --------------- --------------- --------- -------------------
c3-0-9:  ------- eth3  00:14:4f:ed:bd:17 --------------- --------------- --------------- --------- -------------------
c3-0-10: private eth0  00:14:4f:ed:ba:a0 172.17.30.116   255.255.255.128 --------------- --------- c3-0-10            
c3-0-10: nfs     eth1  00:14:4f:ed:ba:a1 172.17.30.244   255.255.255.128 --------------- --------- c3-nfs-0-10        
c3-0-10: ------- eth2  00:14:4f:ed:ba:a2 --------------- --------------- --------------- --------- -------------------
c3-0-10: ------- eth3  00:14:4f:ed:ba:a3 --------------- --------------- --------------- --------- -------------------
c3-0-11: private eth0  00:14:4f:ed:bd:a0 172.17.30.115   255.255.255.128 --------------- --------- c3-0-11            
c3-0-11: nfs     eth1  00:14:4f:ed:bd:a1 172.17.30.243   255.255.255.128 --------------- --------- c3-nfs-0-11        
c3-0-11: ------- eth2  00:14:4f:ed:bd:a2 --------------- --------------- --------------- --------- -------------------
c3-0-11: ------- eth3  00:14:4f:ed:bd:a3 --------------- --------------- --------------- --------- -------------------
c3-0-12: private eth0  00:14:4f:ed:bd:98 172.17.30.114   255.255.255.128 --------------- --------- c3-0-12            
c3-0-12: nfs     eth1  00:14:4f:ed:bd:99 172.17.30.242   255.255.255.128 --------------- --------- c3-nfs-0-12        
c3-0-12: ------- eth2  00:14:4f:ed:bd:9a --------------- --------------- --------------- --------- -------------------
c3-0-12: ------- eth3  00:14:4f:ed:bd:9b --------------- --------------- --------------- --------- -------------------
c3-0-13: private eth0  00:14:4f:ed:c3:b4 172.17.30.113   255.255.255.128 --------------- forcedeth c3-0-13            
c3-0-13: nfs     eth1  00:14:4f:ed:c3:b5 172.17.30.241   255.255.255.128 --------------- forcedeth c3-nfs-0-13        
c3-0-13: ------- eth2  00:14:4f:ed:c3:b6 --------------- --------------- --------------- forcedeth -------------------
c3-0-13: ------- eth3  00:14:4f:ed:c3:b7 --------------- --------------- --------------- forcedeth -------------------
========



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 7630 bytes
Desc: not available
Url : https://lists.sdsc.edu/pipermail/npaci-rocks-discussion/attachments/20081208/fb86549f/attachment.bin 


More information about the npaci-rocks-discussion mailing list