コード例 #1
0
// Receives an action request from server and call ActionExecutor to execute action.
func (handler *KubernetesServerMessageHandler) HandleAction(serverMsg *comm.MediationServerMessage) {
	messageID := serverMsg.GetMessageID()
	actionRequest := serverMsg.GetActionRequest()
	// In the kubernetes case, ProbeType and AccountValue check is not necessary here since
	// the mediation client (vmturbo service) is embeded inside kubernetes.
	actionItemDTO := actionRequest.GetActionItemDTO()
	glog.V(3).Infof("The received ActionItemDTO is %v", actionItemDTO)
	actionExecutor := &vmtaction.KubernetesActionExecutor{
		KubeClient:  handler.kubeClient,
		EtcdStorage: handler.etcdStorage,
	}
	err := actionExecutor.ExcuteAction(actionItemDTO, messageID)
	if err != nil {
		glog.Errorf("Error execute action: %s", err)
	}
}