...
|
...
|
@@ -207,6 +207,7 @@ var souMaxSize; |
|
|
var souBranch;
|
|
|
//原实例ip
|
|
|
var souInstanceIps;
|
|
|
var newInstanceIps;
|
|
|
//修改伸缩组
|
|
|
function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){
|
|
|
scalingGroupName = groupName;
|
...
|
...
|
@@ -217,6 +218,7 @@ function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapa |
|
|
souMinSize = minSize;
|
|
|
souMaxSize = maxSize;
|
|
|
souInstanceIps="";
|
|
|
newInstanceIps="";
|
|
|
|
|
|
$("#myModalLabel").text("");
|
|
|
$("#protectedFromCount").val("");
|
...
|
...
|
@@ -346,6 +348,7 @@ function clear_Sour(){ |
|
|
souMinSize = "";
|
|
|
souMaxSize = "";
|
|
|
souInstanceIps ="";
|
|
|
newInstanceIps="";
|
|
|
}
|
|
|
|
|
|
//腾讯云:修改伸缩组后的下一个流程是查询伸缩活动
|
...
|
...
|
@@ -365,6 +368,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
|
//计算变化主机的ip
|
|
|
var checkPassFlag=true;
|
|
|
var changedIps="";
|
|
|
newInstanceIps="";
|
|
|
if(data.data.length != desiredCapacity){
|
|
|
checkPassFlag=false;
|
|
|
}else{
|
...
|
...
|
@@ -372,8 +376,13 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
|
var tmpInstIp=data.data[tmp];
|
|
|
if(tmpInstIp==null||tmpInstIp==""||tmpInstIp==undefined){
|
|
|
checkPassFlag=false;
|
|
|
newInstanceIps="";
|
|
|
break;
|
|
|
}
|
|
|
if(newInstanceIps.length>0){
|
|
|
newInstanceIps += ",";
|
|
|
}
|
|
|
newInstanceIps += tmpInstIp;
|
|
|
if(souInstanceIps.indexOf(tmpInstIp) < 0){
|
|
|
if(changedIps.length>0){
|
|
|
changedIps += ",";
|
...
|
...
|
@@ -395,8 +404,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
|
writeToText("结束..........");
|
|
|
return;
|
|
|
}else{
|
|
|
|
|
|
writeToText("内网ip合计:"+changedIps);
|
|
|
writeToText("新扩容的内网ip合计:"+changedIps);
|
|
|
//扩容成功后执行
|
|
|
deploy(changedIps);
|
|
|
}
|
...
|
...
|
@@ -411,89 +419,8 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit |
|
|
}, 10000);
|
|
|
}
|
|
|
|
|
|
function refCloudMessage_bak2(cloudType,showMessage, serverChangeCount,desiredCapacity){
|
|
|
var url = contextPath + 'autoScalingTool/describeScalingActivity?cloudType='+cloudType+'&scalingGroupName='+scalingGroupName ;
|
|
|
writeToText("开始..........");
|
|
|
var count = 0;
|
|
|
var intervalIndex = setInterval(function() {
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
responseError(data);
|
|
|
}else{
|
|
|
var checkPassFlag=true;
|
|
|
var actualServerInstNum = -1;
|
|
|
if(data.data.length==0){
|
|
|
actualServerInstNum=0;
|
|
|
}else{
|
|
|
var dataJson = data.data[0];
|
|
|
if(dataJson==null){
|
|
|
checkPassFlag=false;
|
|
|
}
|
|
|
if(dataJson.scalingInstancess==null||dataJson.scalingInstancess==undefined){
|
|
|
actualServerInstNum=0;
|
|
|
}else{
|
|
|
actualServerInstNum=dataJson.scalingInstancess.length;
|
|
|
}
|
|
|
}
|
|
|
//计算变化主机的ip
|
|
|
var changedIps="";
|
|
|
if(actualServerInstNum != desiredCapacity){
|
|
|
checkPassFlag=false;
|
|
|
}else{
|
|
|
for(var tmp=0;tmp<dataJson.scalingInstancess.length;tmp++){
|
|
|
var tmpInstIp=dataJson.scalingInstancess[tmp].ip;
|
|
|
if(tmpInstIp==null||tmpInstIp==""||tmpInstIp==undefined){
|
|
|
checkPassFlag=false;
|
|
|
break;
|
|
|
}
|
|
|
if(souInstanceIps.indexOf(tmpInstIp) < 0){
|
|
|
if(changedIps.length>0){
|
|
|
changedIps += ",";
|
|
|
}
|
|
|
writeToText("扩容机器实例ID为:" + dataJson.scalingInstancess[tmp].id+",IP为:"+tmpInstIp);
|
|
|
changedIps += tmpInstIp;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(!checkPassFlag){
|
|
|
writeToText("............"+count);
|
|
|
}else{
|
|
|
writeToText("第 1 步:" + showMessage + " 成功!");
|
|
|
writeToText("...");
|
|
|
clearInterval(intervalIndex);
|
|
|
|
|
|
if(showMessage == "缩容"){
|
|
|
unDeploy(showMessage);
|
|
|
writeToText("结束..........");
|
|
|
return;
|
|
|
}else{
|
|
|
|
|
|
writeToText("内网ip合计:"+changedIps);
|
|
|
//扩容成功后执行
|
|
|
deploy(changedIps);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
count += 1;
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
}, 10000);
|
|
|
}
|
|
|
|
|
|
//写入消息
|
|
|
function writeToText(msg){
|
|
|
var d = $("#resultScalingMessage").val();
|
|
|
$("#resultScalingMessage").html(d + "
" + msg);
|
|
|
var scrollTop = $("#resultScalingMessage")[0].scrollHeight;
|
|
|
$("#resultScalingMessage").scrollTop(scrollTop);
|
|
|
}
|
|
|
//1:扩容成功后执行
|
|
|
function deploy(ips){
|
|
|
writeToText("第 2 步:获取内网成功!");
|
...
|
...
|
@@ -636,26 +563,6 @@ function deployProject(ips){ |
|
|
|
|
|
//3.1:发布项目的同时获取发布的消息
|
|
|
function deployProjectGetMsg(msgId, ips){
|
|
|
/*$.ajax({
|
|
|
url: contextPath + 'autoScalingTool/getDeployProjectNames?scalingGroupName='+scalingGroupName + '&environment=qcloud',
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
responseError(data);
|
|
|
}else{
|
|
|
var allProjects = data.data.split(",");
|
|
|
for(var testi= 0;testi<allProjects.length;testi++){
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});*/
|
|
|
|
|
|
var intervalIndexMsg = setInterval(function() {
|
|
|
var url = contextPath + 'autoScalingTool/getBuildMsgAfterDeploy?messageid=' + msgId+"&project="+scalingGroupName;
|
|
|
$.ajax({
|
...
|
...
|
@@ -682,29 +589,7 @@ function deployProjectGetMsg(msgId, ips){ |
|
|
}else{
|
|
|
writeToText(".......");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
/* var obj2 = eval("(" + data3 + ")");
|
|
|
var messagedata = obj2.data;
|
|
|
if ((messagedata.message != "") && (messagedata.message != null) && (messagedata.message != undefined)) {
|
|
|
writeToText(messagedata.message);
|
|
|
}
|
|
|
//code为2 ,则结束
|
|
|
var code = obj2.code;
|
|
|
//只有状态2,3,4才表示系统部署成功与否
|
|
|
if (code == 2 || code == 3 || code == 4) {
|
|
|
writeToText("第 3 步:系统部署成功!");
|
|
|
clearInterval(intervalIndexMsg);
|
|
|
|
|
|
writeToText(">>>第 4 步:正在进行集成测试,请稍后...");
|
|
|
//4:集成测试
|
|
|
//integrationTest(ips);
|
|
|
writeToText(">>>集成测试暂时不需要,忽略...");
|
|
|
|
|
|
writeToText(">>>更新到git,请稍后...");
|
|
|
//5:更新git文件
|
|
|
editToGit();
|
|
|
}*/
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
...
|
...
|
@@ -765,14 +650,14 @@ function editToGit(showMessage){ |
|
|
paramFront.projectName=scalingGroupName;
|
|
|
paramFront.scalingGroupId=souScalingGroupId;
|
|
|
paramFront.oldInstanceIps=souInstanceIps;
|
|
|
paramFront.newInstanceIps=newInstanceIps;
|
|
|
paramFront.upDownFlag=upDownFlag;
|
|
|
// var url = contextPath+'autoScalingTool/updateIpToGit?
|
|
|
// cloudType='+$("#cloudType").val()+'&projectName='+scalingGroupName+'&scalingGroupId=' + souScalingGroupId+"&oldInstanceIps="+souInstanceIps +"&upDownFlag="+upDownFlag;
|
|
|
var url=contextPath+'autoScalingTool/updateIpToGit';
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: 'POST',
|
|
|
data: paramFront,
|
|
|
timeout:0,
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function (data) {
|
...
|
...
|
@@ -812,6 +697,14 @@ function unDeploy(showMessage){ |
|
|
clear_Sour();
|
|
|
}
|
|
|
|
|
|
//写入消息
|
|
|
function writeToText(msg){
|
|
|
var d = $("#resultScalingMessage").val();
|
|
|
$("#resultScalingMessage").html(d + "
" + msg);
|
|
|
var scrollTop = $("#resultScalingMessage")[0].scrollHeight;
|
|
|
$("#resultScalingMessage").scrollTop(scrollTop);
|
|
|
}
|
|
|
|
|
|
//请求接口异常
|
|
|
function requestError(api){
|
|
|
writeToText('系统异常:' + api);
|
...
|
...
|
|