[Collab-qa-commits] r657 - in debcluster: . misc/qemu scripts scripts/bin scripts/tasks
lucas at alioth.debian.org
lucas at alioth.debian.org
Fri Jan 18 15:47:40 UTC 2008
Author: lucas
Date: 2008-01-18 15:47:40 +0000 (Fri, 18 Jan 2008)
New Revision: 657
Modified:
debcluster/Notes
debcluster/misc/qemu/setupbridge.bash
debcluster/scripts/bin/dc-mountnfs
debcluster/scripts/masternode.rb
debcluster/scripts/tasks/preparenode.rb
Log:
updates. virtualisation should work, now
Modified: debcluster/Notes
===================================================================
--- debcluster/Notes 2008-01-18 13:28:32 UTC (rev 656)
+++ debcluster/Notes 2008-01-18 15:47:40 UTC (rev 657)
@@ -224,7 +224,7 @@
ssh gluck chmod -R a+rX public_html/
# sync bdfh
-rsync -avzP --delete . root at idpot.grenoble.grid5000.fr:/nfs-scratch/grenoble/lnussbaum/root-bdfh/
+rsync -avzP --delete . root at idpot.grenoble.grid5000.fr:/nfs-scratch/grenoble/lnussbaum/debcluster-data/root-bdfh/
### BDFH
TLT=/tmp/tasklisttext_sid32-i386.2008-01-08
Modified: debcluster/misc/qemu/setupbridge.bash
===================================================================
--- debcluster/misc/qemu/setupbridge.bash 2008-01-18 13:28:32 UTC (rev 656)
+++ debcluster/misc/qemu/setupbridge.bash 2008-01-18 15:47:40 UTC (rev 657)
@@ -4,7 +4,7 @@
set -x
if ! grep -q br0 /etc/network/interfaces; then
-cat <<EOF >> /etc/network/interfaces
+ cat <<EOF >> /etc/network/interfaces
iface br0 inet dhcp
bridge_ports eth0
@@ -13,6 +13,7 @@
bridge_fd 1
bridge_hello 1
EOF
+fi
ifdown br0 || true
Modified: debcluster/scripts/bin/dc-mountnfs
===================================================================
--- debcluster/scripts/bin/dc-mountnfs 2008-01-18 13:28:32 UTC (rev 656)
+++ debcluster/scripts/bin/dc-mountnfs 2008-01-18 15:47:40 UTC (rev 657)
@@ -8,9 +8,49 @@
export DEBIAN_FRONTEND=noninteractive
apt-get -y install nfs-common initscripts sysvinit-utils
+# cleanup
umount -l /idpotscratch &>/dev/null || true
mkdir /idpotscratch &>/dev/null || true
rm -f /debcluster-data /debcluster-scripts &>/dev/null || true
+
+# setup bridge if neeeded
+if [ "$1" = "bridge" ];then
+ apt-get -y install bridge-utils
+ if ! grep -q br0 /etc/network/interfaces; then
+ cat <<EOF >> /etc/network/interfaces
+
+iface br0 inet dhcp
+ bridge_ports eth0
+ bridge_maxwait 0
+ bridge_stp off
+ bridge_fd 1
+ bridge_hello 1
+EOF
+ fi
+
+ ifdown br0 || true
+ ifconfig br0 down || true
+ brctl delbr br0 || true
+ cat <<EOF >> /etc/dhcp3/dhclient.conf
+ select-timeout 2;
+ initial-interval 1;
+EOF
+
+ echo "###################"
+ ifdown eth0
+ echo "###################"
+ sleep 1
+ echo "###################"
+ ifconfig eth0 0.0.0.0 promisc up
+ echo "###################"
+ sleep 1
+ echo "###################"
+ ifup br0
+ echo "###################"
+ sleep 1
+fi
+
+# do mount
mount -t nfs -o rw,hard,intr,async,nfsvers=3,rsize=32768,wsize=32768 idpot.grenoble.grid5000.fr:/nfs-scratch /idpotscratch
ln -sf /idpotscratch/grenoble/lnussbaum/debcluster-data /debcluster-data
ln -sf /idpotscratch/grenoble/lnussbaum/collab-qa/debcluster /debcluster-scripts
Modified: debcluster/scripts/masternode.rb
===================================================================
--- debcluster/scripts/masternode.rb 2008-01-18 13:28:32 UTC (rev 656)
+++ debcluster/scripts/masternode.rb 2008-01-18 15:47:40 UTC (rev 657)
@@ -42,20 +42,26 @@
]
# https://www.grid5000.fr/mediawiki/index.php/Network_interlink#IP.27s_for_virtual_machines
NET_GW = {
+ 'bordeaux' => '10.131.255.254',
+ 'lille' => '10.139.255.254',
+ 'lyon' => '10.143.255.254',
+ 'nancy' => '10.147.255.254',
+ 'orsay' => '10.155.255.254',
'rennes' => '10.159.255.254',
- 'sophia' => '10.167.255.254',
- 'toulouse' => '10.163.255.254'
+ 'toulouse' => '10.163.255.254',
+ 'sophia' => '10.167.255.254'
}
-NET_NS = {
- 'rennes' => '131.254.202.5',
- 'sophia' => '138.96.20.225',
- 'toulouse' => '192.168.22.2'
-}
NET_ADDR = {
+ 'bordeaux' => '10.128.0.1',
+ 'lille' => '10.132.0.1',
+ 'lyon' => '10.140.0.1',
+ 'nancy' => '10.144.0.1',
+ 'orsay' => '10.148.0.1',
'rennes' => '10.156.0.1',
- 'sophia' => '10.164.0.1',
- 'toulouse' => '10.160.0.1'
+ 'toulouse' => '10.160.0.1',
+ 'sophia' => '10.164.0.1'
}
+NET_NS = '129.88.70.61'
$first_addr = {}
SSHOPTS="-o BatchMode=yes -o StrictHostKeyChecking=no"
@@ -103,6 +109,24 @@
end
end
+class Node
+ attr_accessor :hostname, :ident, :netaddr
+
+ def initialize(hostname, ident)
+ @hostname = hostname
+ @ident = ident
+ if $virt
+ @netaddr = @ident
+ else
+ @netaddr = @hostname
+ end
+ end
+
+ def to_s
+ "#{@hostname}-#{@ident}"
+ end
+end
+
def preparenode(n, vn, ns, gw)
puts "Preparing #{n}..." if DEBUG_PREP
system("ssh #{SSHOPTS} #{n} exit 42")
@@ -110,8 +134,13 @@
puts "E:Public key auth on #{n} failed."
return false
end
+ if $virt
+ bridge="bridge"
+ else
+ bridge=""
+ end
system("scp #{SSHOPTS} /debcluster-scripts/scripts/bin/dc-mountnfs #{n}:/root/dc-mountnfs")
- system("ssh #{SSHOPTS} #{n} \"/root/dc-mountnfs\" &> /root/mountnfs.log.#{n}")
+ system("ssh #{SSHOPTS} #{n} \"/root/dc-mountnfs #{bridge}\" &> /root/mountnfs.log.#{n}")
if $virt
virt="-v -m #{vn.join(' -m ')} -n #{ns} -g #{gw}"
else
@@ -256,19 +285,6 @@
end
end
-class Node
- attr_accessor :hostname, :ident
-
- def initialize(hostname, ident)
- @hostname = hostname
- @ident = ident
- end
-
- def to_s
- "#{@hostname}-#{@ident}"
- end
-end
-
def managenode(nodehost)
# nodehost is just the node name in text.
nbsubnodes = $default_tasks_per_node # default value
@@ -293,7 +309,7 @@
$first_addr[cluster] = $first_addr[cluster].next
end
end
- return if not preparenode(nodehost, vn, NET_NS['cluster'], NET_GW['cluster'])
+ return if not preparenode(nodehost, vn, NET_NS, NET_GW[cluster])
if $virt
vn.each do |i|
node = Node::new(nodehost, i)
@@ -319,7 +335,7 @@
while running do
t = nil
$mutex.synchronize do
- # Take the last element, that is, the bigger.
+ # Take the last element, that is, the biggest.
t = $wtasks.pop
end
if t.nil?
@@ -332,7 +348,7 @@
t.starttime = Time::now
puts "#{node}: running #{t}"
end
- ret = runtask(node.hostname, t.command)
+ ret = runtask(node.netaddr, t.command)
$mutex.synchronize do
if ret
puts "#{node}: finished #{t}"
Modified: debcluster/scripts/tasks/preparenode.rb
===================================================================
--- debcluster/scripts/tasks/preparenode.rb 2008-01-18 13:28:32 UTC (rev 656)
+++ debcluster/scripts/tasks/preparenode.rb 2008-01-18 15:47:40 UTC (rev 657)
@@ -106,17 +106,22 @@
if virt
# VIRT-specific stuff
- system("apt-get -y install pkg-config bridge-utils screen qemu")
- system("cp /debcluster-scripts/misc/qemu/setupbridge.bash /root")
- system("cd /root ; ./setupbridge.bash < /dev/null &>/root/iflog ; cat /root/iflog")
+ system("apt-get -y install screen qemu")
system("rsync -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' -avzP lnussbaum at idpot.grenoble.grid5000.fr:debcluster-data/qemu/hda-mips.qcow2 /debscratch/hda-mips.qcow2")
system("tar -C / -xzf /debcluster-data/qemu/qemu-bin.tgz")
system("cp /debcluster-data/qemu/{initrd.gz,vmlinux-2.6.18-5-qemu} /debscratch")
vn.each do |v|
- system("cd /debscratch && screen -d -m \"qemu-system-mips -kernel vmlinux-2.6.18-5-qemu -initrd initrd.gz -hda hda-mips.qcow2 -append \\\"root=/dev/hda1 console=ttyS0 ip=#{v} mask=255.252.0.0 ns=138.96.20.225 gw=10.167.255.254\\\" -nographic -net nic -net tap,script=/debcluster-scripts/configs/qemu-ifup -m 256 -snapshot\"")
+ puts "Starting #{v} ..."
+ f=`mktemp /tmp/screencmd.XXXXXX`.chomp
+ fd = File::new(f, 'w')
+ fd.puts("/usr/local/bin/qemu-system-mips -kernel vmlinux-2.6.18-5-qemu -initrd initrd.gz -hda hda-mips.qcow2 -append \"root=/dev/hda1 console=ttyS0 ip=#{v} mask=255.252.0.0 ns=#{ns} gw=#{gw}\" -nographic -net nic -net tap,script=/debcluster-scripts/configs/qemu-ifup -m 256 -snapshot")
+ fd.close
+ system("chmod a+x #{f}")
+ system("cd /debscratch && screen -d -m \"#{f}\"")
end
- puts "Sleeping 30 seconds to let qemu nodes the time to boot."
- sleep 30
+ SLE=120
+ puts "Sleeping #{SLE} seconds to let qemu nodes the time to boot."
+ sleep SLE
end
puts "Finishing preparenode.rb -- #{Time::now}"
More information about the Collab-qa-commits
mailing list