# HG changeset patch # User nata@nattaur # Date 1255295531 -10800 # Node ID cf823d27b0295c425837e1851eb236a69b25fb85 # Parent baf0c3300c191628c72e1df154f8b0bc90a44790 Nattaur changes diff -r baf0c3300c19 -r cf823d27b029 build-xenomips-image --- a/build-xenomips-image Sun Jun 29 09:03:52 2008 +0000 +++ b/build-xenomips-image Mon Oct 12 00:12:11 2009 +0300 @@ -1,6 +1,6 @@ #!/bin/sh -DYNAMIPS_BUILD=no +DYNAMIPS_BUILD=yes XENOMIPS_FS_BUILD=yes CONFIG_FS_BUILD=yes IOS_FS_BUILD=yes @@ -11,8 +11,8 @@ } XENOMIPS_DIR="files/" -XENOMIPS_IMAGES_DIR="/xen/images/" -IOS_DIR="ios/" +XENOMIPS_IMAGES_DIR="/xentaur/images/" +IOS_DIR="/xentaur/ios/" SSH_OPEN_KEY=files/id_dsa.pub #Xenomips FS @@ -28,15 +28,14 @@ IOS_FS_SIZE=2048k IOS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-ios1.img -DEBIAN_MIRROR=ftp://debian.org.ua/debian -DISTRO=etch -PACKAGES="openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump telnet ntpdate hping3 ntp nmap netcat socat" +DEBIAN_MIRROR=http://127.0.0.1:9999/debian +DISTRO=lenny +PACKAGES="udev openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump telnet ntpdate hping3 ntp nmap netcat socat" DYNAMIPS_SOURCES=http://www.ipflow.utc.fr/dynamips/dynamips-0.2.7.tar.gz DYNAMIPS_BUILD_DIR=dynamips/ PIXEMU_SOURCES=http://xgu.ru/download/pemu_public2007-07-02.tar.bz2 PIXEMU_BUILD_DIR=dynamips/ -KERNEL_VERSION=`uname -r` - +KERNEL_VERSION="2.6.26-2-xen-686 2.6.18-6-xen-686" #`uname -r` WORK_DIR=${XENOMIPS_FS_NAME%%.img} WORK_DIR2=/tmp/xenomips-build @@ -121,6 +120,14 @@ #iface eth0 inet dhcp INTERFACES +cat <> /etc/inittab +1h:2345:respawn:/sbin/getty 38400 hvc0 +EOF + +cat <> /etc/modules +iptable_nat +EOF + #echo /usr/local/bin/xenomips.sh > /etc/rc.local cd /etc/rcS.d; ln -s ../init.d/xenomips-init S35xenomips-init rm /etc/rc2.d/S*quagga @@ -146,7 +153,7 @@ for kernel_version in ${KERNEL_VERSION} 2.6.18-without-PAE-4-xen-686 do - cp -R /lib/modules/${KERNEL_VERSION} ${WORK_DIR}/lib/modules + cp -R /lib/modules/${kernel_version} ${WORK_DIR}/lib/modules done cp ${XENOMIPS_DIR}/xenomips-init ${WORK_DIR}/etc/init.d/ @@ -157,7 +164,7 @@ chmod 600 ${WORK_DIR}/root/.ssh/authorized_keys build_and_install_dynamips - build_and_install_pixemu + #build_and_install_pixemu kill $(lsof +D ${WORK_DIR} | awk '{print $2}' | grep -v PID) pkill ntpd umount ${WORK_DIR} diff -r baf0c3300c19 -r cf823d27b029 files/xenomips.sh --- a/files/xenomips.sh Sun Jun 29 09:03:52 2008 +0000 +++ b/files/xenomips.sh Mon Oct 12 00:12:11 2009 +0300 @@ -5,6 +5,7 @@ case $1 in start) + [ -e /dev/hvc0 ] || ln -s /dev/null /dev/hvc0 if grep -qi xenomips /proc/cmdline then WORKDIR="/xenomips/config/dynamips" diff -r baf0c3300c19 -r cf823d27b029 xendomain.py --- a/xendomain.py Sun Jun 29 09:03:52 2008 +0000 +++ b/xendomain.py Mon Oct 12 00:12:11 2009 +0300 @@ -13,7 +13,7 @@ import os -sys.path.append(os.environ['HOME']+"/xentaur") +sys.path.append("/xentaur/xentaur") sys.path.append('.') os.environ['xendomain']=domain @@ -81,13 +81,16 @@ N = domains.index(domain) name=domain -pae=1 -if pae: - kernel = "/boot/vmlinuz-2.6.18-4-xen-686" - ramdisk = "/boot/initrd.img-2.6.18-4-xen-686" -else: - kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686" - ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU" +try: + kernel +except: + pae=1 + if pae: + kernel="/boot/vmlinuz-2.6.18-6-xen-686" + ramdisk = "/boot/initrd.img-2.6.18-6-xen-686" + else: + kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686" + ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU" #builder='linux' cpu_cap = 10 @@ -134,12 +137,12 @@ else: if hvm: if domain_types[N] == 'linux': - disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda,w' ] + disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda,w' ] else: - disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda,w', 'file:/xen/xentaur-images/'+network+'/'+name+'-disk2.img,hdb,w' ] + disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda,w', 'file:/xen/xentaur-images/'+network+'/'+name+'-disk2.img,hdb,w' ] else: - disk = [ 'file:/xen/xentaur-images/'+network+'/'+name+'.img,hda1,w' ] + disk = [ 'file:/xentaur/images/'+network+'/'+name+'.img,hda1,w' ] root = "/dev/hda1 ro" @@ -188,7 +191,7 @@ for i in range(len(vbridges)-1): xenomips += ' -p '+str(i+1)+':'+network_module for i in range(len(vbridges)): - xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i) + xenomips += ' -s '+str(i)+':0:linux_eth:eth'+str(i) extra = "xenomips=\""+xenomips+"\"" elif domain_types[N] == 'pixemu': 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 diff -r baf0c3300c19 -r cf823d27b029 xentaur.py --- a/xentaur.py Sun Jun 29 09:03:52 2008 +0000 +++ b/xentaur.py Mon Oct 12 00:12:11 2009 +0300 @@ -3,19 +3,18 @@ import sys,os,time -xentaur_path=os.environ['HOME']+"/xentaur" +xentaur_path="/xentaur/xentaur" sys.path.append('/etc/xen') sys.path.append(xentaur_path) sys.path.append('.') -#network='snrs_ipsec_rsa_1' node_object={} link_object={} bridge_object={} -network='openvpnbridge' -domain='debian1' +network='multicast' +domain='dyn1' #network='snrs' #domain='dyn1' @@ -26,8 +25,8 @@ from IPython.Shell import IPShellEmbed -screenrc=os.environ['HOME']+"/.screenrc_xentaur" -path_shapes='/xen/xentaur/shapes' +screenrc=".screenrc_xentaur_"+network +path_shapes='/xentaur/xentaur/shapes' def run(program, *args): pid = os.fork() @@ -178,10 +177,9 @@ hardstatus alwayslastline %s -screen -t console 0 sh -c 'while true; do cd %s; ./xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done' -#screen -t xentaur - sh -c 'while true; do bash ; echo Retrying in %s secods...; sleep %s ; clear; done' +screen -t console 0 sh -c 'while true; do %s/xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done' %s -""" % (hardstatus,xentaur_path,wait_seconds,wait_seconds,wait_seconds,wait_seconds,screenlist)) +""" % (hardstatus,xentaur_path,wait_seconds,wait_seconds,screenlist)) f.close() print "# GNU Screen config file is written to: %s" % screenrc @@ -366,7 +364,7 @@ return self.name+" [color=white,shape=plaintext,label=\" "+self.name+"\",shapefile=\""+path_shapes+"/all/"+\ domain_types[domains.index(self.name)]+".png\",fontcolor=black,fontsize=16,target=\"http://google.com\"]" def console_string(self): - if self.type in [ 'quagga', 'xenomips', 'freebsd', 'linux' ]: + if self.type in [ 'quagga', 'dynamips', 'freebsd', 'linux' ]: return "sudo xm console "+self.name elif self.name in real_bridges or self.name in real_nodes: return "echo Press enter to connect; read line; "+connection_table[self.name]