xentaur

changeset 65:cf823d27b029

Nattaur changes
author nata@nattaur
date Mon Oct 12 00:12:11 2009 +0300 (2009-10-12)
parents baf0c3300c19
children aaf034af3a35
files build-xenomips-image files/xenomips.sh xendomain.py xentaur.py
line diff
     1.1 --- a/build-xenomips-image	Sun Jun 29 09:03:52 2008 +0000
     1.2 +++ b/build-xenomips-image	Mon Oct 12 00:12:11 2009 +0300
     1.3 @@ -1,6 +1,6 @@
     1.4  #!/bin/sh
     1.5  
     1.6 -DYNAMIPS_BUILD=no
     1.7 +DYNAMIPS_BUILD=yes
     1.8  XENOMIPS_FS_BUILD=yes
     1.9  CONFIG_FS_BUILD=yes
    1.10  IOS_FS_BUILD=yes
    1.11 @@ -11,8 +11,8 @@
    1.12  }
    1.13  
    1.14  XENOMIPS_DIR="files/"
    1.15 -XENOMIPS_IMAGES_DIR="/xen/images/"
    1.16 -IOS_DIR="ios/"
    1.17 +XENOMIPS_IMAGES_DIR="/xentaur/images/"
    1.18 +IOS_DIR="/xentaur/ios/"
    1.19  SSH_OPEN_KEY=files/id_dsa.pub
    1.20  
    1.21  #Xenomips FS
    1.22 @@ -28,15 +28,14 @@
    1.23  IOS_FS_SIZE=2048k
    1.24  IOS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-ios1.img
    1.25  
    1.26 -DEBIAN_MIRROR=ftp://debian.org.ua/debian
    1.27 -DISTRO=etch
    1.28 -PACKAGES="openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump telnet ntpdate hping3 ntp nmap netcat socat"
    1.29 +DEBIAN_MIRROR=http://127.0.0.1:9999/debian
    1.30 +DISTRO=lenny
    1.31 +PACKAGES="udev openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump telnet ntpdate hping3 ntp nmap netcat socat"
    1.32  DYNAMIPS_SOURCES=http://www.ipflow.utc.fr/dynamips/dynamips-0.2.7.tar.gz
    1.33  DYNAMIPS_BUILD_DIR=dynamips/
    1.34  PIXEMU_SOURCES=http://xgu.ru/download/pemu_public2007-07-02.tar.bz2
    1.35  PIXEMU_BUILD_DIR=dynamips/
    1.36 -KERNEL_VERSION=`uname -r`
    1.37 -
    1.38 +KERNEL_VERSION="2.6.26-2-xen-686 2.6.18-6-xen-686"   #`uname -r`
    1.39  
    1.40  WORK_DIR=${XENOMIPS_FS_NAME%%.img}
    1.41  WORK_DIR2=/tmp/xenomips-build
    1.42 @@ -121,6 +120,14 @@
    1.43  #iface eth0 inet dhcp
    1.44  INTERFACES
    1.45  
    1.46 +cat <<EOF >> /etc/inittab
    1.47 +1h:2345:respawn:/sbin/getty 38400 hvc0
    1.48 +EOF
    1.49 +
    1.50 +cat <<EOF >> /etc/modules
    1.51 +iptable_nat
    1.52 +EOF
    1.53 +
    1.54  #echo /usr/local/bin/xenomips.sh > /etc/rc.local
    1.55  cd /etc/rcS.d; ln -s ../init.d/xenomips-init S35xenomips-init
    1.56  rm /etc/rc2.d/S*quagga
    1.57 @@ -146,7 +153,7 @@
    1.58  
    1.59      for kernel_version in ${KERNEL_VERSION} 2.6.18-without-PAE-4-xen-686
    1.60      do
    1.61 -        cp -R /lib/modules/${KERNEL_VERSION} ${WORK_DIR}/lib/modules
    1.62 +        cp -R /lib/modules/${kernel_version} ${WORK_DIR}/lib/modules
    1.63      done
    1.64  
    1.65      cp ${XENOMIPS_DIR}/xenomips-init ${WORK_DIR}/etc/init.d/
    1.66 @@ -157,7 +164,7 @@
    1.67      chmod 600  ${WORK_DIR}/root/.ssh/authorized_keys
    1.68  
    1.69      build_and_install_dynamips
    1.70 -    build_and_install_pixemu
    1.71 +    #build_and_install_pixemu
    1.72      kill $(lsof +D ${WORK_DIR} | awk '{print $2}' | grep -v PID)
    1.73      pkill ntpd
    1.74      umount ${WORK_DIR}
     2.1 --- a/files/xenomips.sh	Sun Jun 29 09:03:52 2008 +0000
     2.2 +++ b/files/xenomips.sh	Mon Oct 12 00:12:11 2009 +0300
     2.3 @@ -5,6 +5,7 @@
     2.4  
     2.5  case $1 in
     2.6      start)
     2.7 +	[ -e /dev/hvc0 ] || ln -s /dev/null /dev/hvc0
     2.8          if grep -qi xenomips /proc/cmdline
     2.9          then 
    2.10              WORKDIR="/xenomips/config/dynamips"
     3.1 --- a/xendomain.py	Sun Jun 29 09:03:52 2008 +0000
     3.2 +++ b/xendomain.py	Mon Oct 12 00:12:11 2009 +0300
     3.3 @@ -13,7 +13,7 @@
     3.4  
     3.5  import os
     3.6  
     3.7 -sys.path.append(os.environ['HOME']+"/xentaur")
     3.8 +sys.path.append("/xentaur/xentaur")
     3.9  sys.path.append('.')
    3.10  os.environ['xendomain']=domain
    3.11  
    3.12 @@ -81,13 +81,16 @@
    3.13  N = domains.index(domain)
    3.14  name=domain
    3.15  
    3.16 -pae=1
    3.17 -if pae:
    3.18 -    kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
    3.19 -    ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
    3.20 -else:
    3.21 -    kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
    3.22 -    ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
    3.23 +try:
    3.24 +    kernel
    3.25 +except:
    3.26 +    pae=1
    3.27 +    if pae:
    3.28 +        kernel="/boot/vmlinuz-2.6.18-6-xen-686"
    3.29 +        ramdisk = "/boot/initrd.img-2.6.18-6-xen-686"
    3.30 +    else:
    3.31 +        kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
    3.32 +        ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
    3.33  
    3.34  #builder='linux'
    3.35  cpu_cap = 10
    3.36 @@ -134,12 +137,12 @@
    3.37  else:
    3.38      if hvm:
    3.39          if domain_types[N] == 'linux':
    3.40 -            disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda,w' ]
    3.41 +            disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda,w' ]
    3.42          else:
    3.43 -            disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda,w', 'file:/xen/xentaur-images/'+network+'/'+name+'-disk2.img,hdb,w' ]
    3.44 +            disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda,w', 'file:/xen/xentaur-images/'+network+'/'+name+'-disk2.img,hdb,w' ]
    3.45  
    3.46      else:
    3.47 -        disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda1,w' ]
    3.48 +        disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda1,w' ]
    3.49  
    3.50  root = "/dev/hda1 ro"
    3.51  
    3.52 @@ -188,7 +191,7 @@
    3.53          for i in range(len(vbridges)-1):
    3.54              xenomips += ' -p '+str(i+1)+':'+network_module
    3.55      for i in range(len(vbridges)):
    3.56 -        xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
    3.57 +        xenomips += ' -s '+str(i)+':0:linux_eth:eth'+str(i)
    3.58      extra = "xenomips=\""+xenomips+"\""
    3.59  elif domain_types[N] == 'pixemu':
    3.60      xenomips="./pemu -net nic,vlan=1,macaddr=00:aa:00:00:02:01 -net pcap,vlan=1,ifname=eth0 -net nic,vlan=2,macaddr=00:aa:00:00:02:02 -net pcap,vlan=2,ifname=eth1 -serial stdio -m 128 FLASH"+' /xenomips/ios/'+ios_name
     4.1 --- a/xentaur.py	Sun Jun 29 09:03:52 2008 +0000
     4.2 +++ b/xentaur.py	Mon Oct 12 00:12:11 2009 +0300
     4.3 @@ -3,19 +3,18 @@
     4.4  
     4.5  import sys,os,time
     4.6  
     4.7 -xentaur_path=os.environ['HOME']+"/xentaur"
     4.8 +xentaur_path="/xentaur/xentaur"
     4.9  
    4.10  sys.path.append('/etc/xen')
    4.11  sys.path.append(xentaur_path)
    4.12  sys.path.append('.')
    4.13  
    4.14 -#network='snrs_ipsec_rsa_1'
    4.15  node_object={}
    4.16  link_object={}
    4.17  bridge_object={}
    4.18  
    4.19 -network='openvpnbridge'
    4.20 -domain='debian1'
    4.21 +network='multicast'
    4.22 +domain='dyn1'
    4.23  
    4.24  #network='snrs'
    4.25  #domain='dyn1'
    4.26 @@ -26,8 +25,8 @@
    4.27  from IPython.Shell import IPShellEmbed
    4.28  
    4.29  
    4.30 -screenrc=os.environ['HOME']+"/.screenrc_xentaur"
    4.31 -path_shapes='/xen/xentaur/shapes'
    4.32 +screenrc=".screenrc_xentaur_"+network
    4.33 +path_shapes='/xentaur/xentaur/shapes'
    4.34  
    4.35  def run(program, *args):
    4.36      pid = os.fork()
    4.37 @@ -178,10 +177,9 @@
    4.38  hardstatus alwayslastline
    4.39  %s
    4.40  
    4.41 -screen -t console 0 sh -c 'while true; do cd %s; ./xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done'
    4.42 -#screen -t xentaur - sh -c 'while true; do bash ; echo Retrying in %s secods...; sleep %s ; clear; done'
    4.43 +screen -t console 0 sh -c 'while true; do %s/xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done'
    4.44  %s
    4.45 -""" % (hardstatus,xentaur_path,wait_seconds,wait_seconds,wait_seconds,wait_seconds,screenlist))
    4.46 +""" % (hardstatus,xentaur_path,wait_seconds,wait_seconds,screenlist))
    4.47      f.close()
    4.48      print "# GNU Screen config file is written to: %s" % screenrc
    4.49  
    4.50 @@ -366,7 +364,7 @@
    4.51          return self.name+" [color=white,shape=plaintext,label=\"  "+self.name+"\",shapefile=\""+path_shapes+"/all/"+\
    4.52          domain_types[domains.index(self.name)]+".png\",fontcolor=black,fontsize=16,target=\"http://google.com\"]"
    4.53      def console_string(self):
    4.54 -        if self.type in [ 'quagga', 'xenomips', 'freebsd', 'linux' ]:
    4.55 +        if self.type in [ 'quagga', 'dynamips', 'freebsd', 'linux' ]:
    4.56              return "sudo xm console "+self.name
    4.57          elif self.name in real_bridges or self.name in real_nodes:
    4.58              return "echo Press enter to connect; read line; "+connection_table[self.name]