Authored by qinchao

自动伸缩

@@ -15,6 +15,8 @@ public class QcloudModifyScalingGroupReq { @@ -15,6 +15,8 @@ public class QcloudModifyScalingGroupReq {
15 */ 15 */
16 private String scalingGroupId; 16 private String scalingGroupId;
17 17
  18 + private String awsScalingGroupName;
  19 +
18 /** 20 /**
19 * 必填 21 * 必填
20 * 修改后的伸缩组的最小伸缩数,即伸缩组内最小CVM实例数,范围0-30,且不大于maxSize。当伸缩组CVM实例数小于minSize时,AS会自动添加CVM实例,使得伸缩组内的当前实例数等于minSize 22 * 修改后的伸缩组的最小伸缩数,即伸缩组内最小CVM实例数,范围0-30,且不大于maxSize。当伸缩组CVM实例数小于minSize时,AS会自动添加CVM实例,使得伸缩组内的当前实例数等于minSize
@@ -15,6 +15,7 @@ import java.util.List; @@ -15,6 +15,7 @@ import java.util.List;
15 public class AutoScalingGroup { 15 public class AutoScalingGroup {
16 16
17 private String name; 17 private String name;
  18 + private String awsGroupName;
18 private String tagForName; 19 private String tagForName;
19 private List<AutoScalingHost> autoScalingHosts = new LinkedList<>(); 20 private List<AutoScalingHost> autoScalingHosts = new LinkedList<>();
20 private String id; 21 private String id;
@@ -100,7 +100,7 @@ public class AutoScalingCtrl { @@ -100,7 +100,7 @@ public class AutoScalingCtrl {
100 req.setCloudType(cloudType); 100 req.setCloudType(cloudType);
101 if(1==cloudType){ 101 if(1==cloudType){
102 AwsModifyScalingGroupReq awsReq=new AwsModifyScalingGroupReq(); 102 AwsModifyScalingGroupReq awsReq=new AwsModifyScalingGroupReq();
103 - awsReq.setScalingGroupName(qCloudReq.getScalingGroupName()); 103 + awsReq.setScalingGroupName(qCloudReq.getAwsScalingGroupName());
104 awsReq.setMaxSize(qCloudReq.getMaxSize()); 104 awsReq.setMaxSize(qCloudReq.getMaxSize());
105 awsReq.setMinSize(qCloudReq.getMinSize()); 105 awsReq.setMinSize(qCloudReq.getMinSize());
106 awsReq.setDesiredCapacity(qCloudReq.getDesiredCapacity()); 106 awsReq.setDesiredCapacity(qCloudReq.getDesiredCapacity());
@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 </div> 181 </div>
182 182
183 <script src="<%=basePath%>script/common/genarate_left_panel.js"></script> 183 <script src="<%=basePath%>script/common/genarate_left_panel.js"></script>
184 -<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171019-101"></script> 184 +<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171022-1"></script>
185 <script> 185 <script>
186 $("#li_manager").addClass("active open"); 186 $("#li_manager").addClass("active open");
187 $("#li_autoscaling").addClass("active"); 187 $("#li_autoscaling").addClass("active");
@@ -50,6 +50,17 @@ function getColumns(){ @@ -50,6 +50,17 @@ function getColumns(){
50 }; 50 };
51 } 51 }
52 }, 52 },
  53 + /* {
  54 + title : "aws组名",
  55 + field : "awsGroupName",
  56 + hidden:true,
  57 + width : "20%",
  58 + styler : function(value, rowData, rowIndex){
  59 + return {
  60 + "vertical-align" : "middle"
  61 + };
  62 + }
  63 + },*/
53 { 64 {
54 title : "主机", 65 title : "主机",
55 field : "ip", 66 field : "ip",
@@ -179,6 +190,7 @@ function getColumns(){ @@ -179,6 +190,7 @@ function getColumns(){
179 $("<button onclick=\"changeServer(\'" 190 $("<button onclick=\"changeServer(\'"
180 + rowData.id + "\',\'" 191 + rowData.id + "\',\'"
181 + rowData.name + "\',\'" 192 + rowData.name + "\',\'"
  193 + + rowData.awsGroupName + "\',\'"
182 + tmp_protectedFromCount + "\',\'" 194 + tmp_protectedFromCount + "\',\'"
183 + rowData.desired + "\',\'" 195 + rowData.desired + "\',\'"
184 + rowData.min + "\',\'" 196 + rowData.min + "\',\'"
@@ -198,6 +210,7 @@ function getColumns(){ @@ -198,6 +210,7 @@ function getColumns(){
198 210
199 //修改前原始数据,用于判断是否需要调用修改接口 211 //修改前原始数据,用于判断是否需要调用修改接口
200 var scalingGroupName; 212 var scalingGroupName;
  213 +var aws_scalingGroupName;
201 var souScalingGroupId; 214 var souScalingGroupId;
202 var souProtectedFromCount; 215 var souProtectedFromCount;
203 var souDesiredCapacity; 216 var souDesiredCapacity;
@@ -210,8 +223,9 @@ var souInstanceIps; @@ -210,8 +223,9 @@ var souInstanceIps;
210 var newInstanceIps; 223 var newInstanceIps;
211 var souProjectNames; 224 var souProjectNames;
212 //修改伸缩组 225 //修改伸缩组
213 -function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){ 226 +function changeServer(scalingGroupId, groupName,awsGroupName, protectedFromCount, desiredCapacity, minSize, maxSize){
214 scalingGroupName = groupName; 227 scalingGroupName = groupName;
  228 + aws_scalingGroupName=awsGroupName;
215 souScalingGroupId = scalingGroupId; 229 souScalingGroupId = scalingGroupId;
216 souProtectedFromCount = protectedFromCount; 230 souProtectedFromCount = protectedFromCount;
217 souDesiredCapacity = desiredCapacity; 231 souDesiredCapacity = desiredCapacity;
@@ -295,6 +309,7 @@ function changeOk(){ @@ -295,6 +309,7 @@ function changeOk(){
295 if(1 == $("#cloudType").val()||2 == $("#cloudType").val()){ 309 if(1 == $("#cloudType").val()||2 == $("#cloudType").val()){
296 cloudParms.scalingGroupId = souScalingGroupId; 310 cloudParms.scalingGroupId = souScalingGroupId;
297 cloudParms.scalingGroupName = scalingGroupName;//aws需要以伸缩组名作为主键 311 cloudParms.scalingGroupName = scalingGroupName;//aws需要以伸缩组名作为主键
  312 + cloudParms.awsScalingGroupName=aws_scalingGroupName;
298 cloudParms.minSize = parseInt(minSize); 313 cloudParms.minSize = parseInt(minSize);
299 cloudParms.maxSize = parseInt(maxSize); 314 cloudParms.maxSize = parseInt(maxSize);
300 cloudParms.desiredCapacity = parseInt(desiredCapacity); 315 cloudParms.desiredCapacity = parseInt(desiredCapacity);