]> git.entuzijast.net Git - imunes.git/commitdiff
uljepsan debugging, dodan message box za neispravnu konfiguraciju nodeova
authorKosta Pribić <kosta.pribic@gmail.com>
Fri, 4 Sep 2009 22:05:08 +0000 (00:05 +0200)
committerKosta Pribić <kosta.pribic@gmail.com>
Fri, 4 Sep 2009 22:05:08 +0000 (00:05 +0200)
linux/exec.tcl

index 2812c627b2dac3e4a9658f1d340842a58ca7dc72..fe61ceec6715176ddd3b96a940085b2c1ec4d69b 100755 (executable)
@@ -64,7 +64,7 @@ proc nexec { args } {
     if { $remote_exec } {
        rexec $execSock $args   
     } else {
-       puts "-- running: $args"
+       puts "  -- running: $args"
        eval exec $args
     }
 }
@@ -100,7 +100,7 @@ proc setOperMode { mode } {
     global activetool
     global editor_only remote_exec execSock
 
-       puts "setOperMode $mode"
+       puts "\nsetOperMode $mode"
 
     if { $mode == "exec" } { ;# let's try something, sockets should be opened
        nexec id -u
@@ -262,7 +262,7 @@ proc l3node.instantiate { eid node } {
     upvar 0 ::cf::[set ::curcfg]::ngnodemap ngnodemap
     global mac_byte4 mac_byte5
 
-       puts "l3node.instantiate $eid $node"
+       puts "\nl3node.INSTANTIATE $eid $node"
 
     set node_id "$eid\.$node"
 # OpenVZ VE ID moze biti samo numericki, dok nas node_id sadrzi
@@ -302,7 +302,7 @@ proc l3node.instantiate { eid node } {
 
                set peer [peerByIfc $node $ifc]
 
-               puts "vidimo node: $node ifclist: $ifc peer: $peer"
+               puts "  Node $node na lokalnom interfaceu (\$ifc) $ifc vidi (\$peer) $peer"
 
                if { [nodeType $peer] == "rj45" } {
 # TODO: RJ-45 nodes zasad ne podrzavamo
@@ -407,7 +407,7 @@ proc l3node.start { eid node } {
     global remote_exec execSock
     global viewcustomid
     
-       puts "l3node.start $eid $node"
+       puts "\nl3node.START $eid $node"
     
     set node_id "$eid\.$node"
 
@@ -475,7 +475,7 @@ proc l3node.start { eid node } {
        set bootcfg [[typemodel $node].cfggen $node]
        set bootcmd [[typemodel $node].bootcmd $node]
     }
-    puts "     imamo typemodel=[typemodel $node]"
+    puts "  typemodel=[typemodel $node]"
 #    puts "bootcfg=$bootcfg i bootcmd=$bootcmd"
     if { ! $remote_exec } {
 #      puts "  would write node_dir/boot.conf"
@@ -496,14 +496,27 @@ proc l3node.start { eid node } {
 #    catch nexec vimage $node_id $bootcmd $node_dir/boot.conf >& $node_dir/out.log &"
 
     foreach line $bootcfg {
-       puts "  executing on $node: $line"
+       puts "  executing on $node: $line"
        set command $line
        if { "$command" != "" } {
            catch { nexec vzctl exec $node $command } ret
-           if { $ret != "TCL_OK" } {
-               puts "          $ret"
-               # TODO: proper GUI message box, plus batch mode handling
-            }
+        # Ispravno izvedene naredbe u OpenVZ VE vracaju jedan prazan red
+        # 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 != ""} {
+               
+          puts "  =>Command \"$command\" executed on $node returned: \
+               \"$ret\""
+  
+  
+               # TODO: batch mode handling
+               # TODO: cemu sluzi TCL_OK uvjet? tko njega postavlja? kako znati da je
+               #       odgovor error a ne samo neki info
+               set str "Command \n\n \"$command\"\n\n executed on $node returned: \
+               \n\n\"$ret\"\n\n"
+                   tk_messageBox -message $str -type ok -icon info \
+               -title "Configuration"
+                 }
         }
     }
 
@@ -591,7 +604,7 @@ proc deployCfg {} {
     global remote_exec
     global eid_base
 
-       puts "deployCfg"
+       puts "\n= deployCfg starts ="
 
     set mac_byte4 0
     set mac_byte5 0
@@ -723,6 +736,8 @@ proc deployCfg {} {
     }
 
     statline "Network topology instantiated in [expr [clock seconds] - $t_start] seconds ([llength $node_list] nodes and [llength $link_list] links)."
+    
+    puts "\n= deployCfg end ="
 }
 
 
@@ -739,7 +754,7 @@ proc vimageCleanup { eid } {
     global .c
     global execMode
 
-       puts "vimageCleanup $eid"
+       puts "\n= vimageCleanup $eid start ="
 
     set t_start [clock seconds]
 
@@ -833,7 +848,7 @@ proc vimageCleanup { eid } {
        nexec vzctl destroy $node
     }
 
-       puts "*** missing bridge cleanup in main host"
+       puts "  TODO: missing bridge cleanup in main host"
 
 # FreeBSD metoda:
 #    foreach vimage $vimages {
@@ -853,6 +868,8 @@ proc vimageCleanup { eid } {
 # FreeBSD-only ciscenje eid tmp dira
 #    nexec rm -fr "/tmp/$eid"
     statline "Cleanup completed in [expr [clock seconds] - $t_start] seconds."
+
+       puts "\n= vimageCleanup $eid end ="
 }