|
@@ -207,6 +207,7 @@ var souMaxSize; |
|
@@ -207,6 +207,7 @@ var souMaxSize; |
207
|
var souBranch;
|
207
|
var souBranch;
|
208
|
//原实例ip
|
208
|
//原实例ip
|
209
|
var souInstanceIps;
|
209
|
var souInstanceIps;
|
|
|
210
|
+var newInstanceIps;
|
210
|
//修改伸缩组
|
211
|
//修改伸缩组
|
211
|
function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){
|
212
|
function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){
|
212
|
scalingGroupName = groupName;
|
213
|
scalingGroupName = groupName;
|
|
@@ -217,6 +218,7 @@ function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapa |
|
@@ -217,6 +218,7 @@ function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapa |
217
|
souMinSize = minSize;
|
218
|
souMinSize = minSize;
|
218
|
souMaxSize = maxSize;
|
219
|
souMaxSize = maxSize;
|
219
|
souInstanceIps="";
|
220
|
souInstanceIps="";
|
|
|
221
|
+ newInstanceIps="";
|
220
|
|
222
|
|
221
|
$("#myModalLabel").text("");
|
223
|
$("#myModalLabel").text("");
|
222
|
$("#protectedFromCount").val("");
|
224
|
$("#protectedFromCount").val("");
|
|
@@ -346,6 +348,7 @@ function clear_Sour(){ |
|
@@ -346,6 +348,7 @@ function clear_Sour(){ |
346
|
souMinSize = "";
|
348
|
souMinSize = "";
|
347
|
souMaxSize = "";
|
349
|
souMaxSize = "";
|
348
|
souInstanceIps ="";
|
350
|
souInstanceIps ="";
|
|
|
351
|
+ newInstanceIps="";
|
349
|
}
|
352
|
}
|
350
|
|
353
|
|
351
|
//腾讯云:修改伸缩组后的下一个流程是查询伸缩活动
|
354
|
//腾讯云:修改伸缩组后的下一个流程是查询伸缩活动
|
|
@@ -365,6 +368,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
@@ -365,6 +368,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
365
|
//计算变化主机的ip
|
368
|
//计算变化主机的ip
|
366
|
var checkPassFlag=true;
|
369
|
var checkPassFlag=true;
|
367
|
var changedIps="";
|
370
|
var changedIps="";
|
|
|
371
|
+ newInstanceIps="";
|
368
|
if(data.data.length != desiredCapacity){
|
372
|
if(data.data.length != desiredCapacity){
|
369
|
checkPassFlag=false;
|
373
|
checkPassFlag=false;
|
370
|
}else{
|
374
|
}else{
|
|
@@ -372,8 +376,13 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
@@ -372,8 +376,13 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
372
|
var tmpInstIp=data.data[tmp];
|
376
|
var tmpInstIp=data.data[tmp];
|
373
|
if(tmpInstIp==null||tmpInstIp==""||tmpInstIp==undefined){
|
377
|
if(tmpInstIp==null||tmpInstIp==""||tmpInstIp==undefined){
|
374
|
checkPassFlag=false;
|
378
|
checkPassFlag=false;
|
|
|
379
|
+ newInstanceIps="";
|
375
|
break;
|
380
|
break;
|
376
|
}
|
381
|
}
|
|
|
382
|
+ if(newInstanceIps.length>0){
|
|
|
383
|
+ newInstanceIps += ",";
|
|
|
384
|
+ }
|
|
|
385
|
+ newInstanceIps += tmpInstIp;
|
377
|
if(souInstanceIps.indexOf(tmpInstIp) < 0){
|
386
|
if(souInstanceIps.indexOf(tmpInstIp) < 0){
|
378
|
if(changedIps.length>0){
|
387
|
if(changedIps.length>0){
|
379
|
changedIps += ",";
|
388
|
changedIps += ",";
|
|
@@ -395,8 +404,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
@@ -395,8 +404,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
395
|
writeToText("结束..........");
|
404
|
writeToText("结束..........");
|
396
|
return;
|
405
|
return;
|
397
|
}else{
|
406
|
}else{
|
398
|
-
|
|
|
399
|
- writeToText("内网ip合计:"+changedIps);
|
407
|
+ writeToText("新扩容的内网ip合计:"+changedIps);
|
400
|
//扩容成功后执行
|
408
|
//扩容成功后执行
|
401
|
deploy(changedIps);
|
409
|
deploy(changedIps);
|
402
|
}
|
410
|
}
|
|
@@ -411,89 +419,8 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
@@ -411,89 +419,8 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
411
|
}, 10000);
|
419
|
}, 10000);
|
412
|
}
|
420
|
}
|
413
|
|
421
|
|
414
|
-function refCloudMessage_bak2(cloudType,showMessage, serverChangeCount,desiredCapacity){
|
|
|
415
|
- var url = contextPath + 'autoScalingTool/describeScalingActivity?cloudType='+cloudType+'&scalingGroupName='+scalingGroupName ;
|
|
|
416
|
- writeToText("开始..........");
|
|
|
417
|
- var count = 0;
|
|
|
418
|
- var intervalIndex = setInterval(function() {
|
|
|
419
|
- $.ajax({
|
|
|
420
|
- url: url,
|
|
|
421
|
- type: 'POST',
|
|
|
422
|
- dataType: 'json',
|
|
|
423
|
- success: function (data) {
|
|
|
424
|
- if (!data || data.code != 200) {
|
|
|
425
|
- responseError(data);
|
|
|
426
|
- }else{
|
|
|
427
|
- var checkPassFlag=true;
|
|
|
428
|
- var actualServerInstNum = -1;
|
|
|
429
|
- if(data.data.length==0){
|
|
|
430
|
- actualServerInstNum=0;
|
|
|
431
|
- }else{
|
|
|
432
|
- var dataJson = data.data[0];
|
|
|
433
|
- if(dataJson==null){
|
|
|
434
|
- checkPassFlag=false;
|
|
|
435
|
- }
|
|
|
436
|
- if(dataJson.scalingInstancess==null||dataJson.scalingInstancess==undefined){
|
|
|
437
|
- actualServerInstNum=0;
|
|
|
438
|
- }else{
|
|
|
439
|
- actualServerInstNum=dataJson.scalingInstancess.length;
|
|
|
440
|
- }
|
|
|
441
|
- }
|
|
|
442
|
- //计算变化主机的ip
|
|
|
443
|
- var changedIps="";
|
|
|
444
|
- if(actualServerInstNum != desiredCapacity){
|
|
|
445
|
- checkPassFlag=false;
|
|
|
446
|
- }else{
|
|
|
447
|
- for(var tmp=0;tmp<dataJson.scalingInstancess.length;tmp++){
|
|
|
448
|
- var tmpInstIp=dataJson.scalingInstancess[tmp].ip;
|
|
|
449
|
- if(tmpInstIp==null||tmpInstIp==""||tmpInstIp==undefined){
|
|
|
450
|
- checkPassFlag=false;
|
|
|
451
|
- break;
|
|
|
452
|
- }
|
|
|
453
|
- if(souInstanceIps.indexOf(tmpInstIp) < 0){
|
|
|
454
|
- if(changedIps.length>0){
|
|
|
455
|
- changedIps += ",";
|
|
|
456
|
- }
|
|
|
457
|
- writeToText("扩容机器实例ID为:" + dataJson.scalingInstancess[tmp].id+",IP为:"+tmpInstIp);
|
|
|
458
|
- changedIps += tmpInstIp;
|
|
|
459
|
- }
|
|
|
460
|
- }
|
|
|
461
|
- }
|
|
|
462
|
- if(!checkPassFlag){
|
|
|
463
|
- writeToText("............"+count);
|
|
|
464
|
- }else{
|
|
|
465
|
- writeToText("第 1 步:" + showMessage + " 成功!");
|
|
|
466
|
- writeToText("...");
|
|
|
467
|
- clearInterval(intervalIndex);
|
|
|
468
|
|
422
|
|
469
|
- if(showMessage == "缩容"){
|
|
|
470
|
- unDeploy(showMessage);
|
|
|
471
|
- writeToText("结束..........");
|
|
|
472
|
- return;
|
|
|
473
|
- }else{
|
|
|
474
|
|
423
|
|
475
|
- writeToText("内网ip合计:"+changedIps);
|
|
|
476
|
- //扩容成功后执行
|
|
|
477
|
- deploy(changedIps);
|
|
|
478
|
- }
|
|
|
479
|
- }
|
|
|
480
|
- }
|
|
|
481
|
- count += 1;
|
|
|
482
|
- },
|
|
|
483
|
- error: function (e) {
|
|
|
484
|
- requestError(url);
|
|
|
485
|
- }
|
|
|
486
|
- });
|
|
|
487
|
- }, 10000);
|
|
|
488
|
-}
|
|
|
489
|
-
|
|
|
490
|
-//写入消息
|
|
|
491
|
-function writeToText(msg){
|
|
|
492
|
- var d = $("#resultScalingMessage").val();
|
|
|
493
|
- $("#resultScalingMessage").html(d + "
" + msg);
|
|
|
494
|
- var scrollTop = $("#resultScalingMessage")[0].scrollHeight;
|
|
|
495
|
- $("#resultScalingMessage").scrollTop(scrollTop);
|
|
|
496
|
-}
|
|
|
497
|
//1:扩容成功后执行
|
424
|
//1:扩容成功后执行
|
498
|
function deploy(ips){
|
425
|
function deploy(ips){
|
499
|
writeToText("第 2 步:获取内网成功!");
|
426
|
writeToText("第 2 步:获取内网成功!");
|
|
@@ -636,26 +563,6 @@ function deployProject(ips){ |
|
@@ -636,26 +563,6 @@ function deployProject(ips){ |
636
|
|
563
|
|
637
|
//3.1:发布项目的同时获取发布的消息
|
564
|
//3.1:发布项目的同时获取发布的消息
|
638
|
function deployProjectGetMsg(msgId, ips){
|
565
|
function deployProjectGetMsg(msgId, ips){
|
639
|
- /*$.ajax({
|
|
|
640
|
- url: contextPath + 'autoScalingTool/getDeployProjectNames?scalingGroupName='+scalingGroupName + '&environment=qcloud',
|
|
|
641
|
- type: 'POST',
|
|
|
642
|
- dataType: 'json',
|
|
|
643
|
- async: false,
|
|
|
644
|
- success: function (data) {
|
|
|
645
|
- if (!data || data.code != 200) {
|
|
|
646
|
- responseError(data);
|
|
|
647
|
- }else{
|
|
|
648
|
- var allProjects = data.data.split(",");
|
|
|
649
|
- for(var testi= 0;testi<allProjects.length;testi++){
|
|
|
650
|
-
|
|
|
651
|
- }
|
|
|
652
|
- }
|
|
|
653
|
- },
|
|
|
654
|
- error: function (e) {
|
|
|
655
|
- requestError(url);
|
|
|
656
|
- }
|
|
|
657
|
- });*/
|
|
|
658
|
-
|
|
|
659
|
var intervalIndexMsg = setInterval(function() {
|
566
|
var intervalIndexMsg = setInterval(function() {
|
660
|
var url = contextPath + 'autoScalingTool/getBuildMsgAfterDeploy?messageid=' + msgId+"&project="+scalingGroupName;
|
567
|
var url = contextPath + 'autoScalingTool/getBuildMsgAfterDeploy?messageid=' + msgId+"&project="+scalingGroupName;
|
661
|
$.ajax({
|
568
|
$.ajax({
|
|
@@ -682,29 +589,7 @@ function deployProjectGetMsg(msgId, ips){ |
|
@@ -682,29 +589,7 @@ function deployProjectGetMsg(msgId, ips){ |
682
|
}else{
|
589
|
}else{
|
683
|
writeToText(".......");
|
590
|
writeToText(".......");
|
684
|
}
|
591
|
}
|
685
|
-
|
|
|
686
|
- }
|
|
|
687
|
- /* var obj2 = eval("(" + data3 + ")");
|
|
|
688
|
- var messagedata = obj2.data;
|
|
|
689
|
- if ((messagedata.message != "") && (messagedata.message != null) && (messagedata.message != undefined)) {
|
|
|
690
|
- writeToText(messagedata.message);
|
|
|
691
|
}
|
592
|
}
|
692
|
- //code为2 ,则结束
|
|
|
693
|
- var code = obj2.code;
|
|
|
694
|
- //只有状态2,3,4才表示系统部署成功与否
|
|
|
695
|
- if (code == 2 || code == 3 || code == 4) {
|
|
|
696
|
- writeToText("第 3 步:系统部署成功!");
|
|
|
697
|
- clearInterval(intervalIndexMsg);
|
|
|
698
|
-
|
|
|
699
|
- writeToText(">>>第 4 步:正在进行集成测试,请稍后...");
|
|
|
700
|
- //4:集成测试
|
|
|
701
|
- //integrationTest(ips);
|
|
|
702
|
- writeToText(">>>集成测试暂时不需要,忽略...");
|
|
|
703
|
-
|
|
|
704
|
- writeToText(">>>更新到git,请稍后...");
|
|
|
705
|
- //5:更新git文件
|
|
|
706
|
- editToGit();
|
|
|
707
|
- }*/
|
|
|
708
|
},
|
593
|
},
|
709
|
error: function (e) {
|
594
|
error: function (e) {
|
710
|
requestError(url);
|
595
|
requestError(url);
|
|
@@ -765,14 +650,14 @@ function editToGit(showMessage){ |
|
@@ -765,14 +650,14 @@ function editToGit(showMessage){ |
765
|
paramFront.projectName=scalingGroupName;
|
650
|
paramFront.projectName=scalingGroupName;
|
766
|
paramFront.scalingGroupId=souScalingGroupId;
|
651
|
paramFront.scalingGroupId=souScalingGroupId;
|
767
|
paramFront.oldInstanceIps=souInstanceIps;
|
652
|
paramFront.oldInstanceIps=souInstanceIps;
|
|
|
653
|
+ paramFront.newInstanceIps=newInstanceIps;
|
768
|
paramFront.upDownFlag=upDownFlag;
|
654
|
paramFront.upDownFlag=upDownFlag;
|
769
|
- // var url = contextPath+'autoScalingTool/updateIpToGit?
|
|
|
770
|
- // cloudType='+$("#cloudType").val()+'&projectName='+scalingGroupName+'&scalingGroupId=' + souScalingGroupId+"&oldInstanceIps="+souInstanceIps +"&upDownFlag="+upDownFlag;
|
|
|
771
|
var url=contextPath+'autoScalingTool/updateIpToGit';
|
655
|
var url=contextPath+'autoScalingTool/updateIpToGit';
|
772
|
$.ajax({
|
656
|
$.ajax({
|
773
|
url: url,
|
657
|
url: url,
|
774
|
type: 'POST',
|
658
|
type: 'POST',
|
775
|
data: paramFront,
|
659
|
data: paramFront,
|
|
|
660
|
+ timeout:0,
|
776
|
dataType: 'json',
|
661
|
dataType: 'json',
|
777
|
async: false,
|
662
|
async: false,
|
778
|
success: function (data) {
|
663
|
success: function (data) {
|
|
@@ -812,6 +697,14 @@ function unDeploy(showMessage){ |
|
@@ -812,6 +697,14 @@ function unDeploy(showMessage){ |
812
|
clear_Sour();
|
697
|
clear_Sour();
|
813
|
}
|
698
|
}
|
814
|
|
699
|
|
|
|
700
|
+//写入消息
|
|
|
701
|
+function writeToText(msg){
|
|
|
702
|
+ var d = $("#resultScalingMessage").val();
|
|
|
703
|
+ $("#resultScalingMessage").html(d + "
" + msg);
|
|
|
704
|
+ var scrollTop = $("#resultScalingMessage")[0].scrollHeight;
|
|
|
705
|
+ $("#resultScalingMessage").scrollTop(scrollTop);
|
|
|
706
|
+}
|
|
|
707
|
+
|
815
|
//请求接口异常
|
708
|
//请求接口异常
|
816
|
function requestError(api){
|
709
|
function requestError(api){
|
817
|
writeToText('系统异常:' + api);
|
710
|
writeToText('系统异常:' + api);
|