forked from JointCloud/pcm-openstack
feat:modify field to create virtual machine
This commit is contained in:
parent
1f8963b4de
commit
5ec7309b2f
|
@ -87,7 +87,7 @@ openstackConfig:
|
|||
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:2004
|
||||
- pcm-core-rpc:2004
|
||||
NonBlock: true
|
||||
|
||||
ParticipantId: 0
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-openstack/internal/common"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-openstack/openstack"
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
@ -32,17 +31,20 @@ func (l *CreateServerLogic) CreateServer(in *openstack.CreateServerReq) (*openst
|
|||
// todo: add your logic here and delete this line
|
||||
var resp openstack.CreateServerResp
|
||||
platform, err := common.GetOpenstackConfWithPlatform(in.Platform)
|
||||
reqByte, err := json.Marshal(in)
|
||||
token := common.GetToken(in.Platform)
|
||||
fmt.Println("错误", err)
|
||||
reqByte, err := json.Marshal(in.CrServer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload := strings.NewReader(string(reqByte))
|
||||
openstackUrl := platform.OpenstackComputeUrl
|
||||
statusCode, body, err := httputils.HttpClientWithBodyAndCode(httputils.POST, openstackUrl+"/servers", payload, token)
|
||||
fmt.Println("返回值", body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logx.Infof("pcm-openstack call createServer 返回结果! statusCode %s: ,\n body: %s ,\n err: %s", statusCode, body, err)
|
||||
if statusCode == 202 {
|
||||
err := json.Unmarshal(body, &resp)
|
||||
if err != nil {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -109,6 +109,7 @@ type (
|
|||
CreateSecurityGroupRuleResp_SecurityGroupRule = openstack.CreateSecurityGroupRuleResp_SecurityGroupRule
|
||||
CreateServerReq = openstack.CreateServerReq
|
||||
CreateServerReq_BlockDeviceMappingV2 = openstack.CreateServerReq_BlockDeviceMappingV2
|
||||
CreateServerReq_CrServer = openstack.CreateServerReq_CrServer
|
||||
CreateServerReq_Metadata = openstack.CreateServerReq_Metadata
|
||||
CreateServerReq_Networks = openstack.CreateServerReq_Networks
|
||||
CreateServerReq_OsSchHntSchedulerHints = openstack.CreateServerReq_OsSchHntSchedulerHints
|
||||
|
|
|
@ -211,6 +211,12 @@ message ListServersDetailedResp {
|
|||
//req
|
||||
message CreateServerReq {
|
||||
|
||||
string platform = 1;
|
||||
CrServer crServer = 2;
|
||||
|
||||
message CrServer{
|
||||
Server server = 1; // @gotags: copier:"Server"
|
||||
}
|
||||
message Networks {
|
||||
string uuid = 1; // @gotags: copier:"Uuid"
|
||||
string port = 2;
|
||||
|
@ -283,10 +289,7 @@ message CreateServerReq {
|
|||
string query = 7;
|
||||
string target_cell = 8;
|
||||
}
|
||||
|
||||
Server server = 1; // @gotags: copier:"Server"
|
||||
string platform = 2;
|
||||
// Os_sch_hnt_scheduler_hints OS_SCH_HNT_scheduler_hints = 2 [json_name="OS-SCH-HNT:scheduler_hints"];
|
||||
// Server server = 1; // @gotags: copier:"Server"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue