Merge branch '54_reboot' of https://github.com/bboreham/weave into bboreham-54_reboot

This commit is contained in:
Matthias Radestock committed 2014-09-23 16:13:45 +01:00
commit 5477f671db
3 files changed
+32 -7

No files matched your search

+22
View File
@@ -432,6 +432,28 @@ Any running application containers will permanently lose connectivity
with the weave network and have to be restarted in order to with the weave network and have to be restarted in order to
re-connect. re-connect.
### Reboots
If the host you are running your containers on gets rebooted, the
default behaviour of Docker is to restart any containers that were
running, but weave relies on a bridge and virtual ethernet devices
being set up outside of the containers, so the weave network will not
function in this state.
For the weave router, the best thing is to stop any container that
Docker may have restarted and re-launch, i.e. something like:
host1# weave stop
host1# weave launch 10.0.0.1/16
After that, other containers may be re-attached if you can identify
them, like this:
host1# weave attach 10.0.1.1/24 <mycontainer>
Alternatively, you may prefer to disable the auto-restart feature in
Docker as described [here](https://docs.docker.com/articles/host_integration/).
## Installation with Boot2Docker ## Installation with Boot2Docker
If you are running Docker inside the Boot2Docker VM, e.g. because you If you are running Docker inside the Boot2Docker VM, e.g. because you
+1 -1
View File
@@ -3,4 +3,4 @@ MAINTAINER Zettio weave@zett.io
WORKDIR /home/weave WORKDIR /home/weave
ADD ./weaver /home/weave/ ADD ./weaver /home/weave/
CMD [] CMD []
ENTRYPOINT ["/home/weave/weaver", "-iface", "ethwe", "-wait"] ENTRYPOINT ["/home/weave/weaver", "-iface", "ethwe", "-wait", "5"]
+9 -6
View File
@@ -18,17 +18,19 @@ import (
"time" "time"
) )
func ensureInterface(ifaceName string, wait bool) (iface *net.Interface, err error) { func ensureInterface(ifaceName string, wait int) (iface *net.Interface, err error) {
iface, err = findInterface(ifaceName) iface, err = findInterface(ifaceName)
if err == nil || !wait { if err == nil || wait == 0 {
return return
} }
log.Println("Waiting for interface", ifaceName, "to come up") log.Println("Waiting for interface", ifaceName, "to come up")
for err != nil { for ; err != nil && wait > 0; wait -= 1 {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
iface, err = findInterface(ifaceName) iface, err = findInterface(ifaceName)
} }
log.Println("Interface", ifaceName, "is up") if err == nil {
log.Println("Interface", ifaceName, "is up")
}
return return
} }
@@ -47,6 +49,7 @@ func main() {
log.SetPrefix(weave.Protocol + " ") log.SetPrefix(weave.Protocol + " ")
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds) log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
log.Println(os.Args)
procs := runtime.NumCPU() procs := runtime.NumCPU()
// packet sniffing can block an OS thread, so we need one thread // packet sniffing can block an OS thread, so we need one thread
@@ -60,7 +63,7 @@ func main() {
ifaceName string ifaceName string
routerName string routerName string
password string password string
wait bool wait int
debug bool debug bool
prof string prof string
peers []string peers []string
@@ -71,7 +74,7 @@ func main() {
flag.StringVar(&ifaceName, "iface", "", "name of interface to read from") flag.StringVar(&ifaceName, "iface", "", "name of interface to read from")
flag.StringVar(&routerName, "name", "", "name of router (defaults to MAC)") flag.StringVar(&routerName, "name", "", "name of router (defaults to MAC)")
flag.StringVar(&password, "password", "", "network password") flag.StringVar(&password, "password", "", "network password")
flag.BoolVar(&wait, "wait", false, "wait for interface to be created and come up") flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up")
flag.BoolVar(&debug, "debug", false, "enable debug logging") flag.BoolVar(&debug, "debug", false, "enable debug logging")
flag.StringVar(&prof, "profile", "", "enable profiling and write profiles to given path") flag.StringVar(&prof, "profile", "", "enable profiling and write profiles to given path")
flag.IntVar(&connLimit, "connlimit", 10, "connection limit (defaults to 10, set to 0 for unlimited)") flag.IntVar(&connLimit, "connlimit", 10, "connection limit (defaults to 10, set to 0 for unlimited)")