forked from jcce-pcm/pcm-openstack
暂停,启动,停止实例修改
This commit is contained in:
parent
cbdceff549
commit
81a3d353c1
|
@ -1,15 +1,39 @@
|
|||
NacosConfig:
|
||||
DataId: pcm-openstack-rpc.yaml
|
||||
Group: DEFAULT_GROUP
|
||||
ServerConfigs:
|
||||
# - IpAddr: 127.0.0.1
|
||||
# Port: 8848
|
||||
- IpAddr: nacos.jcce.dev
|
||||
Port: 8848
|
||||
ClientConfig:
|
||||
NamespaceId: storage
|
||||
TimeoutMs: 5000
|
||||
NotLoadCacheAtStart: true
|
||||
LogDir:
|
||||
CacheDir:
|
||||
LogLevel: debug
|
||||
Name: pcm.openstack.rpc
|
||||
ListenOn: 0.0.0.0:2010
|
||||
|
||||
Timeout: 100000 # 100s,设置rpc服务的响应的超时时间,若超过10s还未返回则结束请求
|
||||
|
||||
Participant:
|
||||
Name: VM-openstack #参与者名称
|
||||
Address: "asdasd" #内网地址
|
||||
RpcAddress: 0.0.0.0:2010 #rpc协议地址和端口
|
||||
Type: "0"
|
||||
TenantId: 1 #租户id
|
||||
TenantName: "host" #租户名
|
||||
# Labels: 1
|
||||
|
||||
openstackConfig:
|
||||
USER: "admin"
|
||||
PASSWORD: "Nudt@123"
|
||||
DOMAIN: "Default"
|
||||
TokenUrl: "http://10.105.20.9:5000/v3/auth/tokens?nocatalog"
|
||||
Status_created: 201
|
||||
ProjectName: "Default"
|
||||
TokenHeader: X-Subject-Token
|
||||
AuthMethod: "password"
|
||||
OpenstackNetworkUrl: "http://10.105.20.9:9696"
|
||||
OpenstackImageUrl: "http://10.105.20.9:9292"
|
||||
OpenstackComputeUrl: "http://10.105.20.9:8774/v2.1/aa7366b7f0e9453a9ba8bc699aa97b1e"
|
||||
OpenstackVolumev2Url: "http://10.105.20.9:8776/v3/aa7366b7f0e9453a9ba8bc699aa97b1e"
|
||||
OpenstackLimitsUrl: "http://10.105.20.9:8774"
|
||||
OpenstackBareMetalUrl: ""
|
||||
|
||||
|
||||
# core rpc
|
||||
PcmCoreRpcConf:
|
||||
target: nacos://10.101.15.7:8848/pcm.core.rpc?timeout=30s&namespaceid=storage&groupname=DEFAULT_GROUP&appName=pcm.core.rpc
|
||||
# Endpoints:
|
||||
# - 127.0.0.1:8888
|
||||
NonBlock: true
|
||||
|
||||
ParticipantId: 0
|
||||
|
|
|
@ -2,6 +2,7 @@ package common
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/config"
|
||||
"io"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"log"
|
||||
|
@ -9,32 +10,28 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
USER = "admin"
|
||||
PASSWORD = "Nudt@123"
|
||||
DOMAIN = "Default"
|
||||
TokenUrl = "http://10.105.20.9:5000/v3/auth/tokens?nocatalog"
|
||||
Status_created = 201
|
||||
ProjectName = "Default"
|
||||
TokenHeader = "X-Subject-Token"
|
||||
AuthMethod = "password"
|
||||
)
|
||||
var FileName string
|
||||
var C config.Config
|
||||
|
||||
//var (
|
||||
// token, expiredAt = GenerateToken()
|
||||
//)
|
||||
|
||||
var (
|
||||
token, expiredAt = GenerateToken()
|
||||
token string
|
||||
expiredAt time.Time
|
||||
)
|
||||
|
||||
func GenerateToken() (string, time.Time) {
|
||||
a := Auth{}
|
||||
a.Auth.Scope.Project.Name = USER
|
||||
a.Auth.Scope.Project.Domain.Name = ProjectName
|
||||
a.Auth.Identity.Methods = append(a.Auth.Identity.Methods, AuthMethod)
|
||||
a.Auth.Identity.Password.User.Name = USER
|
||||
a.Auth.Identity.Password.User.Password = PASSWORD
|
||||
a.Auth.Identity.Password.User.Domain.Name = DOMAIN
|
||||
|
||||
a.Auth.Scope.Project.Name = C.OpenstackConfig.USER
|
||||
a.Auth.Scope.Project.Domain.Name = C.OpenstackConfig.ProjectName
|
||||
a.Auth.Identity.Methods = append(a.Auth.Identity.Methods, C.OpenstackConfig.AuthMethod)
|
||||
a.Auth.Identity.Password.User.Name = C.OpenstackConfig.USER
|
||||
a.Auth.Identity.Password.User.Password = C.OpenstackConfig.PASSWORD
|
||||
a.Auth.Identity.Password.User.Domain.Name = C.OpenstackConfig.DOMAIN
|
||||
jsonStr, _ := json.Marshal(a)
|
||||
req_url, err := http.NewRequest("POST", TokenUrl, bytes.NewBuffer(jsonStr))
|
||||
req_url, err := http.NewRequest("POST", C.OpenstackConfig.TokenUrl, bytes.NewBuffer(jsonStr))
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -47,7 +44,7 @@ func GenerateToken() (string, time.Time) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if respUrl.StatusCode != Status_created {
|
||||
if respUrl.StatusCode != C.OpenstackConfig.Status_created {
|
||||
panic("获取token失败")
|
||||
}
|
||||
|
||||
|
@ -58,7 +55,7 @@ func GenerateToken() (string, time.Time) {
|
|||
result, _ := io.ReadAll(respUrl.Body)
|
||||
json.Unmarshal(result, &t)
|
||||
|
||||
return respUrl.Header.Get(TokenHeader), t.Token.ExpiresAt
|
||||
return respUrl.Header.Get(C.OpenstackConfig.TokenHeader), t.Token.ExpiresAt
|
||||
}
|
||||
|
||||
func GetToken() string {
|
||||
|
|
|
@ -12,16 +12,17 @@ const (
|
|||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
OpenstackConfig
|
||||
LogConf logx.LogConf
|
||||
PcmCoreRpcConf zrpc.RpcClientConf
|
||||
//Participant Participant
|
||||
OpenstackConfig OpenstackConfig
|
||||
LogConf logx.LogConf
|
||||
PcmCoreRpcConf zrpc.RpcClientConf
|
||||
ParticipantId int64
|
||||
Participant Participant
|
||||
}
|
||||
|
||||
/*type Participant struct {
|
||||
type Participant struct {
|
||||
Address string `json:"address"`
|
||||
Type string `json:"type"`
|
||||
TenantId int64 `json:"tenantId"`
|
||||
TenantName string `json:"tenantName"`
|
||||
Labels map[string]string
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,9 +1,18 @@
|
|||
package config
|
||||
|
||||
type OpenstackConfig struct {
|
||||
OpenstackNetworkUrl string `json:"OpenstackNetworkUrl"`
|
||||
OpenstackComputeUrl string `json:"OpenstackComputeUrl"`
|
||||
OpenstackImageUrl string `json:"OpenstackImageUrl"`
|
||||
OpenstackVolumev2Url string `json:"OpenstackVolumev2Url"`
|
||||
OpenstackLimitsUrl string `json:"OpenstackLimitsUrl"`
|
||||
OpenstackNetworkUrl string `json:"OpenstackNetworkUrl"`
|
||||
OpenstackComputeUrl string `json:"OpenstackComputeUrl"`
|
||||
OpenstackImageUrl string `json:"OpenstackImageUrl"`
|
||||
OpenstackVolumev2Url string `json:"OpenstackVolumev2Url"`
|
||||
OpenstackLimitsUrl string `json:"OpenstackLimitsUrl"`
|
||||
OpenstackBareMetalUrl string `json:"OpenstackBareMetalUrl"`
|
||||
TokenUrl string `json:"TokenUrl"`
|
||||
Status_created int `json:"Status_created"`
|
||||
TokenHeader string `json:"TokenHeader"`
|
||||
USER string `json:"USER"`
|
||||
PASSWORD string `json:"PASSWORD"`
|
||||
DOMAIN string `json:"DOMAIN"`
|
||||
AuthMethod string `json:"AuthMethod"`
|
||||
ProjectName string `json:"ProjectName"`
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *BulkCreateNetworksLogic) BulkCreateNetworks(in *openstack.BulkCreateNet
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/networks", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -36,10 +36,9 @@ func (l *CreateImageLogic) CreateImage(in *openstack.CreateImageReq) (*openstack
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackImageUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackImageUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2/images", payload, token)
|
||||
//statusCode, body, err := tool.HttpClientWithScreen(tool.POST, openstackUrl+"/v2/images", payload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *CreateNetworkLogic) CreateNetwork(in *openstack.CreateNetworkReq) (*ope
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/networks", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *CreateNodeLogic) CreateNode(in *openstack.CreateNodeReq) (*openstack.Cr
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := "http://10.105.20.9:9292"
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v1/nodes", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *CreateServerLogic) CreateServer(in *openstack.CreateServerReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -37,7 +37,7 @@ func (l *CreateSubnetLogic) CreateSubnet(in *openstack.CreateSubnetReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/v2.0/subnets", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *CreateVolumeLogic) CreateVolume(in *openstack.CreateVolumeReq) (*openst
|
|||
}
|
||||
token := common.GetToken()
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/volumes", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -35,7 +35,7 @@ func (l *CreateVolumeTypesLogic) CreateVolumeTypes(in *openstack.CreateVolumeTyp
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/types", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,7 +31,7 @@ func NewDeleteImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
|||
func (l *DeleteImageLogic) DeleteImage(in *openstack.DeleteImageReq) (*openstack.DeleteImageResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteImageResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackImageUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackImageUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2/images/"+in.ImageId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewDeleteNetworkLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
|
|||
func (l *DeleteNetworkLogic) DeleteNetwork(in *openstack.DeleteNetworkReq) (*openstack.DeleteNetworkResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteNetworkResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v2.0/networks/"+in.NetworkId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
|
|
|
@ -3,6 +3,7 @@ package logic
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
|
@ -29,8 +30,9 @@ func NewDeleteNodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
|||
func (l *DeleteNodeLogic) DeleteNode(in *openstack.DeleteNodeReq) (*openstack.DeleteNodeResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteNodeResp
|
||||
openstackUrl := ""
|
||||
statusCode, body, err := tool.HttpClientWithScreen(tool.DELETE, openstackUrl+"/v1/nodes/"+in.NodeIdent, strings.NewReader(``))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackBareMetalUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/v1/nodes/"+in.NodeIdent, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ func (l *DeleteServerLogic) DeleteServer(in *openstack.DeleteServerReq) (*openst
|
|||
// todo: add your logic here and delete this line
|
||||
|
||||
var resp openstack.DeleteServerResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/servers/"+in.ServerId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewDeleteVolumeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Dele
|
|||
func (l *DeleteVolumeLogic) DeleteVolume(in *openstack.DeleteVolumeReq) (*openstack.DeleteVolumeResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteVolumeResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/volumes/"+in.VolumeId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewDeleteVolumeTypesLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *DeleteVolumeTypesLogic) DeleteVolumeTypes(in *openstack.DeleteVolumeTypeReq) (*openstack.DeleteVolumeTypeResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.DeleteVolumeTypeResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.DELETE, openstackUrl+"/types/"+in.VolumeTypeId, strings.NewReader(``), token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewGetComputeLimitsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
|
|||
|
||||
func (l *GetComputeLimitsLogic) GetComputeLimits(in *openstack.GetComputeLimitsReq) (*openstack.GetComputeLimitsResp, error) {
|
||||
var resp openstack.GetComputeLimitsResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackLimitsUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackLimitsUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2/limits", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewGetServersDetailedByIdLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||
func (l *GetServersDetailedByIdLogic) GetServersDetailedById(in *openstack.GetServersDetailedByIdReq) (*openstack.GetServersDetailedByIdResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.GetServersDetailedByIdResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/servers/"+in.ServerId, nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewGetVolumeDetailedByIdLogic(ctx context.Context, svcCtx *svc.ServiceConte
|
|||
func (l *GetVolumeDetailedByIdLogic) GetVolumeDetailedById(in *openstack.GetVolumeDetailedByIdReq) (*openstack.GetVolumeDetailedByIdResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.GetVolumeDetailedByIdResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/volumes/"+in.VolumeId, nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewGetVolumeLimitsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
|
|||
|
||||
func (l *GetVolumeLimitsLogic) GetVolumeLimits(in *openstack.GetVolumeLimitsReq) (*openstack.GetVolumeLimitsResp, error) {
|
||||
var resp openstack.GetVolumeLimitsResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/limits", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewListFlavorsDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ListFlavorsDetailLogic) ListFlavorsDetail(in *openstack.ListFlavorsDetailReq) (*openstack.ListFlavorsDetailResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListFlavorsDetailResp
|
||||
openstackUrl := "http://10.105.20.9:8774/v2.1/aa7366b7f0e9453a9ba8bc699aa97b1e"
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/flavors/detail", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewListImagesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListIm
|
|||
func (l *ListImagesLogic) ListImages(in *openstack.ListImagesReq) (*openstack.ListImagesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListImagesResp
|
||||
openstackUrl := "http://10.105.20.9:9292"
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackImageUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2/images", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewListNetworksLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
|
|||
func (l *ListNetworksLogic) ListNetworks(in *openstack.ListNetworksReq) (*openstack.ListNetworksResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListNetworksResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/networks", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,9 +30,9 @@ func NewListNodesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListNod
|
|||
func (l *ListNodesLogic) ListNodes(in *openstack.ListNodesReq) (*openstack.ListNodesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListNodesResp
|
||||
openstackUrl := ""
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackBareMetalUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/networks", nil, token)
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v1/nodes/", nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewListServersDetailedLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
func (l *ListServersDetailedLogic) ListServersDetailed(in *openstack.ListServersDetailedReq) (*openstack.ListServersDetailedResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListServersDetailedResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/servers/detail", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewListServersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListS
|
|||
func (l *ListServersLogic) ListServers(in *openstack.ListServersReq) (*openstack.ListServersResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListServersResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/servers", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,7 +30,7 @@ func NewListVolumesDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ListVolumesDetailLogic) ListVolumesDetail(in *openstack.ListVolumesDetailReq) (*openstack.ListVolumesDetailResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListVolumesDetailResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/volumes/detail", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,7 +31,7 @@ func NewListVolumesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListV
|
|||
func (l *ListVolumesLogic) ListVolumes(in *openstack.ListVolumesReq) (*openstack.ListVolumesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListVolumesResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/volumes", nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewListVolumeTypesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *L
|
|||
func (l *ListVolumeTypesLogic) ListVolumeTypes(in *openstack.ListVolumeTypesReq) (*openstack.ListVolumeTypesResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ListVolumeTypesResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
//statusCode, body, err := tool.HttpClientWithScreen(tool.GET, openstackUrl+"/v3/"+in.ProjectId+"/types", strings.NewReader(``))
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/types", nil, token)
|
||||
|
|
|
@ -38,7 +38,7 @@ func (l *PauseServerLogic) PauseServer(in *openstack.PauseServerReq) (*openstack
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers/"+in.ServerId+"/action", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -35,7 +35,7 @@ func (l *RebootServerLogic) RebootServer(in *openstack.RebootServerReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers/"+in.ServerId+"/action", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewShowNetworkDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
func (l *ShowNetworkDetailsLogic) ShowNetworkDetails(in *openstack.ShowNetworkDetailsReq) (*openstack.ShowNetworkDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowNetworkDetailsResp
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v2.0/networks/"+in.NetworkId, nil, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -3,13 +3,12 @@ package logic
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ShowNodeDetailsLogic struct {
|
||||
|
@ -29,8 +28,9 @@ func NewShowNodeDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S
|
|||
func (l *ShowNodeDetailsLogic) ShowNodeDetails(in *openstack.ShowNodeDetailsReq) (*openstack.ShowNodeDetailsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp openstack.ShowNodeDetailsResp
|
||||
openstackUrl := ""
|
||||
statusCode, body, err := tool.HttpClientWithScreen(tool.GET, openstackUrl+"/v1/nodes/"+in.NodeIdent, strings.NewReader(``))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackBareMetalUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, openstackUrl+"/v1/nodes/"+in.NodeIdent, nil, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ func (l *StartServerLogic) StartServer(in *openstack.StartServerReq) (*openstack
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers/"+in.ServerId+"/action", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -38,7 +38,7 @@ func (l *StopServerLogic) StopServer(in *openstack.StopServerReq) (*openstack.St
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers/"+in.ServerId+"/action", payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -35,7 +35,7 @@ func (l *UpdateNetworkLogic) UpdateNetwork(in *openstack.UpdateNetworkReq) (*ope
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackNetworkUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackNetworkUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/v2.0/networks/"+in.NetworkId, payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func (l *UpdateServerLogic) UpdateServer(in *openstack.UpdateServerReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/servers/"+in.ServerId, payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -35,7 +35,7 @@ func (l *UpdateVolumeLogic) UpdateVolume(in *openstack.UpdateVolumeReq) (*openst
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackVolumev2Url
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackVolumev2Url
|
||||
token := common.GetToken()
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.PUT, openstackUrl+"/types"+in.VolumeId, payload, token)
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func (l *UploadImageLogic) UploadImage(in *openstack.UploadOsImageReq) (*opensta
|
|||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := l.svcCtx.Config.OpenstackComputeUrl
|
||||
openstackUrl := l.svcCtx.Config.OpenstackConfig.OpenstackComputeUrl
|
||||
statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.POST, openstackUrl+"/servers", payload, token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
package cron
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/client/participantservice"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/config"
|
||||
"gitlink.org.cn/jcce-pcm/utils/tool"
|
||||
)
|
||||
|
||||
func ReportHeartbeat(participantRpc participantservice.ParticipantService) {
|
||||
participantId, err := tool.GetParticipantId("etc/pcmopenstack.yaml")
|
||||
if err != nil {
|
||||
logx.Errorf("获取participant id失败! err:", err)
|
||||
return
|
||||
}
|
||||
resp, err := participantRpc.ReportHeartbeat(context.Background(), &participantservice.ParticipantHeartbeatReq{
|
||||
ParticipantId: participantId,
|
||||
Host: config.HOST,
|
||||
Port: config.PORT,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
if resp.Code != 200 {
|
||||
logx.Error(resp.Msg)
|
||||
}
|
||||
logx.Info("心跳推送成功!")
|
||||
//participantId, err := tool.GetParticipantId("etc/pcmopenstack.yaml")
|
||||
//if err != nil {
|
||||
// logx.Errorf("获取participant id失败! err:", err)
|
||||
// return
|
||||
//}
|
||||
//resp, err := participantRpc.ReportHeartbeat(context.Background(), &participantservice.ParticipantHeartbeatReq{
|
||||
// ParticipantId: participantId,
|
||||
// Host: config.HOST,
|
||||
// Port: config.PORT,
|
||||
//})
|
||||
//if err != nil {
|
||||
// logx.Error(err)
|
||||
// return
|
||||
//}
|
||||
//if resp.Code != 200 {
|
||||
// logx.Error(resp.Msg)
|
||||
//}
|
||||
//logx.Info("心跳推送成功!")
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ option go_package = "/openstack";
|
|||
|
||||
|
||||
|
||||
|
||||
/******************Overview Start*************************/
|
||||
message GetComputeLimitsReq{
|
||||
}
|
||||
|
@ -2030,7 +2029,6 @@ message DeleteVolumeTypeResp{
|
|||
|
||||
|
||||
|
||||
|
||||
service Openstack {
|
||||
// Overview
|
||||
rpc GetComputeLimits(GetComputeLimitsReq) returns (GetComputeLimitsResp);
|
||||
|
|
133
pcmopenstack.go
133
pcmopenstack.go
|
@ -6,91 +6,96 @@ import (
|
|||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/client/participantservice"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/common"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/config"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/pkg/cron"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/server"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack"
|
||||
"gitlink.org.cn/jcce-pcm/utils/interceptor/rpcserver"
|
||||
commonConfig "gitlink.org.cn/jcce-pcm/utils/nacos"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/pcmopenstack.yaml", "the config file")
|
||||
// var configFile = flag.String("f", "etc/pcmopenstack.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.StringVar(&common.FileName, "f", "etc/pcmopenstack.yaml", "the config file")
|
||||
flag.Parse()
|
||||
|
||||
var bootstrapConfig commonConfig.BootstrapConfig
|
||||
conf.MustLoad(*configFile, &bootstrapConfig)
|
||||
|
||||
conf.MustLoad(common.FileName, &common.C)
|
||||
ctx := svc.NewServiceContext(common.C)
|
||||
common.GenerateToken()
|
||||
//解析业务配置
|
||||
var c config.Config
|
||||
nacosConfig := bootstrapConfig.NacosConfig
|
||||
|
||||
serviceConfigContent := nacosConfig.InitConfig(func(data string) {
|
||||
err := conf.LoadFromYamlBytes([]byte(data), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// start log component
|
||||
logx.MustSetup(c.LogConf)
|
||||
// 注册到nacos
|
||||
nacosConfig.Discovery(&c.RpcServerConf)
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
ctx.Cron.Start()
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
//var c config.Config
|
||||
//conf.MustLoad(*configFile, &c)
|
||||
//ctx := svc.NewServiceContext(c)
|
||||
s := zrpc.MustNewServer(common.C.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
openstack.RegisterOpenstackServer(grpcServer, server.NewOpenstackServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
if common.C.Mode == service.DevMode || common.C.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
|
||||
//rpc log
|
||||
s.AddUnaryInterceptors(rpcserver.LoggerInterceptor)
|
||||
|
||||
defer s.Stop()
|
||||
|
||||
logx.Infof("Starting rpc server at %s...\n", c.ListenOn)
|
||||
//logic.InitCron(ctx)
|
||||
// 启动并添加定时任务
|
||||
ctx.Cron.Start()
|
||||
cron.AddCronGroup(ctx)
|
||||
// 推送p端静态信息
|
||||
PushParticipantInfo(ctx.Config, ctx.ParticipantRpc)
|
||||
logx.Infof("Starting rpc server at %s...\n", common.C.ListenOn)
|
||||
s.Start()
|
||||
|
||||
//var bootstrapConfig commonConfig.BootstrapConfig
|
||||
//nacosConfig := bootstrapConfig.NacosConfig
|
||||
/* serviceConfigContent := nacosConfig.InitConfig(func(data string) {
|
||||
err := conf.LoadFromYamlBytes([]byte(data), &c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})*/
|
||||
//err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c)
|
||||
/*if err != nil {
|
||||
panic(err)
|
||||
}*/
|
||||
// start log component
|
||||
//logx.MustSetup(c.LogConf)
|
||||
// 注册到nacos
|
||||
// nacosConfig.Discovery(&c.RpcServerConf)
|
||||
|
||||
//rpc log
|
||||
//s.AddUnaryInterceptors(rpcserver.LoggerInterceptor)
|
||||
|
||||
//logic.InitCron(ctx)
|
||||
|
||||
}
|
||||
|
||||
/*// PushParticipantInfo 推送p端静态信息
|
||||
// PushParticipantInfo 推送p端静态信息
|
||||
func PushParticipantInfo(config config.Config, participantService participantservice.ParticipantService) {
|
||||
participantId, err := tool.GetParticipantId(*configFile)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 从配置文件中读取participant标签信息
|
||||
var labels []*pcmCore.ParticipantLabel
|
||||
for k, v := range config.Participant.Labels {
|
||||
labels = append(labels, &pcmCore.ParticipantLabel{
|
||||
Key: k,
|
||||
Value: v,
|
||||
})
|
||||
}
|
||||
|
||||
req := participantservice.ParticipantPhyReq{}
|
||||
tool.Convert(config.Participant, &req)
|
||||
req.ParticipantId = participantId
|
||||
req.LabelInfo = labels
|
||||
|
||||
resp, err := participantService.RegisterParticipant(context.Background(), &req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新本地配置文件ParticipantId
|
||||
tool.UpdateParticipantId(*configFile, strconv.FormatInt(resp.ParticipantId, 10))
|
||||
}*/
|
||||
//participantId, err := tool.GetParticipantId(*configFile)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// 从配置文件中读取participant标签信息
|
||||
//var labels []*pcmCore.ParticipantLabel
|
||||
//for k, v := range config.Participant.Labels {
|
||||
// labels = append(labels, &pcmCore.ParticipantLabel{
|
||||
// Key: k,
|
||||
// Value: v,
|
||||
// })
|
||||
//}
|
||||
//
|
||||
//req := participantservice.ParticipantPhyReq{}
|
||||
//tool.Convert(config.Participant, &req)
|
||||
//req.ParticipantId = participantId
|
||||
//req.LabelInfo = labels
|
||||
//
|
||||
//resp, err := participantService.RegisterParticipant(context.Background(), &req)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// 更新本地配置文件ParticipantId
|
||||
//tool.UpdateParticipantId(*configFile, strconv.FormatInt(resp.ParticipantId, 10))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue