Skip to content

Commit 56f5ae9

Browse files
Merge branch '4.19' into 4.19-fix-vpc-vr-health-check-no-tier
2 parents c8be834 + 48648d4 commit 56f5ae9

File tree

59 files changed

+629
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+629
-193
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@ public void execute() {
127127
Collections.sort(capacityResponses, new Comparator<CapacityResponse>() {
128128
public int compare(CapacityResponse resp1, CapacityResponse resp2) {
129129
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
130+
// Group by zone
130131
if (res != 0) {
131132
return res;
132-
} else {
133-
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
134133
}
134+
// Sort by capacity type only if not already sorted by usage
135+
return (getSortBy() != null) ? 0 : resp1.getCapacityType().compareTo(resp2.getCapacityType());
135136
}
136137
});
137138

139+
138140
response.setResponses(capacityResponses);
139141
response.setResponseName(getCommandName());
140142
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public Long getServiceOfferingId() {
7676
}
7777

7878
public Map<String, String> getDetails() {
79-
return details;
79+
return convertDetailsToMap(details);
8080
}
8181

8282
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public Long getServiceOfferingId() {
7070
}
7171

7272
public Map<String, String> getDetails() {
73-
return details;
73+
return convertDetailsToMap(details);
7474
}
7575

7676
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public void execute() {
7171
response.setInstancesStatsUserOnly((Boolean) capabilities.get(ApiConstants.INSTANCES_STATS_USER_ONLY));
7272
response.setInstancesDisksStatsRetentionEnabled((Boolean) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED));
7373
response.setInstancesDisksStatsRetentionTime((Integer) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME));
74+
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
7475
response.setObjectName("capability");
7576
response.setResponseName(getCommandName());
7677
this.setResponseObject(response);

api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public class CapabilitiesResponse extends BaseResponse {
124124
@Param(description = "the retention time for Instances disks stats", since = "4.18.0")
125125
private Integer instancesDisksStatsRetentionTime;
126126

127+
@SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED)
128+
@Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0")
129+
private Boolean dynamicScalingEnabled;
130+
127131
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
128132
this.securityGroupsEnabled = securityGroupsEnabled;
129133
}
@@ -223,4 +227,8 @@ public void setInstancesDisksStatsRetentionTime(Integer instancesDisksStatsReten
223227
public void setCustomHypervisorDisplayName(String customHypervisorDisplayName) {
224228
this.customHypervisorDisplayName = customHypervisorDisplayName;
225229
}
230+
231+
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
232+
this.dynamicScalingEnabled = dynamicScalingEnabled;
233+
}
226234
}

api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class StatsResponse extends BaseResponse {
2828

2929
@SerializedName("timestamp")
30-
@Param(description = "the time when the VM stats were collected. The format is \"yyyy-MM-dd hh:mm:ss\"")
30+
@Param(description = "the time when the VM stats were collected. The format is 'yyyy-MM-dd hh:mm:ss'")
3131
private Date timestamp;
3232

3333
@SerializedName("cpuused")

core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,33 @@
1717

1818
package com.cloud.agent.api;
1919

20+
import org.apache.cloudstack.storage.volume.VolumeOnStorageTO;
21+
22+
import java.util.Map;
23+
2024
public class CheckVolumeAnswer extends Answer {
2125

2226
private long size;
27+
private Map<VolumeOnStorageTO.Detail, String> volumeDetails;
2328

2429
CheckVolumeAnswer() {
2530
}
2631

27-
public CheckVolumeAnswer(CheckVolumeCommand cmd, String details, long size) {
28-
super(cmd, true, details);
32+
public CheckVolumeAnswer(CheckVolumeCommand cmd, final boolean success, String details, long size,
33+
Map<VolumeOnStorageTO.Detail, String> volumeDetails) {
34+
super(cmd, success, details);
2935
this.size = size;
36+
this.volumeDetails = volumeDetails;
3037
}
3138

3239
public long getSize() {
3340
return size;
3441
}
3542

43+
public Map<VolumeOnStorageTO.Detail, String> getVolumeDetails() {
44+
return volumeDetails;
45+
}
46+
3647
public String getString() {
3748
return "CheckVolumeAnswer [size=" + size + "]";
3849
}

core/src/main/java/com/cloud/agent/api/CopyRemoteVolumeAnswer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,28 @@
1717

1818
package com.cloud.agent.api;
1919

20+
import org.apache.cloudstack.storage.volume.VolumeOnStorageTO;
21+
22+
import java.util.Map;
23+
2024
public class CopyRemoteVolumeAnswer extends Answer {
2125

2226
private String remoteIp;
2327
private String filename;
2428

2529
private long size;
30+
private Map<VolumeOnStorageTO.Detail, String> volumeDetails;
2631

2732
CopyRemoteVolumeAnswer() {
2833
}
2934

30-
public CopyRemoteVolumeAnswer(CopyRemoteVolumeCommand cmd, String details, String filename, long size) {
31-
super(cmd, true, details);
35+
public CopyRemoteVolumeAnswer(CopyRemoteVolumeCommand cmd, final boolean success, String details, String filename, long size,
36+
Map<VolumeOnStorageTO.Detail, String> volumeDetails) {
37+
super(cmd, success, details);
3238
this.remoteIp = cmd.getRemoteIp();
3339
this.filename = filename;
3440
this.size = size;
41+
this.volumeDetails = volumeDetails;
3542
}
3643

3744
public String getRemoteIp() {
@@ -54,6 +61,10 @@ public long getSize() {
5461
return size;
5562
}
5663

64+
public Map<VolumeOnStorageTO.Detail, String> getVolumeDetails() {
65+
return volumeDetails;
66+
}
67+
5768
public String getString() {
5869
return "CopyRemoteVolumeAnswer [remoteIp=" + remoteIp + "]";
5970
}

engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ public interface AutoScaleVmGroupVmMapDao extends GenericDao<AutoScaleVmGroupVmM
3535
public boolean removeByVm(long vmId);
3636

3737
public boolean removeByGroup(long vmGroupId);
38+
39+
int getErroredInstanceCount(long vmGroupId);
3840
}

engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,13 @@ public boolean removeByGroup(long vmGroupId) {
115115
sc.setParameters("vmGroupId", vmGroupId);
116116
return remove(sc) >= 0;
117117
}
118+
119+
@Override
120+
public int getErroredInstanceCount(long vmGroupId) {
121+
SearchCriteria<Integer> sc = CountBy.create();
122+
sc.setParameters("vmGroupId", vmGroupId);
123+
sc.setJoinParameters("vmSearch", "states", State.Error);
124+
final List<Integer> results = customSearch(sc, null);
125+
return results.get(0);
126+
}
118127
}

0 commit comments

Comments
 (0)