Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/src/main/java/com/cloud/configuration/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ enum ResourceType { // All storage type resources are allocated_storage and not
backup_storage("backup_storage", 13),
bucket("bucket", 14),
object_storage("object_storage", 15),
gpu("gpu", 16);
gpu("gpu", 16),
instance_snapshot("instance_snapshot", 17);

private String name;
private int ordinal;
Expand Down
7 changes: 7 additions & 0 deletions api/src/main/java/com/cloud/user/ResourceLimitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public interface ResourceLimitService {
"The default maximum number of GPU devices that can be used for a domain", false);
static final ConfigKey<Long> DefaultMaxProjectGpus = new ConfigKey<>("Project Defaults",Long.class,"max.project.gpus","20",
"The default maximum number of GPU devices that can be used for a project", false);
static final ConfigKey<Long> MaxDomainInstanceSnapshot = new ConfigKey<>("Domain Defaults", Long.class, "max.domain.instance.snapshots", "40",
"The default maximum VM snapshots that can be used for a domain", false);
static final ConfigKey<Long> MaxAccountInstanceSnapshot = new ConfigKey<>("Account Defaults", Long.class, "max.account.instance.snapshots", "20",
"The default maximum VM snapshots that can be used for a account", false);
static final ConfigKey<Long> MaxProjectInstanceSnapshot = new ConfigKey<>("Project Defaults", Long.class, "max.project.instance.snapshots", "20",
"The default maximum VM snapshots that can be used for a project", false);


static final List<ResourceType> HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory, ResourceType.gpu);
static final List<ResourceType> StorageTagsSupportingTypes = List.of(ResourceType.volume, ResourceType.primary_storage);
Expand Down
46 changes: 45 additions & 1 deletion api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,47 @@ public class ApiConstants {
public static final String RESOURCE_NAME = "resourcename";
public static final String RESOURCE_TYPE = "resourcetype";
public static final String RESOURCE_TYPE_NAME = "resourcetypename";

public static final String RESOURCE_TYPE_DESCRIPTION = "Accepted values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 and 17.\n"
+ "0 - Instance. Number of Instances a user can create.\n"
+ "1 - IP. Number of public IP addresses an account can own.\n"
+ "2 - Volume. Number of disk volumes an account can own.\n"
+ "3 - Snapshot. Number of Snapshots an account can own.\n"
+ "4 - Template. Number of Templates an account can register/create.\n"
+ "5 - Project. Number of projects an account can own.\n"
+ "6 - Network. Number of networks an account can own.\n"
+ "7 - VPC. Number of VPC an account can own.\n"
+ "8 - CPU. Number of CPU an account can allocate for their resources.\n"
+ "9 - Memory. Amount of RAM an account can allocate for their resources.\n"
+ "10 - PrimaryStorage. Total primary storage space (in GiB) a user can use.\n"
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. \n"
+ "12 - Backup. Number of backups an account can own.\n"
+ "13 - BackupStorage. Total backup storage space (in GiB) a user can use.\n"
+ "14 - Bucket. Number of buckets an account can own\n"
+ "15 - ObjectStorage. Total object storage space (in GiB) a user can use.\n"
+ "16 - GPU. Number of GPUs an account can allocate for their resources.\n"
+ "17 - InstanceSnapshot. Number of instance snapshots an account can own";

public static final String RESOURCE_TYPE_NAME_DESCRIPTION = "Type of resource (wins over resourceType if both are provided). Values are:\n"
+ "user_vm - Instance. Number of Instances a user can create.\n"
+ "public_ip - IP. Number of public IP addresses an account can own.\n"
+ "volume - Volume. Number of disk volumes an account can own.\n"
+ "snapshot - Snapshot. Number of Snapshots an account can own.\n"
+ "template - Template. Number of Templates an account can register/create.\n"
+ "project - Project. Number of projects an account can own.\n"
+ "network - Network. Number of networks an account can own.\n"
+ "vpc - VPC. Number of VPC an account can own.\n"
+ "cpu - CPU. Number of CPU an account can allocate for their resources.\n"
+ "memory - Memory. Amount of RAM an account can allocate for their resources.\n"
+ "primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use.\n"
+ "secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use\n"
+ "backup - Backup. Number of backups an account can own.\n"
+ "backup_storage - BackupStorage. Total backup storage space (in GiB) a user can use\n"
+ "bucket - Bucket. Number of buckets an account can own.\n"
+ "object_storage - ObjectStorage. Total object storage space (in GiB) a user can use.\n"
+ "gpu - GPU. Number of GPUs an account can allocate for their resources.\n"
+ "instance_snapshot - InstanceSnapshot. Number of instance snapshots an account can own";

public static final String RESPONSE = "response";
public static final String RETRIEVE_ONLY_RESOURCE_COUNT = "retrieveonlyresourcecount";
public static final String REVERTABLE = "revertable";
Expand Down Expand Up @@ -915,7 +956,10 @@ public class ApiConstants {
public static final String MIGRATE_TO = "migrateto";
public static final String AUTO_MIGRATE = "automigrate";
public static final String GUID = "guid";
public static final String VM_SNAPSHOT_ENABELD = "vmsnapshotenabled";
public static final String VM_SNAPSHOT_ENABLED = "vmsnapshotenabled";
public static final String INSTANCE_SNAPSHOT_LIMIT = "instancesnapshotlimit";
public static final String INSTANCE_SNAPSHOT_TOTAL = "instancesnapshottotal";
public static final String INSTANCE_SNAPSHOT_AVAILABLE = "instancesnapshotavailable";
public static final String VSWITCH_TYPE_GUEST_TRAFFIC = "guestvswitchtype";
public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
public static final String VSWITCH_NAME_GUEST_TRAFFIC = "guestvswitchname";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
@Parameter(name = ApiConstants.MAX_HOSTS_PER_CLUSTER, type = CommandType.INTEGER, description = "The maximum number of the hypervisor hosts per cluster ", since = "4.16.0")
private Integer maxHostsPerClusterLimit;

@Parameter(name = ApiConstants.VM_SNAPSHOT_ENABELD, type = CommandType.BOOLEAN, description = "Set true to enable Instance Snapshots for this hypervisor", since = "4.16.0")
@Parameter(name = ApiConstants.VM_SNAPSHOT_ENABLED, type = CommandType.BOOLEAN, description = "Set true to enable Instance Snapshots for this hypervisor", since = "4.16.0")
private Boolean vmSnapshotEnabled;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,10 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Lists resource limits by ID.")
private Long id;

@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. "
+ "0 - Instance. Number of Instances a user can create. "
+ "1 - IP. Number of public IP addresses an account can own. "
+ "2 - Volume. Number of disk volumes an account can own. "
+ "3 - Snapshot. Number of Snapshots an account can own. "
+ "4 - Template. Number of Templates an account can register/create. "
+ "5 - Project. Number of projects an account can own. "
+ "6 - Network. Number of networks an account can own. "
+ "7 - VPC. Number of VPC an account can own. "
+ "8 - CPU. Number of CPU an account can allocate for their resources. "
+ "9 - Memory. Amount of RAM an account can allocate for their resources. "
+ "10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. "
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. " + ApiConstants.RESOURCE_TYPE_DESCRIPTION)
private Integer resourceType;

@Parameter(name = ApiConstants.RESOURCE_TYPE_NAME, type = CommandType.STRING, description = "Type of resource (wins over resourceType if both are provided). Values are: "
+ "user_vm - Instance. Number of Instances a user can create. "
+ "public_ip - IP. Number of public IP addresses an account can own. "
+ "volume - Volume. Number of disk volumes an account can own. "
+ "snapshot - Snapshot. Number of Snapshots an account can own. "
+ "template - Template. Number of Templates an account can register/create. "
+ "project - Project. Number of projects an account can own. "
+ "network - Network. Number of networks an account can own. "
+ "vpc - VPC. Number of VPC an account can own. "
+ "cpu - CPU. Number of CPU an account can allocate for their resources. "
+ "memory - Memory. Amount of RAM an account can allocate for their resources. "
+ "primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use. "
+ "secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
@Parameter(name = ApiConstants.RESOURCE_TYPE_NAME, type = CommandType.STRING, description = ApiConstants.RESOURCE_TYPE_NAME_DESCRIPTION)
private String resourceTypeName;

@Parameter(name = ApiConstants.TAG, type = CommandType.STRING, description = "Tag for the resource type", since = "4.20.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,7 @@ public class UpdateResourceCountCmd extends BaseCmd {

@Parameter(name = ApiConstants.RESOURCE_TYPE,
type = CommandType.INTEGER,
description = "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. If not specified will update all resource counts"
+ "0 - Instance. Number of Instances a user can create. "
+ "1 - IP. Number of public IP addresses a user can own. "
+ "2 - Volume. Number of disk volumes a user can create. "
+ "3 - Snapshot. Number of Snapshots a user can create. "
+ "4 - Template. Number of Templates that a user can register/create. "
+ "5 - Project. Number of projects that a user can create. "
+ "6 - Network. Number of guest network a user can create. "
+ "7 - VPC. Number of VPC a user can create. "
+ "8 - CPU. Total number of CPU cores a user can use. "
+ "9 - Memory. Total Memory (in MB) a user can use. "
+ "10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. "
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
description = "Type of resource to update, if not specified will update all resource counts. " + ApiConstants.RESOURCE_TYPE_DESCRIPTION)
private Integer resourceType;

@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Update resource limits for project")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
@Parameter(name = ApiConstants.RESOURCE_TYPE,
type = CommandType.INTEGER,
required = true,
description = "Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. "
+ "0 - Instance. Number of Instances a user can create. "
+ "1 - IP. Number of public IP addresses a user can own. "
+ "2 - Volume. Number of disk volumes a user can create. "
+ "3 - Snapshot. Number of Snapshots a user can create. "
+ "4 - Template. Number of Templates that a user can register/create. "
+ "5 - Project. Number of Projects a user can create. "
+ "6 - Network. Number of guest Network a user can create. "
+ "7 - VPC. Number of VPC a user can create. "
+ "8 - CPU. Total number of CPU cores a user can use. "
+ "9 - Memory. Total Memory (in MB) a user can use. "
+ "10 - PrimaryStorage. Total primary storage space (in GiB) a user can use. "
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
description = "Type of resource to update. " + ApiConstants.RESOURCE_TYPE_DESCRIPTION)
private Integer resourceType;

@Parameter(name = ApiConstants.TAG, type = CommandType.STRING, description = "Tag for the resource type", since = "4.20.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "the total backup storage space (in GiB) available to the account", since = "4.21.0")
private String backupStorageAvailable;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_LIMIT)
@Param(description = "The total number of Instance Snapshots that this Account can own")
private String instanceSnapshotLimit;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_TOTAL)
@Param(description = "The number of Instance Snapshots owned by this Account")
private Long instanceSnapshotTotal;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_AVAILABLE)
@Param(description = "The number of Instance Snapshots available for this Account")
private String instanceSnapshotAvailable;

@SerializedName("templatelimit")
@Param(description = "The total number of Templates which can be created by this Account")
private String templateLimit;
Expand Down Expand Up @@ -476,6 +488,21 @@ public void setBackupStorageAvailable(String backupStorageAvailable) {
this.backupStorageAvailable = backupStorageAvailable;
}

@Override
public void setInstanceSnapshotLimit(String instanceSnapshotLimit) {
this.instanceSnapshotLimit = instanceSnapshotLimit;
}

@Override
public void setInstanceSnapshotTotal(Long instanceSnapshotTotal) {
this.instanceSnapshotTotal = instanceSnapshotTotal;
}

@Override
public void setInstanceSnapshotAvailable(String instanceSnapshotAvailable) {
this.instanceSnapshotAvailable = instanceSnapshotAvailable;
}

@Override
public void setTemplateLimit(String templateLimit) {
this.templateLimit = templateLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ public class DomainResponse extends BaseResponseWithTagInformation implements Re
@Param(description = "the total backup storage space (in GiB) available to the domain", since = "4.21.0")
private String backupStorageAvailable;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_LIMIT)
@Param(description = "The number of Instance snapshots that can be stored by this domain")
private String instanceSnapshotLimit;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_TOTAL)
@Param(description = "The number of Instance snapshots stored by this domain")
private Long instanceSnapshotTotal;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_AVAILABLE)
@Param(description = "The number of Instance snapshots available for this domain")
private String instanceSnapshotAvailable;

