Exemplo n.º 1
0
func (sv *supervisor) run(name string, args ...string) {
	isRunning, err := sv.dk.IsRunning(name)
	if err != nil {
		log.WithError(err).Warnf("could not check running status of %s.", name)
		return
	}
	if isRunning {
		return
	}

	ro := docker.RunOptions{
		Name:        name,
		Image:       images[name],
		Args:        args,
		NetworkMode: "host",
	}

	switch name {
	case Ovsvswitchd:
		ro.Privileged = true
		ro.VolumesFrom = []string{Ovsdb}
	case Ovnnorthd:
		ro.VolumesFrom = []string{Ovsdb}
	case Ovncontroller:
		ro.VolumesFrom = []string{Ovsdb}
	}

	if err := sv.dk.Run(ro); err != nil {
		log.WithError(err).Warnf("Failed to run %s.", name)
	}
}
Exemplo n.º 2
0
func (sv *supervisor) run(name string, args ...string) {
	isRunning, err := sv.dk.IsRunning(name)
	if err != nil {
		log.WithError(err).Warnf("could not check running status of %s.", name)
		return
	}
	if isRunning {
		return
	}

	ro := docker.RunOptions{
		Name:        name,
		Image:       images[name],
		Args:        args,
		NetworkMode: "host",
		VolumesFrom: []string{"minion"},
	}

	if name == Ovsvswitchd {
		ro.Privileged = true
	}

	log.Infof("Start Container: %s", name)
	_, err = sv.dk.Run(ro)
	if err != nil {
		log.WithError(err).Warnf("Failed to run %s.", name)
	}
}