Skip to content

Commit

Permalink
Merge remote-tracking branch 'apache/4.18' into 4.18-asgroup-add-user…
Browse files Browse the repository at this point in the history
…data-support
  • Loading branch information
weizhouapache committed Aug 16, 2023
2 parents 6e12939 + e8b4911 commit bb79878
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
description = "The ID of the system virtual machine")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
private Boolean forced;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class StopVMCmd extends BaseAsyncCmd implements UserCmd {
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM "
+ "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). The caller knows the VM is stopped.")
+ "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted)."
+ " This option is to be used if the caller knows the VM is stopped and should be marked as such.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class StopNetScalerVMCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the NetScaler vm")
private Long id;

@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.")
private Boolean forced;

// ///////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,7 @@ private List<TemplateJoinVO> applyPublicTemplateRestriction(List<TemplateJoinVO>
@Override
public ListResponse<TemplateResponse> listIsos(ListIsosCmd cmd) {
Pair<List<TemplateJoinVO>, Integer> result = searchForIsosInternal(cmd);
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
ListResponse<TemplateResponse> response = new ListResponse<>();

ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListIsosCmdByAdmin) {
Expand All @@ -3967,11 +3967,11 @@ private Pair<List<TemplateJoinVO>, Integer> searchForIsosInternal(ListIsosCmd cm
listAll = true;
}

List<Long> permittedAccountIds = new ArrayList<Long>();
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
List<Long> permittedAccountIds = new ArrayList<>();
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<>(cmd.getDomainId(), cmd.isRecursive(), null);
_accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccountIds, domainIdRecursiveListProject, listAll, false);
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
List<Account> permittedAccounts = new ArrayList<Account>();
List<Account> permittedAccounts = new ArrayList<>();
for (Long accountId : permittedAccountIds) {
permittedAccounts.add(_accountMgr.getAccount(accountId));
}
Expand Down
29 changes: 14 additions & 15 deletions server/src/main/java/com/cloud/api/query/ViewResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -150,7 +149,7 @@ public static List<UserVmResponse> createUserVmResponse(ResponseView view, Strin
public static List<UserVmResponse> createUserVmResponse(ResponseView view, String objectName, Set<VMDetails> details, Boolean accumulateStats, Boolean showUserData,
UserVmJoinVO... userVms) {
Account caller = CallContext.current().getCallingAccount();
Hashtable<Long, UserVmResponse> vmDataList = new Hashtable<Long, UserVmResponse>();
LinkedHashMap<Long, UserVmResponse> vmDataList = new LinkedHashMap<>();
// Initialise the vmdatalist with the input data

for (UserVmJoinVO userVm : userVms) {
Expand All @@ -169,7 +168,7 @@ public static List<UserVmResponse> createUserVmResponse(ResponseView view, Strin

public static List<DomainRouterResponse> createDomainRouterResponse(DomainRouterJoinVO... routers) {
Account caller = CallContext.current().getCallingAccount();
Hashtable<Long, DomainRouterResponse> vrDataList = new Hashtable<Long, DomainRouterResponse>();
LinkedHashMap<Long, DomainRouterResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (DomainRouterJoinVO vr : routers) {
DomainRouterResponse vrData = vrDataList.get(vr.getId());
Expand All @@ -187,7 +186,7 @@ public static List<DomainRouterResponse> createDomainRouterResponse(DomainRouter

public static List<SecurityGroupResponse> createSecurityGroupResponses(List<SecurityGroupJoinVO> securityGroups) {
Account caller = CallContext.current().getCallingAccount();
Hashtable<Long, SecurityGroupResponse> vrDataList = new Hashtable<Long, SecurityGroupResponse>();
LinkedHashMap<Long, SecurityGroupResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (SecurityGroupJoinVO vr : securityGroups) {
SecurityGroupResponse vrData = vrDataList.get(vr.getId());
Expand All @@ -205,7 +204,7 @@ public static List<SecurityGroupResponse> createSecurityGroupResponses(List<Secu
}

public static List<ProjectResponse> createProjectResponse(EnumSet<DomainDetails> details, ProjectJoinVO... projects) {
Hashtable<Long, ProjectResponse> prjDataList = new Hashtable<Long, ProjectResponse>();
LinkedHashMap<Long, ProjectResponse> prjDataList = new LinkedHashMap<>();
// Initialise the prjdatalist with the input data
for (ProjectJoinVO p : projects) {
ProjectResponse pData = prjDataList.get(p.getId());
Expand Down Expand Up @@ -247,7 +246,7 @@ public static List<ProjectInvitationResponse> createProjectInvitationResponse(Pr
}

public static List<HostResponse> createHostResponse(EnumSet<HostDetails> details, HostJoinVO... hosts) {
Hashtable<Long, HostResponse> vrDataList = new Hashtable<Long, HostResponse>();
LinkedHashMap<Long, HostResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (HostJoinVO vr : hosts) {
HostResponse vrData = ApiDBUtils.newHostResponse(vr, details);
Expand All @@ -257,7 +256,7 @@ public static List<HostResponse> createHostResponse(EnumSet<HostDetails> details
}

public static List<HostForMigrationResponse> createHostForMigrationResponse(EnumSet<HostDetails> details, HostJoinVO... hosts) {
Hashtable<Long, HostForMigrationResponse> vrDataList = new Hashtable<Long, HostForMigrationResponse>();
LinkedHashMap<Long, HostForMigrationResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (HostJoinVO vr : hosts) {
HostForMigrationResponse vrData = ApiDBUtils.newHostForMigrationResponse(vr, details);
Expand All @@ -267,7 +266,7 @@ public static List<HostForMigrationResponse> createHostForMigrationResponse(Enum
}

public static List<VolumeResponse> createVolumeResponse(ResponseView view, VolumeJoinVO... volumes) {
Hashtable<Long, VolumeResponse> vrDataList = new Hashtable<Long, VolumeResponse>();
LinkedHashMap<Long, VolumeResponse> vrDataList = new LinkedHashMap<>();
DecimalFormat df = new DecimalFormat("0.0%");
for (VolumeJoinVO vr : volumes) {
VolumeResponse vrData = vrDataList.get(vr.getId());
Expand Down Expand Up @@ -308,7 +307,7 @@ public static List<VolumeResponse> createVolumeResponse(ResponseView view, Volum
}

public static List<StoragePoolResponse> createStoragePoolResponse(StoragePoolJoinVO... pools) {
Hashtable<Long, StoragePoolResponse> vrDataList = new Hashtable<Long, StoragePoolResponse>();
LinkedHashMap<Long, StoragePoolResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (StoragePoolJoinVO vr : pools) {
StoragePoolResponse vrData = vrDataList.get(vr.getId());
Expand Down Expand Up @@ -345,7 +344,7 @@ public static List<HostTagResponse> createHostTagResponse(HostTagVO... hostTags)
}

public static List<ImageStoreResponse> createImageStoreResponse(ImageStoreJoinVO... stores) {
Hashtable<Long, ImageStoreResponse> vrDataList = new Hashtable<Long, ImageStoreResponse>();
LinkedHashMap<Long, ImageStoreResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (ImageStoreJoinVO vr : stores) {
ImageStoreResponse vrData = vrDataList.get(vr.getId());
Expand All @@ -362,7 +361,7 @@ public static List<ImageStoreResponse> createImageStoreResponse(ImageStoreJoinVO
}

public static List<StoragePoolResponse> createStoragePoolForMigrationResponse(StoragePoolJoinVO... pools) {
Hashtable<Long, StoragePoolResponse> vrDataList = new Hashtable<Long, StoragePoolResponse>();
LinkedHashMap<Long, StoragePoolResponse> vrDataList = new LinkedHashMap<>();
// Initialise the vrdatalist with the input data
for (StoragePoolJoinVO vr : pools) {
StoragePoolResponse vrData = vrDataList.get(vr.getId());
Expand Down Expand Up @@ -577,7 +576,7 @@ public static List<ZoneResponse> createDataCenterResponse(ResponseView view, Boo
}

public static List<TemplateResponse> createTemplateResponse(EnumSet<ApiConstants.DomainDetails> detailsView, ResponseView view, TemplateJoinVO... templates) {
LinkedHashMap<String, TemplateResponse> vrDataList = new LinkedHashMap<String, TemplateResponse>();
LinkedHashMap<String, TemplateResponse> vrDataList = new LinkedHashMap<>();
for (TemplateJoinVO vr : templates) {
TemplateResponse vrData = vrDataList.get(vr.getTempZonePair());
if (vrData == null) {
Expand All @@ -594,7 +593,7 @@ public static List<TemplateResponse> createTemplateResponse(EnumSet<ApiConstants
}

public static List<TemplateResponse> createTemplateUpdateResponse(ResponseView view, TemplateJoinVO... templates) {
Hashtable<Long, TemplateResponse> vrDataList = new Hashtable<Long, TemplateResponse>();
LinkedHashMap<Long, TemplateResponse> vrDataList = new LinkedHashMap<>();
for (TemplateJoinVO vr : templates) {
TemplateResponse vrData = vrDataList.get(vr.getId());
if (vrData == null) {
Expand All @@ -610,7 +609,7 @@ public static List<TemplateResponse> createTemplateUpdateResponse(ResponseView v
}

public static List<TemplateResponse> createIsoResponse(ResponseView view, TemplateJoinVO... templates) {
Hashtable<String, TemplateResponse> vrDataList = new Hashtable<String, TemplateResponse>();
LinkedHashMap<String, TemplateResponse> vrDataList = new LinkedHashMap<>();
for (TemplateJoinVO vr : templates) {
TemplateResponse vrData = vrDataList.get(vr.getTempZonePair());
if (vrData == null) {
Expand All @@ -626,7 +625,7 @@ public static List<TemplateResponse> createIsoResponse(ResponseView view, Templa
}

public static List<AffinityGroupResponse> createAffinityGroupResponses(List<AffinityGroupJoinVO> groups) {
Hashtable<Long, AffinityGroupResponse> vrDataList = new Hashtable<Long, AffinityGroupResponse>();
LinkedHashMap<Long, AffinityGroupResponse> vrDataList = new LinkedHashMap<>();
for (AffinityGroupJoinVO vr : groups) {
AffinityGroupResponse vrData = vrDataList.get(vr.getId());
if (vrData == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public void run() {
updateFrontEndActivityTime();
}
connectionAlive = client.isVncOverWebSocketConnectionAlive();
try {
Thread.sleep(1);
} catch (Exception e) {
s_logger.warn("Error on sleep for vnc over websocket", e);
}
} else if (client.isVncOverNioSocket()) {
byte[] bytesArr;
int nextBytes = client.getNextBytes();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/smoke/test_vm_life_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ def setUp(self):
self.skipTest("Requires at least two hosts for performing migration related tests")

for host in self.hosts:
if host.details['Host.OS'] in ['CentOS']:
if host.details['Host.OS'] and host.details['Host.OS'].startswith('CentOS'):
self.skipTest("live migration is not stabily supported on CentOS")

def tearDown(self):
Expand Down
2 changes: 1 addition & 1 deletion ui/src/config/section/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default {
}
return fields
},
details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy'],
details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy', 'url'],
searchFilters: ['name', 'zoneid', 'tags'],
related: [{
name: 'vm',
Expand Down

0 comments on commit bb79878

Please sign in to comment.