From: Josip Rodin Date: Sun, 8 Nov 2009 19:27:52 +0000 (+0100) Subject: izgleda da je debug rezervirana varijable iz nekog razloga X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=2df54deaf84712a2e0920bc8df6de8f0aa76dce5;p=imunes.git izgleda da je debug rezervirana varijable iz nekog razloga --- diff --git a/linkcfg.tcl b/linkcfg.tcl index b7d8d16..4b0fb29 100755 --- a/linkcfg.tcl +++ b/linkcfg.tcl @@ -690,8 +690,8 @@ proc newLink { lnode1 lnode2 } { set ifname2 [newIfc [chooseIfName $lnode2 $lnode1] $lnode2] lappend $lnode2 "interface-peer {$ifname2 $lnode1}" - global debug - if { $debug } { + global imunes_debug + if { $imunes_debug } { puts "Create link" puts " nodetype 1: [nodeType $lnode1]" puts " nodetype 2: [nodeType $lnode2]" diff --git a/linux/exec.tcl b/linux/exec.tcl index 8592217..c2699ec 100755 --- a/linux/exec.tcl +++ b/linux/exec.tcl @@ -52,7 +52,7 @@ set eid_base [pid] proc nexec { args } { global remote_exec editor_only global execSock - global debug + global imunes_debug if { $remote_exec } { if { ![info exists execSock] || $execSock == "" } { @@ -70,7 +70,7 @@ proc nexec { args } { if { $remote_exec } { rexec $execSock $args } else { - if { $debug } { + if { $imunes_debug } { puts " -- running: $args" } eval exec $args @@ -255,8 +255,8 @@ proc statline {line} { # * name -- the name of the new interface #**** proc createIfc { eid type hook } { - global debug - if { $debug } { + global imunes_debug + if { $imunes_debug } { puts "usli u createIfc $eid $type $hook" } } @@ -279,8 +279,8 @@ proc createIfc { eid type hook } { # * node -- node id #**** proc l3node.instantiate { eid node } { - global debug - if { $debug } { + global imunes_debug + if { $imunes_debug } { puts "\nl3node.INSTANTIATE $eid $node" } @@ -370,9 +370,9 @@ proc l3node.nghook { eid node ifc } { proc l3node.start { eid node } { global remote_exec execSock global viewcustomid - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "\nl3node.START $eid $node" } @@ -388,7 +388,7 @@ proc l3node.start { eid node } { # nam omoguci razne korisne stvari tipa proc filesystem itd upvar 0 ::cf::[set ::curcfg]::[set node]::ve_dir ve_dir set ve_boot_done "$ve_dir/tmp/imunes-boot-done" - if { $debug } { + if { $imunes_debug } { puts -nonewline " Waiting for VE $node ($ve_id) to actually start " while { ! [ file exists $ve_boot_done ] } { after 300 @@ -411,7 +411,7 @@ proc l3node.start { eid node } { set peer [peerByIfc $node $ifc] - if { $debug } { + if { $imunes_debug } { puts " Interface $ifc at $node links to $peer" } @@ -498,18 +498,18 @@ proc l3node.start { eid node } { set bootcfg [[typemodel $node].cfggen $node] set bootcmd [[typemodel $node].bootcmd $node] } - if { $debug } { + if { $imunes_debug } { puts " typemodel = [typemodel $node]" puts " bootcmd = $bootcmd" puts " bootcfg = $bootcfg" } if { ! $remote_exec } { if { $bootcmd != "/bin/sh" } { - if { $debug } { + if { $imunes_debug } { puts " writing $node_dir/boot.conf" } set fileId [open $node_dir/boot.conf w] - if { $debug } { + if { $imunes_debug } { foreach line $bootcfg { puts $fileId $line } @@ -518,7 +518,7 @@ proc l3node.start { eid node } { } } else { nexec create_conf_file $node_dir/boot.conf - if { $debug } { + if { $imunes_debug } { foreach line $bootcfg { puts $execSock $line } @@ -536,7 +536,7 @@ proc l3node.start { eid node } { # pa ih se ignorira. Ako se preda prazan red kao naredba, takodjer je # vracen jedan prazan red pa se i to ignorira. if { $ret != "TCL_OK" && $ret != ""} { - if { $debug } { + if { $imunes_debug } { puts " =>Command \"$command\" executed on $node returned: \"$ret\"" } # TODO: batch mode handling @@ -550,19 +550,19 @@ proc l3node.start { eid node } { } else { # quagga i drugi mogu imati svoje custom skripte za bootanje koja se prepoznaje po # bootcmdu (interpreteru) koji nije obican shell - if { $debug } { + if { $imunes_debug } { puts " placing $bootcmd in $node_dir" } set bootfile [file tail $bootcmd] file copy $bootcmd "$node_dir/$bootfile" set command "/$bootfile boot.conf" - if { $debug } { + if { $imunes_debug } { puts " will now execute $command in $node_id" } # catch nexec vimage $node_id $bootcmd $node_dir/boot.conf >& $node_dir/out.log &" catch { nexec vzctl exec $node_id $command } ret if { $ret != "TCL_OK" && $ret != ""} { - if { $debug } { + if { $imunes_debug } { puts " =>Command \"$command\" executed on $node returned: \"$ret\"" } # TODO: batch mode handling @@ -589,9 +589,9 @@ proc l3node.start { eid node } { #**** proc l3node.shutdown { eid node } { upvar 0 ::cf::[set ::curcfg]::[set node]::node_id node_id - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts " Stopping VE $node ($node_id)" } statline "Stopping VE $node ($node_id)" @@ -615,7 +615,7 @@ proc l3node.shutdown { eid node } { proc l3node.destroy { eid node } { upvar 0 ::cf::[set ::curcfg]::[set node]::node_id node_id - global debug + global imunes_debug # TODO serial interface support # foreach ifc [ifcList $node] { @@ -629,7 +629,7 @@ proc l3node.destroy { eid node } { # } set msg "Destroying VE $node ($node_id)" - if { $debug } { + if { $imunes_debug } { puts " $msg" } statline $msg @@ -657,9 +657,9 @@ proc deployCfg {} { global mac_byte4 mac_byte5 global remote_exec global eid_base - global debug - - if { $debug } { + global imunes_debug + + if { $imunes_debug } { puts "\n= deployCfg starts =" } @@ -751,7 +751,7 @@ proc deployCfg {} { #jedan od nodeova je sigurno L2, sad provjerava da li se radi o vezi izmedju #dva L2 uredjaja if { [[typemodel $lnode1].layer] == "LINK" && [[typemodel $lnode2].layer] == "LINK" } { - if { $debug } { + if { $imunes_debug } { #slucaj kad su spojena dva huba!! puts "\n\n*********************************************************************" puts "**** Panic! Panic! Spojena su dva huba, nemogu ja to!! ***\n" @@ -794,11 +794,11 @@ proc deployCfg {} { } if { $bridgefound == true } { - if { $debug } { + if { $imunes_debug } { puts "\nBridge $bridge (L2 hub emulation) already exists." } } else { - if { $debug } { + if { $imunes_debug } { puts "\nCreating bridge $bridge (L2 hub emulation)" } nexec brctl addbr $bridge @@ -809,7 +809,7 @@ proc deployCfg {} { if { [nodeType $bridge_node] == "rj45" } { set bridge_name [getNodeName $bridge_node] nexec brctl addif $bridge $bridge_name - if { $debug } { + if { $imunes_debug } { puts " RJ45 emulacija, spojen na $bridge_name na hostu." } } @@ -818,7 +818,7 @@ proc deployCfg {} { nexec brctl addif $bridge $port_if #dize bridge, interesantno ne baca error ako je bridge vec dignut nexec ip link set up dev $bridge - if { $debug } { + if { $imunes_debug } { puts " L2 device $bridge is up, added interface $port_if" } @@ -829,7 +829,7 @@ proc deployCfg {} { set bridge "b$eid$lname" set bridge_node $lname - if { $debug } { + if { $imunes_debug } { puts "\nCreating bridge $bridge" } @@ -838,7 +838,7 @@ proc deployCfg {} { nexec brctl addif $bridge $host_if_a nexec brctl addif $bridge $host_if_b nexec ip link set up dev $bridge - if { $debug } { + if { $imunes_debug } { puts " Bridge $bridge is up, added interface $host_if_a and $host_if_b" } } @@ -846,7 +846,7 @@ proc deployCfg {} { } set msg "Network topology instantiated in [expr [clock seconds] - $t_start] seconds ([llength $node_list] nodes and [llength $link_list] links)." statline $msg - if { $debug } { + if { $imunes_debug } { puts "\n$msg" puts "\n= deployCfg end =" } @@ -865,35 +865,35 @@ proc deployCfg {} { proc vimageCleanup { eid } { global .c global execMode - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "\n= Cleanup $eid start =" } set t_start [clock seconds] - if { $debug } { + if { $imunes_debug } { puts "\nBridge cleanup in main host" } upvar 0 ::cf::[set ::curcfg]::bridges bridges if { [ info exists bridges ] && [ llength $bridges ] } { foreach bridge $bridges { - if { $debug } { + if { $imunes_debug } { puts " Cleaning up bridge $bridge..." } nexec ip link set down dev $bridge nexec brctl delbr $bridge } } - if { $debug } { + if { $imunes_debug } { puts " Done.\n" } # OpenVZ - samo nam treba popis nodeova za pogasiti upvar 0 ::cf::[set ::curcfg]::node_list node_list - if { $debug } { + if { $imunes_debug } { puts "Stopping all VEs..." } foreach node $node_list { @@ -904,7 +904,7 @@ proc vimageCleanup { eid } { # bridge suceljem a ne VEom iako su u $node_list, stoga nema se sto gasiti } } - if { $debug } { + if { $imunes_debug } { puts " Done.\n" puts "Destroying VE private enviroments..." } @@ -920,7 +920,7 @@ proc vimageCleanup { eid } { set msg "Cleanup completed in [expr [clock seconds] - $t_start] seconds." statline $msg - if { $debug } { + if { $imunes_debug } { puts " $msg" puts " Done.\n" puts "\n= Cleanup $eid end =" @@ -944,9 +944,9 @@ proc vimageCleanup { eid } { # qdisc -- queuing discipline #**** proc execSetIfcQDisc { eid node ifc qdisc } { - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "execSetIfcQDisc $eid $node $ifc $qdisc" } return @@ -989,9 +989,9 @@ proc execSetIfcQDisc { eid node ifc qdisc } { # qdrop -- queue dropping policy #**** proc execSetIfcQDrop { eid node ifc qdrop } { - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "execSetIfcQDrop $eid $node $ifc $qdrop" } return @@ -1033,9 +1033,9 @@ proc execSetIfcQDrop { eid node ifc qdrop } { # qlen -- new queue's length #**** proc execSetIfcQLen { eid node ifc qlen } { - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "execSetIfcQLen $eid $node $ifc $qlen" } return @@ -1073,9 +1073,9 @@ proc execSetIfcQLen { eid node ifc qlen } { # link -- link id #**** proc execSetLinkParams { eid link } { - global debug + global imunes_debug - if { $debug } { + if { $imunes_debug } { puts "execSetLinkParams $eid $link" } return diff --git a/linux/quagga.tcl b/linux/quagga.tcl index 38c5494..25fbd30 100755 --- a/linux/quagga.tcl +++ b/linux/quagga.tcl @@ -223,7 +223,7 @@ proc $MODULE.instantiate { eid node } { #**** proc $MODULE.start { eid node } { - global debug + global imunes_debug # OpenVZ catch: prije startanja bootcmda moramo upaliti capabilities # jer bez toga quagga uopće ne radi @@ -247,7 +247,7 @@ proc $MODULE.start { eid node } { # TODO: IPv6 Quagga support # nexec vzctl exec $node_id sysctl -w net/ipv6/conf/all/forwarding=1 - if { $debug } { + if { $imunes_debug } { puts " $eid $node ima aktivan IPv4 forwarding" }