fix: update vmInfo
Former-commit-id: 2bfc197d20297aac19e32ae1d3fa71e4647eedcc
This commit is contained in:
parent
641a762620
commit
c227103dbd
|
@ -156,23 +156,21 @@ type AiInfo struct {
|
|||
}
|
||||
|
||||
type VmInfo struct {
|
||||
TaskId int64 `json:"taskId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
AdapterId int64 `json:"adapterId,omitempty,optional"`
|
||||
AdapterName string `json:"adapterName,omitempty,optional"`
|
||||
ClusterId int64 `json:"clusterId,omitempty,optional"`
|
||||
ClusterName string `json:"clusterName,omitempty,optional"`
|
||||
FlavorRef string `json:"flavor_ref,omitempty"`
|
||||
ImageRef string `json:"image_ref,omitempty"`
|
||||
NetworkUuid string `json:"network_uuid,omitempty"`
|
||||
BlockUuid string `json:"block_uuid,omitempty"`
|
||||
SourceType string `json:"source_type,omitempty"`
|
||||
DeleteOnTermination bool `json:"delete_on_termination,omitempty"`
|
||||
Status string `json:"Status,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
VmName string `json:"vm_name,omitempty"`
|
||||
ServerId string `json:"server_id,omitempty"`
|
||||
TaskId int64 `json:"taskId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
AdapterId int64 `json:"adapterId,omitempty,optional"`
|
||||
AdapterName string `json:"adapterName,omitempty,optional"`
|
||||
ClusterId int64 `json:"clusterId,omitempty,optional"`
|
||||
ClusterName string `json:"clusterName,omitempty,optional"`
|
||||
FlavorRef string `json:"flavor_ref,omitempty"`
|
||||
ImageRef string `json:"image_ref,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
SourceType string `json:"source_type,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
VmName string `json:"vm_name,omitempty"`
|
||||
ServerId string `json:"server_id,omitempty"`
|
||||
}
|
||||
|
||||
type ResourceStats struct {
|
||||
|
|
|
@ -55,12 +55,25 @@ func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clie
|
|||
}
|
||||
}
|
||||
case 0:
|
||||
var cloudModelList []cloud.TaskCloudModel
|
||||
err := findModelList(req.AdapterId, l.svcCtx.DbEngin, &cloudModelList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
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:
|
||||
var cloudModelList []cloud.TaskCloudModel
|
||||
err := findModelList(req.AdapterId, l.svcCtx.DbEngin, &cloudModelList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Convert(cloudModelList, &resp.CloudInfoList)
|
||||
case 02:
|
||||
var vmModelList []models.TaskVm
|
||||
err := findModelList(req.AdapterId, l.svcCtx.DbEngin, &vmModelList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Convert(vmModelList, &resp.VmInfoList)
|
||||
}
|
||||
utils.Convert(cloudModelList, &resp.CloudInfoList)
|
||||
|
||||
case 1:
|
||||
var aiModelList []models.Ai
|
||||
err := findModelList(req.AdapterId, l.svcCtx.DbEngin, &aiModelList)
|
||||
|
@ -68,13 +81,6 @@ func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clie
|
|||
return nil, err
|
||||
}
|
||||
utils.Convert(aiModelList, &resp.AiInfoList)
|
||||
case 3:
|
||||
var vmModelList []models.TaskVm
|
||||
err := findModelList(req.AdapterId, l.svcCtx.DbEngin, &vmModelList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Convert(vmModelList, &resp.VmInfoList)
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue