]> git.entuzijast.net Git - imunes.git/commitdiff
prebacio vzctl stop u shutdown pseudo-metodu, i pokrenuo sve shutdown metode u petlji...
authorJosip Rodin <joy@CNZGRIJRL.carpriv.carnet.hr>
Mon, 12 Oct 2009 18:26:40 +0000 (20:26 +0200)
committerJosip Rodin <joy@CNZGRIJRL.carpriv.carnet.hr>
Mon, 12 Oct 2009 18:26:40 +0000 (20:26 +0200)
linux/exec.tcl

index f9390306f09294ec77fef701346b36e6e10525b1..ff8b5d980848c9d2f2e9d4bf4ffc4dec2c69cbb1 100755 (executable)
@@ -600,6 +600,8 @@ proc l3node.shutdown { eid node } {
            puts "nexec vimage $node_id ifconfig $ifc inet6 $ipv6 -alias"
        }
     }
+    statline "Stopping VE $node"
+    nexec vzctl stop $node_id
 }
 
 
@@ -632,8 +634,6 @@ proc l3node.destroy { eid node } {
 #    }
 
 #    puts "nexec vimage -d $node_id"
-       statline "Stopping VE $node"
-    nexec vzctl stop $node_id
     statline "Destroying VE $node"
     nexec vzctl destroy $node_id
 
@@ -908,62 +908,7 @@ proc vimageCleanup { eid } {
     set t_start [clock seconds]
 
 ## FreeBSD-only bug workaround:
-#    puts " would check vimage $eid vimage -lr \| fgrep -v \"    \" \| cut -d: -f 1"
-#    if { [ catch {nexec vimage $eid vimage -lr | fgrep -v "    " | cut -d: -f 1} res] != 0 } {
-#      return
-#    }
-#    set vimages [join $res]
-#    set defindex [lsearch $vimages .]
-#    set vimages [lreplace $vimages $defindex $defindex]
-
 #    # Wait for TIME_WAIT timeout in all vimages
-#    set vrti 1
-#    set sec 60
-
-#    if { $execMode == "batch" } {
-#        puts "\nDue to the known bug we must wait for TIME_WAIT expiration on virtual nodes (up to 60 sec). "
-#        puts "Please don't try killing the process."
-#    } else {
-#        # wm title $wi "Please wait ..."
-#        set w .timewait
-#        puts {destroy $w}
-#        toplevel $w -takefocus 1
-#        wm geometry $w +150+150
-#        wm title $w "Please wait ..."
-#        message $w.msg -justify left -aspect 1200 \
-#         -text "\nDue to the known bug we must wait for TIME_WAIT expiration on virtual nodes (up to 60 sec). 
-#Please don't try killing the process.
-#(countdown on status line)\n"
-#        pack $w.msg
-#        update
-#        grab $w
-#    } 
-#    while { $vrti == 1 } {
-#        set vrti 0
-#        foreach vimage $vimages {
-#            puts "vimage $vimage...\n"
-#            puts "checking netstat -an -f inet | fgrep WAIT..."
-#            while { [catch {nexec vimage $eid.$vimage netstat -an -f inet | fgrep "WAIT"} odg] == 0} {
-#                set vrti 1
-#                # puts "vimage $vimage: \n$odg\n"
-#                after 2000 
-#                set sec [expr $sec - 2]
-#                if { $execMode == "batch" } {
-#                    puts -nonewline "."
-#                    flush stdout
-#                } else {
-#                    statline "~ $sec sec ..."
-#                    pack $w.msg
-#                    update
-#                }
-#            }
-#        }
-#    }
-#    if { $execMode == "batch" } {
-#        puts ""
-#    } else {
-#        destroy .timewait
-#    }
 
 # FreeBSD vimage only
 #    # Kill all processes in all vimages
@@ -973,6 +918,7 @@ proc vimageCleanup { eid } {
 #      puts "nexec vimage $eid.$vimage kill -9 -1 2> /dev/null"
 #    }
 
+
 # FreeBSD netgraph only
 #    # Detach / destroy / reassign interfaces pipe, eiface, iface, bridge
 #      puts "running vimage $eid ngctl l | tail -n +3"
@@ -984,22 +930,6 @@ proc vimageCleanup { eid } {
 #      puts "nexec vimage $eid ngctl msg $node: shutdown"
 #    }
 
-    # Shut down all vimages
-
-    # OpenVZ - samo nam treba popis nodeova za pogasiti
-    upvar 0 ::cf::[set ::curcfg]::node_list node_list
-    puts "Stopping VEs and destroying private enviroments..."
-    foreach node $node_list {
-           if { [[typemodel $node].layer] != "LINK" } {
-               [typemodel $node].destroy $eid $node
-           } else {
-               # L2 uredjaji kao hub i switch se u OpenVZ varijanti emuliraju
-           # bridge suceljem a ne VEom, stoga nema se sto gasiti
-               puts "  Node $node is a L2 device emulated with a bridge. Stopping pending bridge cleanup."
-           }
-    }
-    puts "  Done."
-
        puts "\nBridge cleanup in main host"
        upvar 0 ::cf::[set ::curcfg]::bridges bridges
        if { [ info exists bridges ] && [ llength $bridges ] } {
@@ -1012,6 +942,7 @@ proc vimageCleanup { eid } {
     puts "  Done."
     
     
+    # Shut down all vimages
 # FreeBSD metoda:
 #    foreach vimage $vimages {
 #      set stattxt "Shutting down vimage $vimage"
@@ -1025,10 +956,38 @@ proc vimageCleanup { eid } {
 #    }
 #    puts " nexec vimage -d $eid "
 
+    # OpenVZ - samo nam treba popis nodeova za pogasiti
+    upvar 0 ::cf::[set ::curcfg]::node_list node_list
+
+    puts "Stopping all VEs..."
+    foreach node $node_list {
+           if { [[typemodel $node].layer] != "LINK" } {
+               [typemodel $node].shutdown $eid $node
+           } else {
+               # L2 uredjaji kao hub i switch se u OpenVZ varijanti emuliraju
+           # bridge suceljem a ne VEom, stoga nema se sto gasiti
+               puts "  Node $node is a L2 device emulated with a bridge. Stopping pending bridge cleanup."
+           }
+    }
+    puts "  Done."
+
 #    puts " nexec rm -f /usr/local/etc/quagga/Quagga.conf "
 
 # FreeBSD-only ciscenje eid tmp dira
 #    nexec rm -fr "/tmp/$eid"
+
+    puts "Destroying VE private enviroments..."
+    foreach node $node_list {
+           if { [[typemodel $node].layer] != "LINK" } {
+               [typemodel $node].destroy $eid $node
+           } else {
+               # L2 uredjaji kao hub i switch se u OpenVZ varijanti emuliraju
+           # bridge suceljem a ne VEom, stoga nema se sto gasiti
+               puts "  Node $node is a L2 device emulated with a bridge. Stopping pending bridge cleanup."
+           }
+    }
+    puts "  Done."
+
     statline "Cleanup completed in [expr [clock seconds] - $t_start] seconds."
 
        puts "\n= vimageCleanup $eid end ="