Beispiel #1
0
// Vservers returns a list of currently configured vservers.
func (s *SeesawECU) Vservers(ctx *ipc.Context, reply *seesaw.VserverMap) error {
	s.trace("Vservers", ctx)

	authConn, err := s.ecu.authConnect(ctx)
	if err != nil {
		return err
	}
	defer authConn.Close()

	vservers, err := authConn.Vservers()
	if err != nil {
		return err
	}

	if reply != nil {
		reply.Vservers = vservers
	}
	return nil
}
Beispiel #2
0
// Vservers returns a list of currently configured vservers.
func (s *SeesawEngine) Vservers(ctx *ipc.Context, reply *seesaw.VserverMap) error {
	s.trace("Vservers", ctx)
	if ctx == nil {
		return errors.New("context is nil")
	}

	if !ctx.IsTrusted() {
		return errors.New("insufficient access")
	}

	if reply == nil {
		return fmt.Errorf("VserverMap is nil")
	}
	reply.Vservers = make(map[string]*seesaw.Vserver)
	s.engine.vserverLock.RLock()
	for name := range s.engine.vserverSnapshots {
		reply.Vservers[name] = s.engine.vserverSnapshots[name]
	}
	s.engine.vserverLock.RUnlock()
	return nil
}