Merge pull request 'Add the survival_time field' (#95) from qiwang/pcm-coordinator:master into master

Former-commit-id: 2b67b31d9d561833221d1f9b8099dff3a0c83c44
This commit is contained in:
qiwang 2024-04-03 14:54:14 +08:00
commit f5c2309f85
6 changed files with 10 additions and 13 deletions

View File

@ -134,6 +134,7 @@ type (
Updated string `json:"updated" copier:"Updated"`
Flavor string `json:"flavor" copier:"Flavor"`
Key_name string `json:"key_name" copier:"Key_name"`
Survival_time int32 `json:"survival_time" copier:"Survival_time"`
}
)

View File

@ -5,8 +5,8 @@ Port: 8999
Timeout: 50000
DB:
DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
# DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local
#DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local
Redis:
Host: 10.206.0.12:6379
Pass: redisPW123

View File

@ -18,15 +18,12 @@ import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr"
error2 "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/error"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
"k8s.io/apimachinery/pkg/util/json"
"github.com/zeromicro/go-zero/core/logx"
)
type ListServersDetailedLogic struct {
@ -44,18 +41,14 @@ func NewListServersDetailedLogic(ctx context.Context, svcCtx *svc.ServiceContext
}
func (l *ListServersDetailedLogic) ListServersDetailed(req *types.ListServersDetailedReq) (resp *types.ListServersDetailedResp, err error) {
// todo: add your logic here and delete this line
resp = &types.ListServersDetailedResp{}
ListServersDetailedReq := &openstack.ListServersDetailedReq{}
err = copier.CopyWithOption(ListServersDetailedReq, req, copier.Option{Converters: utils.Converters})
ListServersDetailedResp, err := l.svcCtx.OpenstackRpc.ListServersDetailed(l.ctx, ListServersDetailedReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req)
}
marshal, err := json.Marshal(&ListServersDetailedResp)
if err != nil {
return nil, error2.NewDefaultError(err.Error())
}
json.Unmarshal(marshal, &resp)
utils.Convert(&ListServersDetailedResp.Servers, &resp.ServersDetailed)
err = copier.CopyWithOption(&resp, &ListServersDetailedResp, copier.Option{Converters: utils.Converters})
return resp, err

View File

@ -2748,6 +2748,7 @@ type ServersDetailed struct {
Updated string `json:"updated" copier:"Updated"`
Flavor string `json:"flavor" copier:"Flavor"`
Key_name string `json:"key_name" copier:"Key_name"`
Survival_time int32 `json:"survival_time" copier:"Survival_time"`
}
type GetServersDetailedByIdReq struct {

2
go.mod
View File

@ -23,7 +23,7 @@ require (
github.com/rs/zerolog v1.28.0
github.com/zeromicro/go-zero v1.6.3
gitlink.org.cn/JointCloud/pcm-kubernetes v0.0.0-20240301071143-347480abff2c
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240402074843-46c7d05954e6
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5
gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20240301085553-f6ad88fa357a
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d

2
go.sum
View File

@ -1085,6 +1085,8 @@ gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240401022404-2f1425735f0d h1:ZX
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240401022404-2f1425735f0d/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8=
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240402074843-46c7d05954e6 h1:d40gT5SaARH82SWJMMOao9iJ4QxrnjswjHFmU3tCPac=
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240402074843-46c7d05954e6/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8=
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6PsZ1+bev294IWdZRlV7mnOwI1+UzFcldVW/BqhQzI=
gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8=
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0=
gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5/go.mod h1:97AlUXN13g9UN3+9/DzCHpeoU5sbdyv0IQuTEHNexzQ=
gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20240301085553-f6ad88fa357a h1:fY1KmyZ6O7wVBvgt2HB+C9e1DncJdk/Wkv8m5Qz7abw=