Authored by qinchao

自动伸缩

... ... @@ -15,6 +15,8 @@ public class QcloudModifyScalingGroupReq {
*/
private String scalingGroupId;
private String awsScalingGroupName;
/**
* 必填
* 修改后的伸缩组的最小伸缩数,即伸缩组内最小CVM实例数,范围0-30,且不大于maxSize。当伸缩组CVM实例数小于minSize时,AS会自动添加CVM实例,使得伸缩组内的当前实例数等于minSize
... ...
... ... @@ -15,6 +15,7 @@ import java.util.List;
public class AutoScalingGroup {
private String name;
private String awsGroupName;
private String tagForName;
private List<AutoScalingHost> autoScalingHosts = new LinkedList<>();
private String id;
... ...
... ... @@ -100,7 +100,7 @@ public class AutoScalingCtrl {
req.setCloudType(cloudType);
if(1==cloudType){
AwsModifyScalingGroupReq awsReq=new AwsModifyScalingGroupReq();
awsReq.setScalingGroupName(qCloudReq.getScalingGroupName());
awsReq.setScalingGroupName(qCloudReq.getAwsScalingGroupName());
awsReq.setMaxSize(qCloudReq.getMaxSize());
awsReq.setMinSize(qCloudReq.getMinSize());
awsReq.setDesiredCapacity(qCloudReq.getDesiredCapacity());
... ...
... ... @@ -181,7 +181,7 @@
</div>
<script src="<%=basePath%>script/common/genarate_left_panel.js"></script>
<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171019-101"></script>
<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171022-1"></script>
<script>
$("#li_manager").addClass("active open");
$("#li_autoscaling").addClass("active");
... ...
... ... @@ -50,6 +50,17 @@ function getColumns(){
};
}
},
/* {
title : "aws组名",
field : "awsGroupName",
hidden:true,
width : "20%",
styler : function(value, rowData, rowIndex){
return {
"vertical-align" : "middle"
};
}
},*/
{
title : "主机",
field : "ip",
... ... @@ -179,6 +190,7 @@ function getColumns(){
$("<button onclick=\"changeServer(\'"
+ rowData.id + "\',\'"
+ rowData.name + "\',\'"
+ rowData.awsGroupName + "\',\'"
+ tmp_protectedFromCount + "\',\'"
+ rowData.desired + "\',\'"
+ rowData.min + "\',\'"
... ... @@ -198,6 +210,7 @@ function getColumns(){
//修改前原始数据,用于判断是否需要调用修改接口
var scalingGroupName;
var aws_scalingGroupName;
var souScalingGroupId;
var souProtectedFromCount;
var souDesiredCapacity;
... ... @@ -210,8 +223,9 @@ var souInstanceIps;
var newInstanceIps;
var souProjectNames;
//修改伸缩组
function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){
function changeServer(scalingGroupId, groupName,awsGroupName, protectedFromCount, desiredCapacity, minSize, maxSize){
scalingGroupName = groupName;
aws_scalingGroupName=awsGroupName;
souScalingGroupId = scalingGroupId;
souProtectedFromCount = protectedFromCount;
souDesiredCapacity = desiredCapacity;
... ... @@ -295,6 +309,7 @@ function changeOk(){
if(1 == $("#cloudType").val()||2 == $("#cloudType").val()){
cloudParms.scalingGroupId = souScalingGroupId;
cloudParms.scalingGroupName = scalingGroupName;//aws需要以伸缩组名作为主键
cloudParms.awsScalingGroupName=aws_scalingGroupName;
cloudParms.minSize = parseInt(minSize);
cloudParms.maxSize = parseInt(maxSize);
cloudParms.desiredCapacity = parseInt(desiredCapacity);
... ...