Skip to content

Commit b39d4a6

Browse files
Merge branch '4.20' into fix-ip6-samevlanrange
2 parents bb97ad0 + db5b6a5 commit b39d4a6

File tree

70 files changed

+462
-213
lines changed

Some content is hidden

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

70 files changed

+462
-213
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public String getRoleName() {
7272

7373
@Override
7474
public void execute() {
75-
List<ProjectRole> projectRoles;
75+
List<ProjectRole> projectRoles = new ArrayList<>();
7676
if (getProjectId() != null && getProjectRoleId() != null) {
7777
projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId()));
7878
} else if (StringUtils.isNotBlank(getRoleName())) {

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
@@ -132,14 +132,16 @@ public void execute() {
132132
Collections.sort(capacityResponses, new Comparator<CapacityResponse>() {
133133
public int compare(CapacityResponse resp1, CapacityResponse resp2) {
134134
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
135+
// Group by zone
135136
if (res != 0) {
136137
return res;
137-
} else {
138-
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
139138
}
139+
// Sort by capacity type only if not already sorted by usage
140+
return (getSortBy() != null) ? 0 : resp1.getCapacityType().compareTo(resp2.getCapacityType());
140141
}
141142
});
142143

144+
143145
response.setResponses(capacityResponses);
144146
response.setResponseName(getCommandName());
145147
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
@@ -74,7 +74,7 @@ public Long getServiceOfferingId() {
7474
}
7575

7676
public Map<String, String> getDetails() {
77-
return details;
77+
return convertDetailsToMap(details);
7878
}
7979

8080
/////////////////////////////////////////////////////

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
@@ -68,7 +68,7 @@ public Long getServiceOfferingId() {
6868
}
6969

7070
public Map<String, String> getDetails() {
71-
return details;
71+
return convertDetailsToMap(details);
7272
}
7373

7474
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public void execute() throws ResourceUnavailableException, ConcurrentOperationEx
140140
if (responses != null && !responses.isEmpty()) {
141141
response = responses.get(0);
142142
}
143-
response.setResponseName("virtualmachine");
143+
response.setResponseName(getCommandName());
144+
response.setObjectName("virtualmachine");
144145
setResponseObject(response);
145146
} else {
146147
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm");

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")

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Arrays;
2222
import java.util.Collections;
2323
import java.util.Comparator;
24+
import java.util.Date;
2425
import java.util.HashMap;
2526
import java.util.HashSet;
2627
import java.util.LinkedHashMap;
@@ -1292,6 +1293,7 @@ protected void acquireLockAndCheckIfIpv4IsFree(Network network, String requested
12921293
IPAddressVO lockedIpVO = _ipAddressDao.acquireInLockTable(ipVO.getId());
12931294
validateLockedRequestedIp(ipVO, lockedIpVO);
12941295
lockedIpVO.setState(IPAddressVO.State.Allocated);
1296+
lockedIpVO.setAllocatedTime(new Date());
12951297
_ipAddressDao.update(lockedIpVO.getId(), lockedIpVO);
12961298
} finally {
12971299
_ipAddressDao.releaseFromLockTable(ipVO.getId());

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
@@ -37,4 +37,6 @@ public interface AutoScaleVmGroupVmMapDao extends GenericDao<AutoScaleVmGroupVmM
3737
public boolean removeByGroup(long vmGroupId);
3838

3939
int expungeByVmList(List<Long> vmIds, Long batchSize);
40+
41+
int getErroredInstanceCount(long vmGroupId);
4042
}

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
@@ -127,4 +127,13 @@ public int expungeByVmList(List<Long> vmIds, Long batchSize) {
127127
sc.setParameters("vmIds", vmIds.toArray());
128128
return batchExpunge(sc, batchSize);
129129
}
130+
131+
@Override
132+
public int getErroredInstanceCount(long vmGroupId) {
133+
SearchCriteria<Integer> sc = CountBy.create();
134+
sc.setParameters("vmGroupId", vmGroupId);
135+
sc.setJoinParameters("vmSearch", "states", State.Error);
136+
final List<Integer> results = customSearch(sc, null);
137+
return results.get(0);
138+
}
130139
}

engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class SecurityGroupVMMapVO implements InternalIdentity {
5050
@Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
5151
private String guestIpAddress;
5252

53+
@Column(name = "ip6_address", table = "nics", insertable = false, updatable = false)
54+
private String guestIpv6Address;
55+
5356
@Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
5457
private State vmState;
5558

@@ -77,6 +80,10 @@ public String getGuestIpAddress() {
7780
return guestIpAddress;
7881
}
7982

83+
public String getGuestIpv6Address() {
84+
return guestIpv6Address;
85+
}
86+
8087
public long getInstanceId() {
8188
return instanceId;
8289
}

0 commit comments

Comments
 (0)