@SerializedName("templatelimit") @Param(description = "The total number of Templates which can be created by this domain")
private String templateLimit;

Expand Down Expand Up @@ -400,6 +412,21 @@ public void setBackupStorageAvailable(String backupStorageAvailable) {
this.backupStorageAvailable = backupStorageAvailable;
}

@Override
public void setInstanceSnapshotLimit(String instanceSnapshotLimit) {
this.instanceSnapshotLimit = instanceSnapshotLimit;
}

@Override
public void setInstanceSnapshotTotal(Long instanceSnapshotTotal) {
this.instanceSnapshotTotal = instanceSnapshotTotal;
}

@Override
public void setInstanceSnapshotAvailable(String instanceSnapshotAvailable) {
this.instanceSnapshotAvailable = instanceSnapshotAvailable;
}

@Override
public void setTemplateLimit(String templateLimit) {
this.templateLimit = templateLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
@Param(description = "True if storage motion is supported")
private boolean isStorageMotionSupported;

@SerializedName(ApiConstants.VM_SNAPSHOT_ENABELD)
@SerializedName(ApiConstants.VM_SNAPSHOT_ENABLED)
@Param(description = "True if Instance Snapshots are enabled for this hypervisor")
private boolean isVmSnapshotEnabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "the total backup storage space (in GiB) available to the project", since = "4.21.0")
private String backupStorageAvailable;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_LIMIT)
@Param(description = "The number of Instance Snapshots that can be stored by this project")
private String instanceSnapshotLimit;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_TOTAL)
@Param(description = "The number of instance snapshots stored by this project")
private Long instanceSnapshotTotal;

@SerializedName(ApiConstants.INSTANCE_SNAPSHOT_AVAILABLE)
@Param(description = "The number of Instance snapshots available for this project")
private String instanceSnapshotAvailable;

@SerializedName("templatelimit")
@Param(description = "The total number of Templates which can be created by this project", since = "4.2.0")
private String templateLimit;
Expand Down Expand Up @@ -410,6 +422,21 @@ public void setBackupStorageAvailable(String backupStorageAvailable) {
this.backupStorageAvailable = backupStorageAvailable;
}

@Override
public void setInstanceSnapshotLimit(String instanceSnapshotLimit) {
this.instanceSnapshotLimit = instanceSnapshotLimit;
}

@Override
public void setInstanceSnapshotTotal(Long instanceSnapshotTotal) {
this.instanceSnapshotTotal = instanceSnapshotTotal;
}

@Override
public void setInstanceSnapshotAvailable(String instanceSnapshotAvailable) {
this.instanceSnapshotAvailable = instanceSnapshotAvailable;
}

@Override
public void setTemplateLimit(String templateLimit) {
this.templateLimit = templateLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ public interface ResourceLimitAndCountResponse {

void setObjectStorageAvailable(String objectStorageAvailable);

public void setInstanceSnapshotLimit(String instanceSnapshotLimit);

public void setInstanceSnapshotTotal(Long instanceSnapshotTotal);

public void setInstanceSnapshotAvailable(String instanceSnapshotAvailable);

public void setTemplateLimit(String templateLimit);

public void setTemplateTotal(Long templateTotal);
Expand Down
Loading