Merge branch 'apache:main' into Backroll

This commit is contained in:
PeterBackroll 2024-08-29 15:06:46 +02:00 committed by GitHub
commit f792fb515b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
305 changed files with 7484 additions and 2694 deletions

View File

@ -43,7 +43,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'
architecture: 'x64'
- name: Install Build Dependencies

View File

@ -35,6 +35,7 @@ jobs:
fail-fast: false
matrix:
tests: [ "smoke/test_accounts
smoke/test_account_access
smoke/test_affinity_groups
smoke/test_affinity_groups_projects
smoke/test_annotations
@ -225,7 +226,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'
architecture: 'x64'
- name: Install Build Dependencies
@ -283,7 +284,7 @@ jobs:
- name: Start CloudStack Management Server with Simulator
run: |
export MAVEN_OPTS="-Xmx4096m -XX:MaxPermSize=800m -Djava.security.egd=file:/dev/urandom -javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver"
export MAVEN_OPTS="-Xmx4096m -XX:MaxMetaspaceSize=800m -Djava.security.egd=file:/dev/urandom -javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED"
echo -e "\nStarting simulator"
set +e
mvn -Dsimulator -Dorg.eclipse.jetty.annotations.maxWait=120 -pl :cloud-client-ui jetty:run 2>&1 > /tmp/jetty-log || true &

View File

@ -36,11 +36,11 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
cache: 'maven'
- name: Build CloudStack with Quality Checks

View File

@ -36,11 +36,11 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK11
- name: Set up JDK17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
cache: 'maven'
- name: Cache SonarCloud packages

View File

@ -31,10 +31,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
architecture: x64
cache: maven

View File

@ -38,11 +38,11 @@ jobs:
ref: "refs/pull/${{ github.event.number }}/merge"
fetch-depth: 0
- name: Set up JDK11
- name: Set up JDK17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
cache: 'maven'
- name: Cache SonarCloud packages

View File

@ -36,7 +36,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
- name: Env details
run: |

View File

@ -78,7 +78,7 @@ Clear old database (if any) and deploy the database schema:
Export the following variable if you need to run and debug the management server:
$ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
$ export MAVEN_OPTS="-Xmx1024m -XX:MaxMetaspaceSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
Start the management server:

View File

@ -84,6 +84,8 @@ public class VirtualMachineTO {
Map<String, String> extraConfig = new HashMap<>();
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
DeployAsIsInfoTO deployAsIsInfo;
String metadataManufacturer;
String metadataProductName;
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
@ -429,6 +431,22 @@ public class VirtualMachineTO {
this.deployAsIsInfo = deployAsIsInfo;
}
public String getMetadataManufacturer() {
return metadataManufacturer;
}
public void setMetadataManufacturer(String metadataManufacturer) {
this.metadataManufacturer = metadataManufacturer;
}
public String getMetadataProductName() {
return metadataProductName;
}
public void setMetadataProductName(String metadataProductName) {
this.metadataProductName = metadataProductName;
}
@Override
public String toString() {
return String.format("VM {id: \"%s\", name: \"%s\", uuid: \"%s\", type: \"%s\"}", id, name, uuid, type);

View File

@ -242,6 +242,8 @@ public class EventTypes {
public static final String EVENT_ROLE_UPDATE = "ROLE.UPDATE";
public static final String EVENT_ROLE_DELETE = "ROLE.DELETE";
public static final String EVENT_ROLE_IMPORT = "ROLE.IMPORT";
public static final String EVENT_ROLE_ENABLE = "ROLE.ENABLE";
public static final String EVENT_ROLE_DISABLE = "ROLE.DISABLE";
public static final String EVENT_ROLE_PERMISSION_CREATE = "ROLE.PERMISSION.CREATE";
public static final String EVENT_ROLE_PERMISSION_UPDATE = "ROLE.PERMISSION.UPDATE";
public static final String EVENT_ROLE_PERMISSION_DELETE = "ROLE.PERMISSION.DELETE";
@ -333,6 +335,7 @@ public class EventTypes {
public static final String EVENT_SNAPSHOT_OFF_PRIMARY = "SNAPSHOT.OFF_PRIMARY";
public static final String EVENT_SNAPSHOT_DELETE = "SNAPSHOT.DELETE";
public static final String EVENT_SNAPSHOT_REVERT = "SNAPSHOT.REVERT";
public static final String EVENT_SNAPSHOT_EXTRACT = "SNAPSHOT.EXTRACT";
public static final String EVENT_SNAPSHOT_POLICY_CREATE = "SNAPSHOTPOLICY.CREATE";
public static final String EVENT_SNAPSHOT_POLICY_UPDATE = "SNAPSHOTPOLICY.UPDATE";
public static final String EVENT_SNAPSHOT_POLICY_DELETE = "SNAPSHOTPOLICY.DELETE";
@ -841,6 +844,8 @@ public class EventTypes {
entityEventDetails.put(EVENT_ROLE_UPDATE, Role.class);
entityEventDetails.put(EVENT_ROLE_DELETE, Role.class);
entityEventDetails.put(EVENT_ROLE_IMPORT, Role.class);
entityEventDetails.put(EVENT_ROLE_ENABLE, Role.class);
entityEventDetails.put(EVENT_ROLE_DISABLE, Role.class);
entityEventDetails.put(EVENT_ROLE_PERMISSION_CREATE, RolePermission.class);
entityEventDetails.put(EVENT_ROLE_PERMISSION_UPDATE, RolePermission.class);
entityEventDetails.put(EVENT_ROLE_PERMISSION_DELETE, RolePermission.class);
@ -897,6 +902,7 @@ public class EventTypes {
// Snapshots
entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class);
entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class);
entityEventDetails.put(EVENT_SNAPSHOT_EXTRACT, Snapshot.class);
entityEventDetails.put(EVENT_SNAPSHOT_ON_PRIMARY, Snapshot.class);
entityEventDetails.put(EVENT_SNAPSHOT_OFF_PRIMARY, Snapshot.class);
entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, SnapshotPolicy.class);

View File

@ -40,7 +40,7 @@ public interface Upload extends InternalIdentity, Identity {
}
public static enum Type {
VOLUME, TEMPLATE, ISO
VOLUME, SNAPSHOT, TEMPLATE, ISO
}
public static enum Mode {

View File

@ -21,6 +21,7 @@ import java.util.List;
import org.apache.cloudstack.api.command.user.snapshot.CopySnapshotCmd;
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
import org.apache.cloudstack.api.command.user.snapshot.ExtractSnapshotCmd;
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
import org.apache.cloudstack.api.command.user.snapshot.UpdateSnapshotPolicyCmd;
@ -106,6 +107,16 @@ public interface SnapshotApiService {
*/
Snapshot createSnapshot(Long volumeId, Long policyId, Long snapshotId, Account snapshotOwner);
/**
* Extracts the snapshot to a particular location.
*
* @param cmd
* the command specifying url (where the snapshot needs to be extracted to), zoneId (zone where the snapshot exists) and
* id (the id of the snapshot)
*
*/
String extractSnapshot(ExtractSnapshotCmd cmd);
/**
* Archives a snapshot from primary storage to secondary storage.
* @param id Snapshot ID

View File

@ -21,7 +21,18 @@ import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface Role extends RoleEntity, InternalIdentity, Identity {
enum State {
ENABLED, DISABLED;
@Override
public String toString(){
return super.toString().toLowerCase();
}
}
RoleType getRoleType();
boolean isDefault();
boolean isPublicRole();
State getState();
}

View File

@ -54,6 +54,10 @@ public interface RoleService {
boolean deleteRole(Role role);
boolean enableRole(Role role);
boolean disableRole(Role role);
RolePermission findRolePermission(Long id);
RolePermission findRolePermissionByRoleIdAndRule(Long roleId, String rule);
@ -76,7 +80,7 @@ public interface RoleService {
*/
List<Role> listRoles();
Pair<List<Role>, Integer> listRoles(Long startIndex, Long limit);
Pair<List<Role>, Integer> listRoles(String state, Long startIndex, Long limit);
/**
* Find all roles that have the giving {@link String} as part of their name.
@ -84,14 +88,14 @@ public interface RoleService {
*/
List<Role> findRolesByName(String name);
Pair<List<Role>, Integer> findRolesByName(String name, String keyword, Long startIndex, Long limit);
Pair<List<Role>, Integer> findRolesByName(String name, String keyword, String state, Long startIndex, Long limit);
/**
* Find all roles by {@link RoleType}. If the role type is {@link RoleType#Admin}, the calling account must be a root admin, otherwise we return an empty list.
*/
List<Role> findRolesByType(RoleType roleType);
Pair<List<Role>, Integer> findRolesByType(RoleType roleType, Long startIndex, Long limit);
Pair<List<Role>, Integer> findRolesByType(RoleType roleType, String state, Long startIndex, Long limit);
List<RolePermission> findAllPermissionsBy(Long roleId);

View File

@ -56,6 +56,10 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
@Param(description = "the domain name of the affinity group")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the affinity group belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project ID of the affinity group")
private String projectId;
@ -115,6 +119,11 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public int hashCode() {
final int prime = 31;

View File

@ -32,4 +32,9 @@ public enum ApiArgValidator {
* Validates if the parameter is an UUID with the method {@link UuidUtils#isUuid(String)}.
*/
UuidString,
/**
* Validates if the parameter is a valid RFC Compliance domain name.
*/
RFCComplianceDomainName,
}

View File

@ -696,6 +696,7 @@ public class ApiConstants {
public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
public static final String KEYWORD = "keyword";
public static final String LIST_ALL = "listall";
public static final String LIST_ONLY_REMOVED = "listonlyremoved";
public static final String LIST_SYSTEM_VMS = "listsystemvms";
public static final String IP_RANGES = "ipranges";
public static final String IPV6_ROUTING = "ip6routing";
@ -1141,6 +1142,11 @@ public class ApiConstants {
public static final String NFS_MOUNT_OPTIONS = "nfsmountopts";
public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " +
"a boolean or a numeric value: if it results in a boolean value, the tariff value will be applied according to the result; if it results in a numeric value, the " +
"numeric value will be applied; if the result is neither a boolean nor a numeric value, the tariff will not be applied. If the rule is not informed, the tariff " +
"value will be applied.";
/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).

View File

@ -345,9 +345,11 @@ public interface ResponseGenerator {
SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group);
ExtractResponse createExtractResponse(Long uploadId, Long id, Long zoneId, Long accountId, String mode, String url);
ExtractResponse createImageExtractResponse(Long id, Long zoneId, Long accountId, String mode, String url);
ExtractResponse createExtractResponse(Long id, Long zoneId, Long accountId, String mode, String url);
ExtractResponse createVolumeExtractResponse(Long id, Long zoneId, Long accountId, String mode, String url);
ExtractResponse createSnapshotExtractResponse(Long id, Long zoneId, Long accountId, String url);
String toSerializedString(CreateCmdResponse response, String responseType);

View File

@ -89,12 +89,11 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails("Account ID: " + (account != null ? account.getUuid() : getId())); // Account not found is already handled by service
boolean result = _regionService.deleteUserAccount(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
if (!result) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
}
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
}
@Override

View File

@ -0,0 +1,69 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.acl;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import org.apache.cloudstack.acl.Role;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.RoleResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "disableRole", description = "Disables a role", responseObject = SuccessResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.20.0",
authorized = {RoleType.Admin})
public class DisableRoleCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
private Long roleId;
public Long getRoleId() {
return roleId;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
Role role = roleService.findRole(getRoleId());
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
}
CallContext.current().setEventDetails("Role id: " + role.getId());
boolean result = roleService.disableRole(role);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
setResponseObject(response);
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
}

View File

@ -0,0 +1,69 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.acl;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import org.apache.cloudstack.acl.Role;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.RoleResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "enableRole", description = "Enables a role", responseObject = SuccessResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.20.0",
authorized = {RoleType.Admin})
public class EnableRoleCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
private Long roleId;
public Long getRoleId() {
return roleId;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
Role role = roleService.findRole(getRoleId());
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
}
CallContext.current().setEventDetails("Role id: " + role.getId());
boolean result = roleService.enableRole(role);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
setResponseObject(response);
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
}

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.cloud.exception.InvalidParameterValueException;
import org.apache.cloudstack.acl.Role;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
@ -51,6 +52,9 @@ public class ListRolesCmd extends BaseListCmd {
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "List role by role type, valid options are: Admin, ResourceAdmin, DomainAdmin, User.")
private String roleType;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List role by role type status, valid options are: enabled, disabled")
private String roleState;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -70,6 +74,17 @@ public class ListRolesCmd extends BaseListCmd {
return null;
}
public Role.State getRoleState() {
if (roleState == null) {
return null;
}
try {
return Role.State.valueOf(roleState.toUpperCase());
} catch (IllegalArgumentException e) {
throw new InvalidParameterValueException("Unrecognized role state value");
}
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -93,6 +108,7 @@ public class ListRolesCmd extends BaseListCmd {
roleResponse.setDescription(role.getDescription());
roleResponse.setIsDefault(role.isDefault());
roleResponse.setPublicRole(role.isPublicRole());
roleResponse.setState(role.getState().toString());
roleResponse.setObjectName("role");
roleResponses.add(roleResponse);
}
@ -104,14 +120,16 @@ public class ListRolesCmd extends BaseListCmd {
@Override
public void execute() {
Pair<List<Role>, Integer> roles;
Role.State state = getRoleState();
String roleStateStr = state != null ? state.toString() : null;
if (getId() != null && getId() > 0L) {
roles = new Pair<>(Collections.singletonList(roleService.findRole(getId(), true)), 1);
} else if (StringUtils.isNotBlank(getName()) || StringUtils.isNotBlank(getKeyword())) {
roles = roleService.findRolesByName(getName(), getKeyword(), getStartIndex(), getPageSizeVal());
roles = roleService.findRolesByName(getName(), getKeyword(), roleStateStr, getStartIndex(), getPageSizeVal());
} else if (getRoleType() != null) {
roles = roleService.findRolesByType(getRoleType(), getStartIndex(), getPageSizeVal());
roles = roleService.findRolesByType(getRoleType(), roleStateStr, getStartIndex(), getPageSizeVal());
} else {
roles = roleService.listRoles(getStartIndex(), getPageSizeVal());
roles = roleService.listRoles(roleStateStr, getStartIndex(), getPageSizeVal());
}
setupResponse(roles);
}

View File

@ -59,6 +59,7 @@ public abstract class RoleCmd extends BaseCmd {
response.setRoleType(role.getRoleType());
response.setDescription(role.getDescription());
response.setPublicRole(role.isPublicRole());
response.setState(role.getState().toString());
response.setResponseName(getCommandName());
response.setObjectName("role");
setResponseObject(response);

View File

@ -27,7 +27,7 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
@APICommand(name = "removeSecondaryStorageSelector", description = "Removes an existing secondary storage selector.", since = "4.19.0", responseObject =
SecondaryStorageHeuristicsResponse.class, requestHasSensitiveInfo = false, entityType = {Heuristic.class}, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
SuccessResponse.class, requestHasSensitiveInfo = false, entityType = {Heuristic.class}, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
public class RemoveSecondaryStorageSelectorCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = SecondaryStorageHeuristicsResponse.class, required = true,
description = "The unique identifier of the secondary storage selector to be removed.")

View File

@ -23,6 +23,7 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UsageTypeResponse;
import org.apache.cloudstack.usage.UsageTypes;
import com.cloud.user.Account;
@ -37,8 +38,8 @@ public class ListUsageTypesCmd extends BaseCmd {
@Override
public void execute() {
List<UsageTypeResponse> result = _usageService.listUsageTypes();
ListResponse<UsageTypeResponse> response = new ListResponse<UsageTypeResponse>();
List<UsageTypeResponse> result = UsageTypes.listUsageTypes();
ListResponse<UsageTypeResponse> response = new ListResponse<>();
response.setResponses(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -103,7 +103,7 @@ public class AddUserToProjectCmd extends BaseAsyncCmd {
@Override
public String getEventDescription() {
return "Adding user "+getUsername()+" to Project "+getProjectId();
return "Adding user " + getUsername() + " to project: " + getProjectId();
}
/////////////////////////////////////////////////////

View File

@ -81,7 +81,6 @@ public class DeleteUserFromProjectCmd extends BaseAsyncCmd {
return "Removing user " + userId + " from project: " + projectId;
}
@Override
public long getEntityOwnerId() {
Project project = _projectService.getProject(projectId);

View File

@ -120,7 +120,7 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails(getEventDescription());
String uploadUrl = _templateService.extract(this);
if (uploadUrl != null) {
ExtractResponse response = _responseGenerator.createExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
ExtractResponse response = _responseGenerator.createImageExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
response.setResponseName(getCommandName());
response.setObjectName("iso");
this.setResponseObject(response);

View File

@ -0,0 +1,115 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.user.snapshot;
import com.cloud.event.EventTypes;
import com.cloud.storage.Snapshot;
import com.cloud.user.Account;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
@APICommand(name = "extractSnapshot", description = "Returns a download URL for extracting a snapshot. It must be in the Backed Up state.", since = "4.20.0",
responseObject = ExtractResponse.class, entityType = {Snapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ExtractSnapshotCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@ACL(accessType = AccessType.OperateEntry)
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=SnapshotResponse.class, required=true, since="4.20.0", description="the ID of the snapshot")
private Long id;
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, since="4.20.0",
description = "the ID of the zone where the snapshot is located")
private Long zoneId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
public Long getZoneId() {
return zoneId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Snapshot;
}
@Override
public Long getApiResourceId() {
return getId();
}
/**
* @return ID of the snapshot to extract, if any. Otherwise returns the ACCOUNT_ID_SYSTEM, so ERROR events will be traceable.
*/
@Override
public long getEntityOwnerId() {
Snapshot snapshot = _entityMgr.findById(Snapshot.class, getId());
if (snapshot != null) {
return snapshot.getAccountId();
}
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_SNAPSHOT_EXTRACT;
}
@Override
public String getEventDescription() {
return "Snapshot extraction job";
}
@Override
public void execute() {
CallContext.current().setEventDetails("Snapshot ID: " + this._uuidMgr.getUuid(Snapshot.class, getId()));
String uploadUrl = _snapshotService.extractSnapshot(this);
logger.info("Extract URL [{}] of snapshot [{}].", uploadUrl, id);
if (uploadUrl != null) {
ExtractResponse response = _responseGenerator.createSnapshotExtractResponse(id, zoneId, getEntityOwnerId(), uploadUrl);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract snapshot");
}
}
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.template;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
@ -53,6 +54,9 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a template.", since = "4.9+")
private Boolean forced;
@Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, required = false, description = "Necessary if the template's type is system.", since = "4.20.0", authorized = {RoleType.Admin})
private Boolean isSystem;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -69,6 +73,10 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
return BooleanUtils.toBooleanDefaultIfNull(forced, false);
}
public boolean getIsSystem() {
return BooleanUtils.toBooleanDefaultIfNull(isSystem, false);
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -120,8 +120,9 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails(getEventDescription());
String uploadUrl = _templateService.extract(this);
if (uploadUrl != null) {
ExtractResponse response = _responseGenerator.createExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
ExtractResponse response = _responseGenerator.createImageExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
response.setResponseName(getCommandName());
response.setObjectName("template");
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template");

View File

@ -31,6 +31,7 @@ import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy;
@ -97,7 +98,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template for the virtual machine")
private Long templateId;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine")
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine", validations = {ApiArgValidator.RFCComplianceDomainName})
private String name;
@Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "an optional user generated name for the virtual machine")

View File

@ -16,9 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import java.security.InvalidParameterException;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
@ -28,6 +25,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.GetVMPasswordResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
import com.cloud.vm.VirtualMachine;
@ -61,7 +59,7 @@ public class GetVMPasswordCmd extends BaseCmd {
public void execute() {
String passwd = _mgr.getVMPassword(this);
if (passwd == null || passwd.equals(""))
throw new InvalidParameterException("No password for VM with id '" + getId() + "' found.");
throw new InvalidParameterValueException("No password for VM with id '" + getId() + "' found.");
setResponseObject(new GetVMPasswordResponse(getCommandName(), passwd));
}

View File

@ -22,6 +22,8 @@ import java.util.List;
import java.util.Map;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.response.UserDataResponse;
import org.apache.cloudstack.acl.RoleType;
@ -104,7 +106,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
description = "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory. This can be updated only when dynamic scaling is enabled on template, service offering and the corresponding global setting")
protected Boolean isDynamicallyScalable;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new host name of the vm. The VM has to be stopped/started for this update to take affect", since = "4.4")
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new host name of the vm. The VM has to be stopped/started for this update to take affect", validations = {ApiArgValidator.RFCComplianceDomainName}, since = "4.4")
private String name;
@Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "instance name of the user vm", since = "4.4", authorized = {RoleType.Admin})
@ -141,7 +143,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
+ " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com")
private Map dhcpOptionsNetworkList;
@Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", authorized = { RoleType.Admin }, length = 5120)
@Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120)
private String extraConfig;
/////////////////////////////////////////////////////

View File

@ -31,9 +31,7 @@ import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
import com.cloud.dc.DataCenter;
import com.cloud.event.EventTypes;
import com.cloud.storage.Upload;
import com.cloud.storage.Volume;
import com.cloud.user.Account;
@ -124,20 +122,8 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
String uploadUrl = _volumeService.extractVolume(this);
if (uploadUrl != null) {
ExtractResponse response = new ExtractResponse();
ExtractResponse response = _responseGenerator.createVolumeExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);
response.setResponseName(getCommandName());
response.setObjectName("volume");
Volume vol = _entityMgr.findById(Volume.class, id);
response.setId(vol.getUuid());
response.setName(vol.getName());
DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
response.setZoneId(zone.getUuid());
response.setZoneName(zone.getName());
response.setMode(mode);
response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
Account account = _entityMgr.findById(Account.class, getEntityOwnerId());
response.setAccountId(account.getUuid());
response.setUrl(uploadUrl);
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume");

View File

@ -131,6 +131,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
if (domain != null) {
vpnResponse.setDomainId(domain.getUuid());
vpnResponse.setDomainName(domain.getName());
vpnResponse.setDomainPath(domain.getPath());
}
vpnResponse.setResponseName(getCommandName());

View File

@ -75,6 +75,10 @@ public class AcquireIPAddressResponse extends BaseResponse implements Controlle
@Param(description = "the domain the public IP address is associated with")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the public IP address belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK)
@Param(description = "the virtual network for the IP address")
private Boolean forVirtualNetwork;
@ -190,6 +194,11 @@ public class AcquireIPAddressResponse extends BaseResponse implements Controlle
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
this.forVirtualNetwork = forVirtualNetwork;
}

View File

@ -44,7 +44,7 @@ public class AcquirePodIpCmdResponse extends BaseResponse {
@SerializedName(ApiConstants.NIC_ID)
@Param(description = "the ID of the nic")
private Long instanceId;
private Long nicId;
@SerializedName(ApiConstants.HOST_MAC)
@Param(description = "MAC address of the pod the IP")
@ -58,8 +58,8 @@ public class AcquirePodIpCmdResponse extends BaseResponse {
this.ipAddress = ipAddress;
}
public void setInstanceId(Long instanceId) {
this.instanceId = instanceId;
public void setNicId(Long nicId) {
this.nicId = nicId;
}
public void setPodId(long podId) {
@ -82,8 +82,8 @@ public class AcquirePodIpCmdResponse extends BaseResponse {
return id;
}
public Long getInstanceId() {
return instanceId;
public Long getNicId() {
return nicId;
}
public long getPodId() {

View File

@ -76,6 +76,10 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con
@Param(description = "the domain of the Load Balancer")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the Load Balancer belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName("loadbalancerrule")
@Param(description = "the list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class)
private List<ApplicationLoadBalancerRuleResponse> lbRules;
@ -107,6 +111,11 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -74,6 +74,10 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
@Param(description = "the domain name of the autoscale policy")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the autoscale policy belongs", since = "4.19.2.0")
private String domainPath;
@Override
public String getObjectId() {
return this.id;
@ -118,6 +122,11 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -123,6 +123,10 @@ public class AutoScaleVmGroupResponse extends BaseResponseWithAnnotations implem
@Param(description = "the domain name of the vm group")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the vm group belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is group for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
@ -227,6 +231,11 @@ public class AutoScaleVmGroupResponse extends BaseResponseWithAnnotations implem
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -114,6 +114,10 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
@Param(description = "the domain name of the vm profile")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the vm profile belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is profile for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
@ -196,6 +200,10 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -54,6 +54,10 @@ public class BucketResponse extends BaseResponseWithTagInformation implements Co
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain associated with the bucket")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the bucket belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.OBJECT_STORAGE_ID)
@Param(description = "id of the object storage hosting the Bucket; returned to admin user only")
private String objectStoragePoolId;
@ -146,6 +150,11 @@ public class BucketResponse extends BaseResponseWithTagInformation implements Co
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -73,7 +73,7 @@ public class ClusterResponse extends BaseResponseWithAnnotations {
@SerializedName("capacity")
@Param(description = "the capacity of the Cluster", responseObject = CapacityResponse.class)
private List<CapacityResponse> capacitites;
private List<CapacityResponse> capacities;
@SerializedName("cpuovercommitratio")
@Param(description = "The cpu overcommit ratio of the cluster")
@ -171,12 +171,12 @@ public class ClusterResponse extends BaseResponseWithAnnotations {
this.managedState = managedState;
}
public List<CapacityResponse> getCapacitites() {
return capacitites;
public List<CapacityResponse> getCapacities() {
return capacities;
}
public void setCapacitites(ArrayList<CapacityResponse> arrayList) {
this.capacitites = arrayList;
public void setCapacities(ArrayList<CapacityResponse> arrayList) {
this.capacities = arrayList;
}
public void setCpuOvercommitRatio(String cpuovercommitratio) {
@ -219,4 +219,32 @@ public class ClusterResponse extends BaseResponseWithAnnotations {
public Map<String, String> getResourceDetails() {
return resourceDetails;
}
public String getCpuovercommitratio() {
return cpuovercommitratio;
}
public void setCpuovercommitratio(String cpuovercommitratio) {
this.cpuovercommitratio = cpuovercommitratio;
}
public String getMemoryovercommitratio() {
return memoryovercommitratio;
}
public void setMemoryovercommitratio(String memoryovercommitratio) {
this.memoryovercommitratio = memoryovercommitratio;
}
public String getOvm3vip() {
return ovm3vip;
}
public void setOvm3vip(String ovm3vip) {
this.ovm3vip = ovm3vip;
}
public void setCapacities(List<CapacityResponse> capacities) {
this.capacities = capacities;
}
}

View File

@ -61,6 +61,10 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
@Param(description = "the domain name of the owner.")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the Condition owner belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "zone id of counter")
private String zoneId;
@ -138,4 +142,9 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
public void setDomainName(String domainName) {
this.domain = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
}

View File

@ -27,4 +27,6 @@ public interface ControlledEntityResponse {
public void setDomainId(String domainId);
public void setDomainName(String domainName);
public void setDomainPath(String domainPath);
}

View File

@ -27,4 +27,6 @@ public interface ControlledViewEntityResponse {
public void setDomainId(String domainId);
public void setDomainName(String domainName);
public void setDomainPath(String domainPath);
}

View File

@ -185,6 +185,10 @@ public class DomainRouterResponse extends BaseResponseWithAnnotations implements
@Param(description = "the domain associated with the router")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the router belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.SERVICE_OFFERING_ID)
@Param(description = "the ID of the service offering of the virtual machine")
private String serviceOfferingId;
@ -381,6 +385,10 @@ public class DomainRouterResponse extends BaseResponseWithAnnotations implements
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setPublicNetworkId(String publicNetworkId) {
this.publicNetworkId = publicNetworkId;
}

View File

@ -69,6 +69,10 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
@Param(description = "the name of the account's domain")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the account's domain belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.RESOURCE_ID)
@Param(description = "the id of the resource", since = "4.17.0")
private String resourceId;
@ -132,6 +136,11 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}

View File

@ -82,6 +82,10 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements Controll
@Param(description = "the domain of the load balancer rule")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the load balancer rule belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.LOAD_BALANCER_RULE)
@Param(description = "List of load balancer rules that are part of GSLB rule", responseObject = LoadBalancerResponse.class)
private List<LoadBalancerResponse> siteLoadBalancers;
@ -143,6 +147,11 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements Controll
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setSiteLoadBalancers(List<LoadBalancerResponse> siteLoadBalancers) {
this.siteLoadBalancers = siteLoadBalancers;
}

View File

@ -44,6 +44,10 @@ public class GuestVlanRangeResponse extends BaseResponse implements ControlledEn
@Param(description = "the domain name of the guest VLAN range")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the guest VLAN range belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.GUEST_VLAN_RANGE)
@Param(description = "the guest VLAN range")
private String guestVlanRange;
@ -83,6 +87,10 @@ public class GuestVlanRangeResponse extends BaseResponse implements ControlledEn
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setGuestVlanRange(String guestVlanRange) {
this.guestVlanRange = guestVlanRange;
}

View File

@ -49,6 +49,10 @@ public class GuestVlanResponse extends BaseResponse implements ControlledEntityR
@Param(description = "the domain name of the guest VLAN range")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the guest VLAN range belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the guest VLAN range")
private String projectId;
@ -108,6 +112,10 @@ public class GuestVlanResponse extends BaseResponse implements ControlledEntityR
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -280,7 +280,7 @@ public class HostResponse extends BaseResponseWithAnnotations {
@SerializedName("ueficapability")
@Param(description = "true if the host has capability to support UEFI boot")
private Boolean uefiCapabilty;
private Boolean uefiCapability;
@SerializedName(ApiConstants.ENCRYPTION_SUPPORTED)
@Param(description = "true if the host supports encryption", since = "4.18")
@ -735,7 +735,7 @@ public class HostResponse extends BaseResponseWithAnnotations {
return clusterType;
}
public Boolean isLocalStorageActive() {
public Boolean getLocalStorageActive() {
return localStorageActive;
}
@ -755,7 +755,7 @@ public class HostResponse extends BaseResponseWithAnnotations {
return hasEnoughCapacity;
}
public Boolean isSuitableForMigration() {
public Boolean getSuitableForMigration() {
return suitableForMigration;
}
@ -767,8 +767,8 @@ public class HostResponse extends BaseResponseWithAnnotations {
return haHost;
}
public void setUefiCapabilty(Boolean hostCapability) {
this.uefiCapabilty = hostCapability;
public void setUefiCapability(Boolean hostCapability) {
this.uefiCapability = hostCapability;
}
public void setEncryptionSupported(Boolean encryptionSupported) {
@ -786,4 +786,76 @@ public class HostResponse extends BaseResponseWithAnnotations {
public void setIsTagARule(Boolean tagARule) {
isTagARule = tagARule;
}
public Long getCpuAllocatedValue() {
return cpuAllocatedValue;
}
public String getCpuAllocatedPercentage() {
return cpuAllocatedPercentage;
}
public String getCpuAllocatedWithOverprovisioning() {
return cpuAllocatedWithOverprovisioning;
}
public Double getCpuloadaverage() {
return cpuloadaverage;
}
public void setCpuloadaverage(Double cpuloadaverage) {
this.cpuloadaverage = cpuloadaverage;
}
public String getMemWithOverprovisioning() {
return memWithOverprovisioning;
}
public String getMemoryAllocatedPercentage() {
return memoryAllocatedPercentage;
}
public Long getMemoryAllocatedBytes() {
return memoryAllocatedBytes;
}
public Boolean getTagARule() {
return isTagARule;
}
public void setTagARule(Boolean tagARule) {
isTagARule = tagARule;
}
public Boolean getHasEnoughCapacity() {
return hasEnoughCapacity;
}
public void setDetails(Map details) {
this.details = details;
}
public String getAnnotation() {
return annotation;
}
public Date getLastAnnotated() {
return lastAnnotated;
}
public String getUsername() {
return username;
}
public Boolean getUefiCapability() {
return uefiCapability;
}
public Boolean getEncryptionSupported() {
return encryptionSupported;
}
public Boolean getInstanceConversionSupported() {
return instanceConversionSupported;
}
}

View File

@ -75,6 +75,10 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
@Param(description = "the domain the public IP address is associated with")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the public IP address belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK)
@Param(description = "the virtual network for the IP address")
private Boolean forVirtualNetwork;
@ -211,6 +215,10 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
this.forVirtualNetwork = forVirtualNetwork;
}

View File

@ -63,6 +63,10 @@ public class InstanceGroupResponse extends BaseResponseWithAnnotations implement
@Param(description = "the domain name of the instance group")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the instance group belongs to", since = "4.19.2.0")
private String domainPath;
public void setId(String id) {
this.id = id;
}
@ -90,6 +94,11 @@ public class InstanceGroupResponse extends BaseResponseWithAnnotations implement
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -87,6 +87,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "the domain of the load balancer rule")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the load balancer rule belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.STATE)
@Param(description = "the state of the rule")
private String state;
@ -158,6 +162,11 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setState(String state) {
this.state = state;
}

View File

@ -167,4 +167,8 @@ public class ManagementServerResponse extends BaseResponse {
public void setServiceIp(String serviceIp) {
this.serviceIp = serviceIp;
}
public String getKernelVersion() {
return kernelVersion;
}
}

View File

@ -424,6 +424,7 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
this.domain = domain;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}

View File

@ -54,6 +54,10 @@ public class OvsProviderResponse extends BaseResponse implements
@Param(description = "the domain associated with the provider")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the provider belongs", since = "4.19.2.0")
private String domainPath;
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
@ -73,6 +77,10 @@ public class OvsProviderResponse extends BaseResponse implements
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -89,6 +89,10 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im
@Param(description = "the domain associated with the private gateway")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the private gateway belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.STATE)
@Param(description = "State of the gateway, can be Creating, Ready, Deleting")
private String state;
@ -165,6 +169,10 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -73,6 +73,10 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledVi
@Param(description = "name of the Domain the account belongs too")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the account belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.USER)
@Param(description = "the list of users associated with account", responseObject = UserResponse.class)
private List<UserResponse> users;
@ -110,6 +114,11 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledVi
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setUserId(String userId) { this.userId = userId; }
public void setProjectRoleId(String projectRoleId) {

View File

@ -51,6 +51,10 @@ public class ProjectInvitationResponse extends BaseResponse implements Controlle
@Param(description = "the domain name where the project belongs to")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the project belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account name of the project's owner")
private String accountName;
@ -87,6 +91,11 @@ public class ProjectInvitationResponse extends BaseResponse implements Controlle
this.domainName = domain;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;

View File

@ -65,6 +65,10 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
@Param(description = "the domain name of the account of the remote access vpn")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the remote access vpn belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.STATE)
@Param(description = "the state of the rule")
private String state;
@ -104,6 +108,10 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
this.domainName = name;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setState(String state) {
this.state = state;
}

View File

@ -45,6 +45,10 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
@Param(description = "the domain name for which resource count's are updated")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the resource counts are updated", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.RESOURCE_TYPE)
@Param(description = "resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.")
private String resourceType;
@ -76,6 +80,11 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setResourceType(Resource.ResourceType resourceType) {
this.resourceType = Integer.valueOf(resourceType.getOrdinal()).toString();
this.resourceTypeName = resourceType.getName();

View File

@ -40,6 +40,10 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
@Param(description = "the domain name of the resource limit")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the resource limit belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.RESOURCE_TYPE)
@Param(description = "resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.")
private String resourceType;
@ -84,6 +88,10 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setResourceType(Resource.ResourceType resourceType) {
this.resourceType = Integer.valueOf(resourceType.getOrdinal()).toString();
this.resourceTypeName = resourceType.getName();

View File

@ -61,6 +61,10 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE
@Param(description = "the domain associated with the tag")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain associated with the tag", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.CUSTOMER)
@Param(description = "customer associated with the tag")
private String customer;
@ -96,6 +100,11 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -36,6 +36,10 @@ public class RoleResponse extends BaseRoleResponse {
@Param(description = "true if role is default, false otherwise")
private Boolean isDefault;
@SerializedName(ApiConstants.STATE)
@Param(description = "the state of the role")
private String state;
public void setRoleType(RoleType roleType) {
if (roleType != null) {
this.roleType = roleType.name();
@ -45,4 +49,8 @@ public class RoleResponse extends BaseRoleResponse {
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public void setState(String state) {
this.state = state;
}
}

View File

@ -63,6 +63,10 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledVie
@Param(description = "the domain name of the security group")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the security group belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName("ingressrule")
@Param(description = "the list of ingress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class)
private Set<SecurityGroupRuleResponse> ingressRules;
@ -126,6 +130,11 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledVie
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setSecurityGroupIngressRules(Set<SecurityGroupRuleResponse> securityGroupRules) {
this.ingressRules = securityGroupRules;
}

View File

@ -98,6 +98,10 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponseWithAnnotation
@Param(description = "the domain name of the owner")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "the domain path of the owner", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.REMOVED)
@Param(description = "the date and time the host was removed")
private Date removed;
@ -193,4 +197,9 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponseWithAnnotation
this.domain = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
}

View File

@ -120,6 +120,10 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
@Param(description = "the domain name of the owner")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "the domain path of the owner", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date and time the host was created")
private Date created;
@ -241,6 +245,11 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
this.domain = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}

View File

@ -66,6 +66,10 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
@Param(description = "the domain name of the owner")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "the domain path of the owner", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.REMOVED)
@Param(description = "the date and time the host was removed")
private Date removed;
@ -119,6 +123,10 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
this.domain = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}

View File

@ -47,6 +47,10 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
@Param(description = "the domain name of the snapshot's account")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the snapshot's account belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the snapshot")
private String projectId;
@ -187,6 +191,11 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setSnapshotType(String snapshotType) {
this.snapshotType = snapshotType;
}

View File

@ -70,6 +70,10 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
@Param(description = "the domain associated with the static route")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "the domain path associated with the static route", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with static route", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
@ -114,6 +118,10 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -371,4 +371,16 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations {
public void setNfsMountOpts(String nfsMountOpts) {
this.nfsMountOpts = nfsMountOpts;
}
public Long getAllocatedIops() {
return allocatedIops;
}
public Boolean getTagARule() {
return isTagARule;
}
public void setTagARule(Boolean tagARule) {
isTagARule = tagARule;
}
}

View File

@ -135,6 +135,10 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements
@Param(description = "the name of the domain to which the template belongs")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the template belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the ID of the domain to which the template belongs")
private String domainId;
@ -354,6 +358,11 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;

View File

@ -52,6 +52,10 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen
@Param(description = "the domain the resource is associated with")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the usage reocrd belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the zone ID")
private String zoneId;
@ -277,6 +281,10 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setNetworkId(String networkId) {
this.networkId = networkId;
}

View File

@ -25,12 +25,16 @@ import com.cloud.serializer.Param;
public class UsageTypeResponse extends BaseResponse {
@SerializedName("usagetypeid")
@Param(description = "usage type")
@SerializedName("id")
@Param(description = "Usage type ID")
private Integer usageType;
@SerializedName(ApiConstants.NAME)
@Param(description = "Usage type name")
private String name;
@SerializedName(ApiConstants.DESCRIPTION)
@Param(description = "description of usage type")
@Param(description = "Usage type description")
private String description;
public String getDescription() {
@ -49,10 +53,10 @@ public class UsageTypeResponse extends BaseResponse {
this.usageType = usageType;
}
public UsageTypeResponse(Integer usageType, String description) {
public UsageTypeResponse(Integer usageType, String name, String description) {
this.usageType = usageType;
this.name = name;
this.description = description;
setObjectName("usagetype");
}
}

View File

@ -54,6 +54,10 @@ public class UserDataResponse extends BaseResponseWithAnnotations implements Con
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the userdata owner")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the userdata owner belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.USER_DATA) @Param(description="base64 encoded userdata content")
private String userData;
@ -143,4 +147,9 @@ public class UserDataResponse extends BaseResponseWithAnnotations implements Con
public void setDomainName(String domain) {
this.domain = domain;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
}

View File

@ -82,6 +82,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
@Param(description = "the name of the domain in which the virtual machine exists")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain in which the virtual machine exists", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date when this virtual machine was created")
private Date created;
@ -703,6 +707,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setCreated(Date created) {
this.created = created;
}
@ -1133,4 +1141,8 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
}
this.vnfDetails.put(key,value);
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
}

View File

@ -108,6 +108,10 @@ public class VMSnapshotResponse extends BaseResponseWithTagInformation implement
@Param(description = "the domain associated with the disk volume")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the disk volume belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.HYPERVISOR)
@Param(description = "the type of hypervisor on which snapshot is stored")
private String hypervisor;
@ -261,6 +265,11 @@ public class VMSnapshotResponse extends BaseResponseWithTagInformation implement
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setTags(Set<ResourceTagResponse> tags) {
this.tags = tags;
}

View File

@ -60,6 +60,10 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
@Param(description = "the domain associated with the provider")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the provider belongs", since = "4.19.2.0")
private String domainPath;
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
@ -79,6 +83,10 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -55,6 +55,10 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
@Param(description = "the domain name of the VLAN IP range")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the VLAN IP range belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.POD_ID)
@Param(description = "the Pod ID for the VLAN IP range")
private String podId;
@ -166,6 +170,11 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setPodId(String podId) {
this.podId = podId;
}

View File

@ -145,6 +145,10 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
@Param(description = "the domain associated with the disk volume")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the Domain the disk volume belongs to", since = "4.19.2.0")
private String domainPath;
@SerializedName("storagetype")
@Param(description = "shared or local storage")
private String storageType;
@ -211,7 +215,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
@SerializedName("destroyed")
@Param(description = "the boolean state of whether the volume is destroyed or not")
private Boolean destroyed;
private boolean destroyed;
@SerializedName(ApiConstants.SERVICE_OFFERING_ID)
@Param(description = "ID of the service offering for root disk")
@ -227,7 +231,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
@SerializedName("isextractable")
@Param(description = "true if the volume is extractable, false otherwise")
private Boolean extractable;
private boolean extractable;
@SerializedName(ApiConstants.STATUS)
@Param(description = "the status of the volume")
@ -235,7 +239,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
@SerializedName(ApiConstants.DISPLAY_VOLUME)
@Param(description = "an optional field whether to the display the volume to the end user or not.", authorized = {RoleType.Admin})
private Boolean displayVolume;
private boolean displayVolume;
@SerializedName(ApiConstants.PATH)
@Param(description = "the path of the volume")
@ -318,11 +322,11 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
return this.getId();
}
public Boolean isDestroyed() {
public boolean isDestroyed() {
return destroyed;
}
public void setDestroyed(Boolean destroyed) {
public void setDestroyed(boolean destroyed) {
this.destroyed = destroyed;
}
@ -409,6 +413,11 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
this.domainName = domainName;
}
@Override
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setStorageType(String storageType) {
this.storageType = storageType;
}
@ -521,7 +530,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
this.serviceOfferingDisplayText = serviceOfferingDisplayText;
}
public void setExtractable(Boolean extractable) {
public void setExtractable(boolean extractable) {
this.extractable = extractable;
}
@ -539,7 +548,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
this.projectName = projectName;
}
public void setDisplayVolume(Boolean displayVm) {
public void setDisplayVolume(boolean displayVm) {
this.displayVolume = displayVm;
}
@ -755,7 +764,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
return serviceOfferingDisplayText;
}
public Boolean getExtractable() {
public boolean isExtractable() {
return extractable;
}
@ -763,7 +772,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
return status;
}
public Boolean getDisplayVolume() {
public boolean isDisplayVolume() {
return displayVolume;
}

View File

@ -96,6 +96,10 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll
@Param(description = "the domain name of the owner")
private String domain;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "the domain path of the owner", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.NETWORK)
@Param(description = "the list of networks belongign to the VPC", responseObject = NetworkResponse.class)
private List<NetworkResponse> networks;
@ -209,6 +213,11 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll
domain = domainName;
}
@Override
public void setDomainPath(String path) {
this.domainPath = path;
}
public void setZoneId(final String zoneId) {
this.zoneId = zoneId;
}

View File

@ -48,6 +48,10 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
@Param(description = "the domain name of the account of the remote access vpn")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "path of the domain to which the remote access vpn belongs", since = "4.19.2.0")
private String domainPath;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the vpn")
private String projectId;
@ -83,6 +87,11 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
this.domainName = name;
}
@Override
public void setDomainPath(String path) {
this.domainPath = path;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;

View File

@ -95,7 +95,7 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
@SerializedName("securitygroupsenabled")
@Param(description = "true if security groups support is enabled, false otherwise")
private Boolean securityGroupsEnabled;
private boolean securityGroupsEnabled;
@SerializedName("allocationstate")
@Param(description = "the allocation state of the cluster")
@ -111,11 +111,11 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
@SerializedName("capacity")
@Param(description = "the capacity of the Zone", responseObject = CapacityResponse.class)
private List<CapacityResponse> capacitites;
private List<CapacityResponse> capacities;
@SerializedName(ApiConstants.LOCAL_STORAGE_ENABLED)
@Param(description = "true if local storage offering enabled, false otherwise")
private Boolean localStorageEnabled;
private boolean localStorageEnabled;
@SerializedName(ApiConstants.TAGS)
@Param(description = "the list of resource tags associated with zone.", responseObject = ResourceTagResponse.class, since = "4.3")
@ -201,7 +201,7 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
this.networkType = networkType;
}
public void setSecurityGroupsEnabled(Boolean securityGroupsEnabled) {
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
@ -217,15 +217,15 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
this.dhcpProvider = dhcpProvider;
}
public void setCapacitites(List<CapacityResponse> capacitites) {
this.capacitites = capacitites;
public void setCapacities(List<CapacityResponse> capacities) {
this.capacities = capacities;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public void setLocalStorageEnabled(Boolean localStorageEnabled) {
public void setLocalStorageEnabled(boolean localStorageEnabled) {
this.localStorageEnabled = localStorageEnabled;
}
@ -328,8 +328,8 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
return dhcpProvider;
}
public List<CapacityResponse> getCapacitites() {
return capacitites;
public List<CapacityResponse> getCapacities() {
return capacities;
}
public boolean isLocalStorageEnabled() {
@ -344,6 +344,18 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
return resourceDetails;
}
public Boolean getAllowUserSpecifyVRMtu() {
return allowUserSpecifyVRMtu;
}
public Integer getRouterPrivateInterfaceMaxMtu() {
return routerPrivateInterfaceMaxMtu;
}
public Integer getRouterPublicInterfaceMaxMtu() {
return routerPublicInterfaceMaxMtu;
}
@Override
public void setResourceIconResponse(ResourceIconResponse resourceIconResponse) {
this.resourceIconResponse = resourceIconResponse;

View File

@ -20,7 +20,6 @@ import com.cloud.utils.Pair;
import org.apache.cloudstack.api.command.admin.usage.GenerateUsageRecordsCmd;
import org.apache.cloudstack.api.command.admin.usage.ListUsageRecordsCmd;
import org.apache.cloudstack.api.command.admin.usage.RemoveRawUsageRecordsCmd;
import org.apache.cloudstack.api.response.UsageTypeResponse;
import java.util.List;
import java.util.TimeZone;
@ -62,6 +61,4 @@ public interface UsageService {
TimeZone getUsageTimezone();
boolean removeRawUsageRecords(RemoveRawUsageRecordsCmd cmd);
List<UsageTypeResponse> listUsageTypes();
}

View File

@ -51,31 +51,31 @@ public class UsageTypes {
public static List<UsageTypeResponse> listUsageTypes() {
List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
responseList.add(new UsageTypeResponse(RUNNING_VM, "Running Vm Usage"));
responseList.add(new UsageTypeResponse(ALLOCATED_VM, "Allocated Vm Usage"));
responseList.add(new UsageTypeResponse(IP_ADDRESS, "IP Address Usage"));
responseList.add(new UsageTypeResponse(NETWORK_BYTES_SENT, "Network Usage (Bytes Sent)"));
responseList.add(new UsageTypeResponse(NETWORK_BYTES_RECEIVED, "Network Usage (Bytes Received)"));
responseList.add(new UsageTypeResponse(VOLUME, "Volume Usage"));
responseList.add(new UsageTypeResponse(TEMPLATE, "Template Usage"));
responseList.add(new UsageTypeResponse(ISO, "ISO Usage"));
responseList.add(new UsageTypeResponse(SNAPSHOT, "Snapshot Usage"));
responseList.add(new UsageTypeResponse(SECURITY_GROUP, "Security Group Usage"));
responseList.add(new UsageTypeResponse(LOAD_BALANCER_POLICY, "Load Balancer Usage"));
responseList.add(new UsageTypeResponse(PORT_FORWARDING_RULE, "Port Forwarding Usage"));
responseList.add(new UsageTypeResponse(NETWORK_OFFERING, "Network Offering Usage"));
responseList.add(new UsageTypeResponse(VPN_USERS, "VPN users usage"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_READ, "VM Disk usage(I/O Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM Disk usage(I/O Write)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM Disk usage(Bytes Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM Disk usage(Bytes Write)"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT, "VM Snapshot storage usage"));
responseList.add(new UsageTypeResponse(VOLUME_SECONDARY, "Volume on secondary storage usage"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT_ON_PRIMARY, "VM Snapshot on primary storage usage"));
responseList.add(new UsageTypeResponse(BACKUP, "Backup storage usage"));
responseList.add(new UsageTypeResponse(BUCKET, "Bucket storage usage"));
responseList.add(new UsageTypeResponse(NETWORK, "Network usage"));
responseList.add(new UsageTypeResponse(VPC, "VPC usage"));
responseList.add(new UsageTypeResponse(RUNNING_VM, "RUNNING_VM", "Running Vm Usage"));
responseList.add(new UsageTypeResponse(ALLOCATED_VM, "ALLOCATED_VM", "Allocated Vm Usage"));
responseList.add(new UsageTypeResponse(IP_ADDRESS, "IP_ADDRESS", "IP Address Usage"));
responseList.add(new UsageTypeResponse(NETWORK_BYTES_SENT, "NETWORK_BYTES_SENT", "Network Usage (Bytes Sent)"));
responseList.add(new UsageTypeResponse(NETWORK_BYTES_RECEIVED, "NETWORK_BYTES_RECEIVED", "Network Usage (Bytes Received)"));
responseList.add(new UsageTypeResponse(VOLUME, "VOLUME", "Volume Usage"));
responseList.add(new UsageTypeResponse(TEMPLATE, "TEMPLATE", "Template Usage"));
responseList.add(new UsageTypeResponse(ISO, "ISO", "ISO Usage"));
responseList.add(new UsageTypeResponse(SNAPSHOT, "SNAPSHOT", "Snapshot Usage"));
responseList.add(new UsageTypeResponse(SECURITY_GROUP, "SECURITY_GROUP", "Security Group Usage"));
responseList.add(new UsageTypeResponse(LOAD_BALANCER_POLICY, "LOAD_BALANCER_POLICY", "Load Balancer Usage"));
responseList.add(new UsageTypeResponse(PORT_FORWARDING_RULE, "PORT_FORWARDING_RULE", "Port Forwarding Usage"));
responseList.add(new UsageTypeResponse(NETWORK_OFFERING, "NETWORK_OFFERING", "Network Offering Usage"));
responseList.add(new UsageTypeResponse(VPN_USERS, "VPN_USERS", "VPN users usage"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_READ, "VM_DISK_IO_READ", "VM Disk usage(I/O Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM_DISK_IO_WRITE", "VM Disk usage(I/O Write)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM_DISK_BYTES_READ", "VM Disk usage(Bytes Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM_DISK_BYTES_WRITE", "VM Disk usage(Bytes Write)"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT, "VM_SNAPSHOT", "VM Snapshot storage usage"));
responseList.add(new UsageTypeResponse(VOLUME_SECONDARY, "VOLUME_SECONDARY", "Volume on secondary storage usage"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT_ON_PRIMARY, "VM_SNAPSHOT_ON_PRIMARY", "VM Snapshot on primary storage usage"));
responseList.add(new UsageTypeResponse(BACKUP, "BACKUP", "Backup storage usage"));
responseList.add(new UsageTypeResponse(BUCKET, "BUCKET", "Bucket storage usage"));
responseList.add(new UsageTypeResponse(NETWORK, "NETWORK", "Network usage"));
responseList.add(new UsageTypeResponse(VPC, "VPC", "VPC usage"));
return responseList;
}
}

View File

@ -54,6 +54,7 @@ public class CreateRoleCmdTest {
when(role.getDescription()).thenReturn("User test");
when(role.getName()).thenReturn("testuser");
when(role.getRoleType()).thenReturn(RoleType.User);
when(role.getState()).thenReturn(Role.State.ENABLED);
when(roleService.createRole(createRoleCmd.getRoleName(), createRoleCmd.getRoleType(), createRoleCmd.getRoleDescription(), true)).thenReturn(role);
createRoleCmd.execute();
RoleResponse response = (RoleResponse) createRoleCmd.getResponseObject();
@ -71,6 +72,7 @@ public class CreateRoleCmdTest {
when(newRole.getDescription()).thenReturn("User test");
when(newRole.getName()).thenReturn("testuser");
when(newRole.getRoleType()).thenReturn(RoleType.User);
when(newRole.getState()).thenReturn(Role.State.ENABLED);
when(roleService.createRole(createRoleCmd.getRoleName(), role, createRoleCmd.getRoleDescription(), true)).thenReturn(newRole);
createRoleCmd.execute();
RoleResponse response = (RoleResponse) createRoleCmd.getResponseObject();

View File

@ -32,19 +32,13 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.cloud.exception.InvalidParameterValueException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
public class ImportRoleCmdTest {
private ImportRoleCmd importRoleCmd;
@ -93,6 +87,7 @@ public class ImportRoleCmdTest {
when(role.getDescription()).thenReturn("test user imported");
when(role.getName()).thenReturn("Test User");
when(role.getRoleType()).thenReturn(RoleType.User);
when(role.getState()).thenReturn(Role.State.ENABLED);
when(roleService.importRole(anyString(), any(), anyString(), any(), anyBoolean(), anyBoolean())).thenReturn(role);
importRoleCmd.execute();

View File

@ -62,6 +62,7 @@ public class UpdateRoleCmdTest extends TestCase{
when(role.getId()).thenReturn(1L);
when(role.getDescription()).thenReturn("Description Initial");
when(role.getName()).thenReturn("User");
when(role.getState()).thenReturn(Role.State.ENABLED);
updateRoleCmd.execute();
RoleResponse response = (RoleResponse) updateRoleCmd.getResponseObject();
assertEquals((String)ReflectionTestUtils.getField(response, "roleName"),role.getName());

View File

@ -32,8 +32,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.security.InvalidParameterException;
public class CreateVMScheduleCmdTest {
@Mock
public VMScheduleManager vmScheduleManager;
@ -70,11 +68,11 @@ public class CreateVMScheduleCmdTest {
/**
* given: "We have a VMScheduleManager and CreateVMScheduleCmd"
* when: "CreateVMScheduleCmd is executed with an invalid parameter"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterException.class)
public void testInvalidParameterException() {
Mockito.when(vmScheduleManager.createSchedule(createVMScheduleCmd)).thenThrow(InvalidParameterException.class);
@Test(expected = InvalidParameterValueException.class)
public void testInvalidParameterValueException() {
Mockito.when(vmScheduleManager.createSchedule(createVMScheduleCmd)).thenThrow(InvalidParameterValueException.class);
createVMScheduleCmd.execute();
}
@ -94,7 +92,7 @@ public class CreateVMScheduleCmdTest {
/**
* given: "We have an EntityManager and CreateVMScheduleCmd"
* when: "CreateVMScheduleCmd.getEntityOwnerId is executed for a VM which doesn't exist"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterValueException.class)
public void testFailureGetEntityOwnerId() {

View File

@ -34,8 +34,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.security.InvalidParameterException;
public class DeleteVMScheduleCmdTest {
@Mock
public VMScheduleManager vmScheduleManager;
@ -89,11 +87,11 @@ public class DeleteVMScheduleCmdTest {
/**
* given: "We have a VMScheduleManager and DeleteVMScheduleCmd"
* when: "DeleteVMScheduleCmd is executed with an invalid parameter"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterException.class)
public void testInvalidParameterException() {
Mockito.when(vmScheduleManager.removeSchedule(deleteVMScheduleCmd)).thenThrow(InvalidParameterException.class);
@Test(expected = InvalidParameterValueException.class)
public void testInvalidParameterValueException() {
Mockito.when(vmScheduleManager.removeSchedule(deleteVMScheduleCmd)).thenThrow(InvalidParameterValueException.class);
deleteVMScheduleCmd.execute();
}
@ -113,7 +111,7 @@ public class DeleteVMScheduleCmdTest {
/**
* given: "We have an EntityManager and DeleteVMScheduleCmd"
* when: "DeleteVMScheduleCmd.getEntityOwnerId is executed for a VM which doesn't exist"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterValueException.class)
public void testFailureGetEntityOwnerId() {

View File

@ -18,6 +18,7 @@
*/
package org.apache.cloudstack.api.command.user.vm;
import com.cloud.exception.InvalidParameterValueException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.VMScheduleResponse;
import org.apache.cloudstack.vm.schedule.VMScheduleManager;
@ -30,7 +31,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Collections;
@ -88,11 +88,11 @@ public class ListVMScheduleCmdTest {
/**
* given: "We have a VMScheduleManager and ListVMScheduleCmd"
* when: "ListVMScheduleCmd is executed with an invalid parameter"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterException.class)
public void testInvalidParameterException() {
Mockito.when(vmScheduleManager.listSchedule(listVMScheduleCmd)).thenThrow(InvalidParameterException.class);
@Test(expected = InvalidParameterValueException.class)
public void testInvalidParameterValueException() {
Mockito.when(vmScheduleManager.listSchedule(listVMScheduleCmd)).thenThrow(InvalidParameterValueException.class);
listVMScheduleCmd.execute();
ListResponse<VMScheduleResponse> actualResponseObject = (ListResponse<VMScheduleResponse>) listVMScheduleCmd.getResponseObject();
}

View File

@ -33,8 +33,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.security.InvalidParameterException;
public class UpdateVMScheduleCmdTest {
@Mock
public VMScheduleManager vmScheduleManager;
@ -71,11 +69,11 @@ public class UpdateVMScheduleCmdTest {
/**
* given: "We have a VMScheduleManager and UpdateVMScheduleCmd"
* when: "UpdateVMScheduleCmd is executed with an invalid parameter"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterException.class)
public void testInvalidParameterException() {
Mockito.when(vmScheduleManager.updateSchedule(updateVMScheduleCmd)).thenThrow(InvalidParameterException.class);
@Test(expected = InvalidParameterValueException.class)
public void testInvalidParameterValueException() {
Mockito.when(vmScheduleManager.updateSchedule(updateVMScheduleCmd)).thenThrow(InvalidParameterValueException.class);
updateVMScheduleCmd.execute();
}
@ -99,7 +97,7 @@ public class UpdateVMScheduleCmdTest {
/**
* given: "We have an EntityManager and UpdateVMScheduleCmd"
* when: "UpdateVMScheduleCmd.getEntityOwnerId is executed for a VM Schedule which doesn't exist"
* then: "an InvalidParameterException is thrown"
* then: "an InvalidParameterValueException is thrown"
*/
@Test(expected = InvalidParameterValueException.class)
public void testFailureGetEntityOwnerId() {

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: cloudstack
Section: libs
Priority: extra
Maintainer: Wido den Hollander <wido@widodh.nl>
Build-Depends: debhelper (>= 9), openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
python-mysql.connector | python3-mysql.connector, maven (>= 3) | maven3,
python (>= 2.7) | python2 (>= 2.7), python3 (>= 3), python-setuptools, python3-setuptools,
nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13)

View File

@ -28,6 +28,12 @@
<version>4.20.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${cs.mysql.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
@ -108,28 +114,25 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<version>${cs.exec-maven-plugin.version}</version>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema</id>
<goals>
<goal>java</goal>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<executable>java</executable>
<workingDirectory>${basedir}/..</workingDirectory>
<includePluginDependencies>true</includePluginDependencies>
<arguments>
<argument>--add-opens=java.base/java.lang=ALL-UNNAMED</argument>
<argument>-classpath</argument>
<classpath />
<argument>com.cloud.upgrade.DatabaseCreator</argument>
<!-- db properties file -->
<argument>${basedir}/../utils/conf/db.properties</argument>
<argument>${basedir}/../utils/conf/db.properties.override</argument>
@ -177,27 +180,25 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<version>${cs.exec-maven-plugin.version}</version>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema-simulator</id>
<goals>
<goal>java</goal>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<executable>java</executable>
<workingDirectory>${basedir}/..</workingDirectory>
<includePluginDependencies>true</includePluginDependencies>
<arguments>
<argument>--add-opens=java.base/java.lang=ALL-UNNAMED</argument>
<argument>-classpath</argument>
<classpath />
<argument>com.cloud.upgrade.DatabaseCreator</argument>
<!-- db properties file -->
<argument>${basedir}/../utils/conf/db.properties</argument>
<argument>${basedir}/../utils/conf/db.properties.override</argument>
@ -235,27 +236,25 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
</dependencies>
<version>${cs.exec-maven-plugin.version}</version>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema-simulator</id>
<goals>
<goal>java</goal>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<executable>java</executable>
<workingDirectory>${basedir}/..</workingDirectory>
<includePluginDependencies>true</includePluginDependencies>
<arguments>
<argument>--add-opens=java.base/java.lang=ALL-UNNAMED</argument>
<argument>-classpath</argument>
<classpath />
<argument>com.cloud.upgrade.DatabaseCreator</argument>
<!-- db properties file -->
<argument>${basedir}/../utils/conf/db.properties</argument>
<argument>${basedir}/../utils/conf/db.properties.override</argument>

View File

@ -87,6 +87,20 @@ public interface VirtualMachineManager extends Manager {
ConfigKey<String> MetadataCustomCloudName = new ConfigKey<>("Advanced", String.class, "metadata.custom.cloud.name", "",
"If provided, a custom cloud-name in cloud-init metadata", true, ConfigKey.Scope.Zone);
ConfigKey<String> VmMetadataManufacturer = new ConfigKey<>("Advanced", String.class,
"vm.metadata.manufacturer", "Apache Software Foundation",
"If provided, a custom manufacturer will be used in the instance metadata. When an empty" +
"value is set then default manufacturer will be 'Apache Software Foundation'. " +
"A custom manufacturer may break cloud-init functionality with CloudStack datasource. Please " +
"refer documentation", true, ConfigKey.Scope.Zone);
ConfigKey<String> VmMetadataProductName = new ConfigKey<>("Advanced", String.class,
"vm.metadata.product", "",
"If provided, a custom product name will be used in the instance metadata. When an empty" +
"value is set then default product name will be 'CloudStack <HYPERVISIOR_NAME> Hypervisor'. " +
"A custom product name may break cloud-init functionality with CloudStack datasource. Please " +
"refer documentation",
true, ConfigKey.Scope.Zone);
interface Topics {
String VM_POWER_STATE = "vm.powerstate";
}

View File

@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import com.cloud.dc.DataCenter;
import com.cloud.hypervisor.Hypervisor;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.ConfigKey.Scope;
@ -144,6 +145,8 @@ public interface NetworkOrchestrationService {
List<NicProfile> getNicProfiles(VirtualMachine vm);
List<NicProfile> getNicProfiles(Long vmId, Hypervisor.HypervisorType hypervisorType);
Map<String, String> getSystemVMAccessDetails(VirtualMachine vm);
Pair<? extends NetworkGuru, ? extends Network> implementNetwork(long networkId, DeployDestination dest, ReservationContext context)

View File

@ -24,6 +24,7 @@ import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.storage.command.CommandResult;
import com.cloud.host.Host;
import com.cloud.offering.DiskOffering;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.storage.Storage.StoragePoolType;
@ -199,4 +200,9 @@ public interface PrimaryDataStoreDriver extends DataStoreDriver {
default long getVolumeSizeRequiredOnPool(long volumeSize, Long templateSize, boolean isEncryptionRequired) {
return volumeSize;
}
default boolean informStorageForDiskOfferingChange() {
return false;
}
default void updateStorageWithTheNewDiskOffering(Volume volume, DiskOffering newDiskOffering) {}
}

Some files were not shown because too many files have changed in this diff Show More