pcm-openstack/internal/pkg/cron/taskcron.go

53 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cron
import (
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
)
func SyncTask(svc *svc.ServiceContext) {
/*participantId, err := tool.GetParticipantId("etc/pcmopenstack.yaml")
if err != nil {
logx.Errorf("获取participant id失败 err:", err)
return
}
// 查询core端分发下来的任务列表
infoReq := pcmCore.InfoListReq{
//Kind: "cloud",
ParticipantId: participantId,
}
infoList, err := svc.PcmCoreRpc.InfoList(context.Background(), &infoReq)
if err != nil {
logx.Error(err)
return
}
for index, _ := range infoList. {
//删除任务
if infoList.VmInfoList[index].Status == "WaitDelete" {
delete(infoList.VmInfoList[index], svc)
}
// 执行任务
if infoList.VmInfoList[index].Status == "Saved" {
apply(infoList.CloudInfoList[index], svc)
}
}
// 遍历查询任务信息
for index, _ := range infoList.VmInfoList {
if infoList.VmInfoList[index].Kind == "" {
DeploymentHandler(infoList.VmInfoList[index], svc)
}
}
// 同步信息到core端
if len(infoList.VmInfoList) != 0 {
SyncInfoReq := pcmCore.SyncInfoReq{
ParticipantId: participantId,
VmInfoList: infoList.VmInfoList,
}
resp, err := svc.PcmCoreRpc.SyncInfo(context.Background(), &SyncInfoReq)
if err != nil {
logx.Error(resp.Msg)
return
}
}*/
}