Merge branch 'master' of https://gitlink.org.cn/JointCloud/pcm-coordinator
Former-commit-id: 7b49a92d6af20441eb109b7340f15f8e61400d8b
This commit is contained in:
commit
11e01683a2
|
@ -168,8 +168,8 @@ type VmInfo struct {
|
|||
Status string `json:"status,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
Description string `json:"description,omitempty"` // 描述
|
||||
AvailabilityZone string `json:"availability_zone,omitempty"`
|
||||
MinCount string `json:"minCount,omitempty"`
|
||||
AvailabilityZone string `json:"availabilityZone,omitempty"`
|
||||
MinCount int64 `json:"minCount,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
RunningTime string `json:"runningTime,omitempty"`
|
||||
|
|
|
@ -120,6 +120,7 @@ func (l *CommitVmTaskLogic) CommitVmTask(req *types.CommitVmTaskReq) (resp *type
|
|||
//return errors.Errorf("the cluster does not match the drive resources. Check the data"), nil
|
||||
}*/
|
||||
taskVm.Name = req.Name
|
||||
taskVm.TaskId = taskModel.Id
|
||||
taskVm.Status = "Saved"
|
||||
taskVm.StartTime = time.Now().String()
|
||||
taskVm.MinCount = req.MinCount
|
||||
|
|
|
@ -33,6 +33,10 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
|
|||
l.svcCtx.DbEngin.Raw("select type as kind from t_adapter where id = ?", req.AdapterId).Scan(&kind)
|
||||
switch kind {
|
||||
case 0:
|
||||
var resourceType int32
|
||||
l.svcCtx.DbEngin.Raw("select resource_type as resourceType from `t_adapter` where id = ?", req.AdapterId).Scan(&resourceType)
|
||||
switch resourceType {
|
||||
case 01:
|
||||
for _, cloudInfo := range req.CloudInfoList {
|
||||
var taskId uint
|
||||
result := l.svcCtx.DbEngin.Table("task_cloud").Select("task_id").Where("task_id = ?", cloudInfo.TaskId).Find(&taskId)
|
||||
|
@ -53,6 +57,22 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
|
|||
}
|
||||
syncTask(l.svcCtx.DbEngin, noticeInfo)
|
||||
}
|
||||
case 02:
|
||||
for _, vmInfo := range req.VmInfoList {
|
||||
l.svcCtx.DbEngin.Exec("update task_vm set status = ?,start_time = ? where participant_id = ? and task_id = ? and name = ?",
|
||||
vmInfo.Status, vmInfo.StartTime, req.AdapterId, vmInfo.TaskId, vmInfo.Name)
|
||||
noticeInfo := clientCore.NoticeInfo{
|
||||
TaskId: vmInfo.TaskId,
|
||||
AdapterId: vmInfo.AdapterId,
|
||||
AdapterName: vmInfo.AdapterName,
|
||||
ClusterId: vmInfo.ClusterId,
|
||||
ClusterName: vmInfo.ClusterName,
|
||||
TaskName: vmInfo.Name,
|
||||
}
|
||||
syncTask(l.svcCtx.DbEngin, noticeInfo)
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
for _, hpcInfo := range req.HpcInfoList {
|
||||
l.svcCtx.DbEngin.Exec("update task_hpc set status = ?,start_time = ?,job_id = ? where cluster_id = ? and task_id = ? and name = ?",
|
||||
|
@ -81,20 +101,6 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
|
|||
}
|
||||
syncTask(l.svcCtx.DbEngin, noticeInfo)
|
||||
}
|
||||
case 3:
|
||||
for _, vmInfo := range req.VmInfoList {
|
||||
l.svcCtx.DbEngin.Exec("update task_vm set status = ?,start_time = ? where participant_id = ? and task_id = ? and name = ?",
|
||||
vmInfo.Status, vmInfo.StartTime, req.AdapterId, vmInfo.TaskId, vmInfo.Name)
|
||||
noticeInfo := clientCore.NoticeInfo{
|
||||
TaskId: vmInfo.TaskId,
|
||||
AdapterId: vmInfo.AdapterId,
|
||||
AdapterName: vmInfo.AdapterName,
|
||||
ClusterId: vmInfo.ClusterId,
|
||||
ClusterName: vmInfo.ClusterName,
|
||||
TaskName: vmInfo.Name,
|
||||
}
|
||||
syncTask(l.svcCtx.DbEngin, noticeInfo)
|
||||
}
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
|
@ -25,9 +25,11 @@ func NewSyncClusterLoadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S
|
|||
|
||||
func (l *SyncClusterLoadLogic) SyncClusterLoad(req *types.SyncClusterLoadReq) error {
|
||||
if nil != req.ClusterLoadRecords {
|
||||
for _, record := range req.ClusterLoadRecords {
|
||||
var param tracker.ClusterLoadRecord
|
||||
tool.Convert(req, ¶m)
|
||||
tool.Convert(record, ¶m)
|
||||
tracker.SyncClusterLoad(param)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue