@@ -377,49 +377,45 @@ func NewCmdUHostCreate() *cobra.Command {
377377 req .UserData = sdk .String (userDataBase64 )
378378 }
379379 }
380-
380+ if * eipReq .Bandwidth != 0 || * eipReq .PayMode == "ShareBandwidth" {
381+ if * eipReq .OperatorName == "" {
382+ * eipReq .OperatorName = getEIPLine (* req .Region )
383+ }
384+ req .NetworkInterface = []uhost.CreateUHostInstanceParamNetworkInterface {{EIP : & eipReq }}
385+ }
381386 wg := & sync.WaitGroup {}
382387 tokens := make (chan struct {}, concurrent )
383388 wg .Add (count )
389+
384390 if count <= 5 {
385391 for i := 0 ; i < count ; i ++ {
386392 bindEipID := ""
387393 if len (bindEipIDs ) > i {
388394 bindEipID = bindEipIDs [i ]
389395 }
390- if bindEipID == "" && (* eipReq .Bandwidth != 0 || * eipReq .PayMode == "ShareBandwidth" ) {
391- if * eipReq .OperatorName == "" {
392- * eipReq .OperatorName = getEIPLine (* req .Region )
393- }
394- networkInterface := uhost.CreateUHostInstanceParamNetworkInterface {}
395- networkInterface .EIP = & eipReq
396- req .NetworkInterface = append (req .NetworkInterface , networkInterface )
396+ var actualRequest uhost.CreateUHostInstanceRequest
397+ actualRequest = * req
398+ if bindEipID != "" {
399+ actualRequest .NetworkInterface = nil
397400 }
398-
399- go createUhostWrapper (req , updateEIPReq , bindEipID , async , make (chan bool , count ), wg , tokens , i )
401+ createUhostWrapper (& actualRequest , updateEIPReq , bindEipID , async , make (chan bool , count ), wg , tokens , i )
400402 }
401403 } else {
402404 retCh := make (chan bool , count )
403405 ux .Doc .Disable ()
404406 refresh := ux .NewRefresh ()
405407
406- go func () {
408+ go func (req uhost. CreateUHostInstanceRequest ) {
407409 for i := 0 ; i < count ; i ++ {
410+ actualRequest := req
408411 bindEipID := ""
409412 if len (bindEipIDs ) > i {
410413 bindEipID = bindEipIDs [i ]
414+ actualRequest .NetworkInterface = nil
411415 }
412- if bindEipID == "" && (* eipReq .Bandwidth != 0 || * eipReq .PayMode == "ShareBandwidth" ) {
413- if * eipReq .OperatorName == "" {
414- * eipReq .OperatorName = getEIPLine (* req .Region )
415- }
416- networkInterface := uhost.CreateUHostInstanceParamNetworkInterface {}
417- networkInterface .EIP = & eipReq
418- req .NetworkInterface = append (req .NetworkInterface , networkInterface )
419- }
420- go createUhostWrapper (req , updateEIPReq , bindEipID , async , retCh , wg , tokens , i )
416+ go createUhostWrapper (& actualRequest , updateEIPReq , bindEipID , async , retCh , wg , tokens , i )
421417 }
422- }()
418+ }(* req )
423419
424420 go func () {
425421 var success , fail int
@@ -1456,7 +1452,7 @@ func NewCmdUhostReinstallOS(out io.Writer) *cobra.Command {
14561452 req .ReserveDisk = sdk .String ("No" )
14571453 }
14581454 req .UHostId = sdk .String (base .PickResourceID (* req .UHostId ))
1459- req .Password = sdk .String (base64 . StdEncoding . EncodeToString ([] byte ( sdk .StringValue (req .Password )) ))
1455+ req .Password = sdk .String (sdk .StringValue (req .Password ))
14601456
14611457 any , err := describeUHostByID (* req .UHostId , * req .ProjectId , * req .Region , * req .Zone )
14621458 if err != nil {
0 commit comments