Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0d6e8bf
Add info of VM snapshots limits in the resource tab
May 6, 2026
d16b0db
Potential fix for pull request finding
Tonitzpp Jun 1, 2026
ce2b8a8
Update api/src/main/java/org/apache/cloudstack/api/response/AccountRe…
Tonitzpp Jun 1, 2026
ff29371
Update api/src/main/java/org/apache/cloudstack/api/response/ProjectRe…
Tonitzpp Jun 1, 2026
945011a
Update api/src/main/java/org/apache/cloudstack/api/response/ProjectRe…
Tonitzpp Jun 1, 2026
81d5154
Rename vm_snapshot to instance_snapshot
Tonitzpp Jun 1, 2026
0e2abab
Change ResourceType from vm_snapshot to instance_snapshot
Tonitzpp Jun 1, 2026
08acb33
Update AccountJoinDaoImpl.java
Tonitzpp Jun 1, 2026
4f9da75
Update en.json
Tonitzpp Jun 1, 2026
43c3135
Update snapshot terminology in ListResourceLimitsCmd
Tonitzpp Jun 1, 2026
f4db9ad
Fix typo in resource limits description
Tonitzpp Jun 1, 2026
cd04558
Update resource count description from VmSnapshot to InstanceSnapshot
Tonitzpp Jun 1, 2026
e26e79e
Update VM snapshot descriptions to use 'Instance'
Tonitzpp Jun 1, 2026
2275a30
Update snapshot terminology in ProjectResponse
Tonitzpp Jun 1, 2026
aac59a2
Update labels for instance terminology in en.json
Tonitzpp Jun 1, 2026
b2e7334
Change VM snapshot limit label translation
Tonitzpp Jun 1, 2026
17af28b
Apply suggestions from code review
Tonitzpp Jun 2, 2026
741adbb
Apply suggestions from code review
Tonitzpp Jun 9, 2026
7573aff
Reorder instance_snapshot and secondary_storage
Tonitzpp Jun 9, 2026
626d41f
Apply suggestions from code review
Tonitzpp Jul 6, 2026
90f06f6
Rename VM snapshot constants to instance snapshot
Tonitzpp Jul 6, 2026
dbfba8a
Rename snapshot constants for consistency
Tonitzpp Jul 6, 2026
9cfa238
Update snapshot-related fields to use INSTANCE constants
Tonitzpp Jul 6, 2026
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 @@ -33,7 +33,8 @@ enum ResourceType { // Primary and Secondary storage are allocated_storage and n
cpu("cpu", 8),
memory("memory", 9),
primary_storage("primary_storage", 10),
secondary_storage("secondary_storage", 11);
secondary_storage("secondary_storage", 11),
instance_snapshot("instance_snapshot", 12);

private String name;
private int ordinal;
Expand Down
3 changes: 3 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ public class ApiConstants {
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_LIMIT = "vmsnapshotlimit";
public static final String VM_SNAPSHOT_TOTAL = "vmsnapshottotal";
public static final String VM_SNAPSHOT_AVAILABLE = "vmsnapshotavailable";
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 @@ -42,7 +42,7 @@ 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. "
@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. Accepted values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 and 12. "
+ "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. "
Expand All @@ -54,7 +54,8 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
+ "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. ")
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. "
+ "12 - InstanceSnapshot. Number of instance snapshots an account can own.")
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: "
Expand All @@ -69,7 +70,8 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
+ "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. ")
+ "secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. "
+ "instance_snapshot - InstanceSnapshot. Number of instance snapshots an account can own.")
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,7 +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"
description = "Type of resource to update. Accepted values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12. 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. "
Expand All @@ -72,7 +72,8 @@ public class UpdateResourceCountCmd extends BaseCmd {
+ "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. ")
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use."
+ "12 - InstanceSnapshot. Number of instance snapshots an account can own.")
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 @@ -127,6 +127,18 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "The total number of Snapshots available for this Account")
private String snapshotAvailable;

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

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

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

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

@Override
public void setVmSnapshotLimit(String vmSnapshotLimit) {
this.vmSnapshotLimit = vmSnapshotLimit;
}

@Override
public void setVmSnapshotTotal(Long vmSnapshotTotal) {
this.vmSnapshotTotal = vmSnapshotTotal;
}

@Override
public void setVmSnapshotAvailable(String vmSnapshotAvailable) {
this.vmSnapshotAvailable = vmSnapshotAvailable;
}

@Override
public void setTemplateLimit(String templateLimit) {
this.templateLimit = templateLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ public class DomainResponse extends BaseResponseWithAnnotations implements Resou
@SerializedName("snapshotavailable") @Param(description = "The total number of Snapshots available for this domain")
private String snapshotAvailable;

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

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

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

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

Expand Down Expand Up @@ -313,6 +325,21 @@ public void setSnapshotAvailable(String snapshotAvailable) {
this.snapshotAvailable = snapshotAvailable;
}

@Override
public void setVmSnapshotLimit(String vmSnapshotLimit) {
this.vmSnapshotLimit = vmSnapshotLimit;
}

@Override
public void setVmSnapshotTotal(Long vmSnapshotTotal) {
this.vmSnapshotTotal = vmSnapshotTotal;
}

@Override
public void setVmSnapshotAvailable(String vmSnapshotAvailable) {
this.vmSnapshotAvailable = vmSnapshotAvailable;
}

@Override
public void setTemplateLimit(String templateLimit) {
this.templateLimit = templateLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "The total number of Snapshots available for this project", since = "4.2.0")
private String snapshotAvailable;

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

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

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

@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 @@ -320,6 +332,21 @@ public void setSnapshotAvailable(String snapshotAvailable) {
this.snapshotAvailable = snapshotAvailable;
}

@Override
public void setVmSnapshotLimit(String vmSnapshotLimit) {
this.vmSnapshotLimit = vmSnapshotLimit;
}

@Override
public void setVmSnapshotTotal(Long vmSnapshotTotal) {
this.vmSnapshotTotal = vmSnapshotTotal;
}

@Override
public void setVmSnapshotAvailable(String vmSnapshotAvailable) {
this.vmSnapshotAvailable = vmSnapshotAvailable;
}

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

public void setSnapshotAvailable(String snapshotAvailable);

public void setVmSnapshotLimit(String vmSnapshotLimit);

public void setVmSnapshotTotal(Long vmSnapshotTotal);

public void setVmSnapshotAvailable(String vmSnapshotAvailable);

public void setTemplateLimit(String templateLimit);

public void setTemplateTotal(Long templateTotal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ select
`volumecount`.`count` AS `volumeTotal`,
`snapshotlimit`.`max` AS `snapshotLimit`,
`snapshotcount`.`count` AS `snapshotTotal`,
`vmsnapshotlimit`.`max` AS `vmSnapshotLimit`,
`vmsnapshotcount`.`count` AS `vmSnapshotTotal`,
`templatelimit`.`max` AS `templateLimit`,
`templatecount`.`count` AS `templateTotal`,
`vpclimit`.`max` AS `vpcLimit`,
Expand Down Expand Up @@ -112,6 +114,12 @@ from
`cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
and snapshotcount.type = 'snapshot'
left join
`cloud`.`resource_limit` vmsnapshotlimit ON account.id = vmsnapshotlimit.account_id
and vmsnapshotlimit.type = 'vm_snapshot'
left join
`cloud`.`resource_count` vmsnapshotcount ON account.id = vmsnapshotcount.account_id
and vmsnapshotcount.type = 'vm_snapshot'
left join
`cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
and templatelimit.type = 'template'
left join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ select
`volumecount`.`count` AS `volumeTotal`,
`snapshotlimit`.`max` AS `snapshotLimit`,
`snapshotcount`.`count` AS `snapshotTotal`,
`vmsnapshotlimit`.`max` AS `vmSnapshotLimit`,
`vmsnapshotcount`.`count` AS `vmSnapshotTotal`,
`templatelimit`.`max` AS `templateLimit`,
`templatecount`.`count` AS `templateTotal`,
`vpclimit`.`max` AS `vpcLimit`,
Expand Down Expand Up @@ -86,6 +88,12 @@ from
`cloud`.`resource_count` snapshotcount ON domain.id = snapshotcount.domain_id
and snapshotcount.type = 'snapshot'
left join
`cloud`.`resource_limit` vmsnapshotlimit ON domain.id = vmsnapshotlimit.domain_id
and vmsnapshotlimit.type = 'vm_snapshot'
left join
`cloud`.`resource_count` vmsnapshotcount ON domain.id = vmsnapshotcount.domain_id
and vmsnapshotcount.type = 'vm_snapshot'
left join
`cloud`.`resource_limit` templatelimit ON domain.id = templatelimit.domain_id
and templatelimit.type = 'template'
left join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ public void setResourceLimits(AccountJoinVO account, boolean fullView, ResourceL
response.setSnapshotTotal(snapshotTotal);
response.setSnapshotAvailable(snapshotAvail);

Long vmSnapshotLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmSnapshotLimit(), account.getId(), ResourceType.instance_snapshot);
String vmSnapshotLimitDisplay = (fullView || vmSnapshotLimit == -1) ? Resource.UNLIMITED : String.valueOf(vmSnapshotLimit);
Long vmSnapshotTotal = (account.getVmSnapshotTotal() == null) ? 0 : account.getVmSnapshotTotal();
String snapshotAvailable = (fullView || vmSnapshotLimit == -1) ? Resource.UNLIMITED : String.valueOf(vmSnapshotLimit - vmSnapshotTotal);
response.setVmSnapshotLimit(vmSnapshotLimitDisplay);
response.setVmSnapshotTotal(vmSnapshotTotal);
response.setVmSnapshotAvailable(snapshotAvailable);
Comment thread
Tonitzpp marked this conversation as resolved.

Long templateLimit = ApiDBUtils.findCorrectResourceLimit(account.getTemplateLimit(), account.getId(), ResourceType.template);
String templateLimitDisplay = (fullView || templateLimit == -1) ? Resource.UNLIMITED : String.valueOf(templateLimit);
Long templateTotal = (account.getTemplateTotal() == null) ? 0 : account.getTemplateTotal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ public void setResourceLimits(DomainJoinVO domain, boolean fullView, ResourceLim
response.setSnapshotTotal(snapshotTotal);
response.setSnapshotAvailable(snapshotAvail);

Long vmSnapshotLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getVmSnapshotLimit(), ResourceType.instance_snapshot, domain.getId());
String vmSnapshotLimitDisplay = (fullView || vmSnapshotLimit == -1) ? Resource.UNLIMITED : String.valueOf(vmSnapshotLimit);
Long vmSnapshotTotal = (domain.getVmSnapshotTotal() == null) ? 0 : domain.getVmSnapshotTotal();
String vmSnapshotAvailable = (fullView || vmSnapshotLimit == -1) ? Resource.UNLIMITED : String.valueOf(vmSnapshotLimit - vmSnapshotTotal);
response.setVmSnapshotLimit(vmSnapshotLimitDisplay);
response.setVmSnapshotTotal(vmSnapshotTotal);
response.setVmSnapshotAvailable(vmSnapshotAvailable);

Long templateLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getTemplateLimit(), ResourceType.template, domain.getId());
String templateLimitDisplay = (fullView || templateLimit == -1) ? Resource.UNLIMITED : String.valueOf(templateLimit);
Long templateTotal = (domain.getTemplateTotal() == null) ? 0 : domain.getTemplateTotal();
Expand Down
14 changes: 14 additions & 0 deletions server/src/main/java/com/cloud/api/query/vo/AccountJoinVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
@Column(name = "snapshotTotal")
private Long snapshotTotal;

@Column(name = "vmSnapshotLimit")
private Long vmSnapshotLimit;

@Column(name = "vmSnapshotTotal")
private Long vmSnapshotTotal;

@Column(name = "templateLimit")
private Long templateLimit;

Expand Down Expand Up @@ -293,6 +299,10 @@ public Long getSnapshotTotal() {
return snapshotTotal;
}

public Long getVmSnapshotTotal() {
return vmSnapshotTotal;
}

public Long getTemplateTotal() {
return templateTotal;
}
Expand Down Expand Up @@ -349,6 +359,10 @@ public Long getSnapshotLimit() {
return snapshotLimit;
}

public Long getVmSnapshotLimit() {
return vmSnapshotLimit;
}

public Long getTemplateLimit() {
return templateLimit;
}
Expand Down
20 changes: 20 additions & 0 deletions server/src/main/java/com/cloud/api/query/vo/DomainJoinVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public class DomainJoinVO extends BaseViewVO implements InternalIdentity, Identi
@Column(name="snapshotTotal")
private Long snapshotTotal;

@Column(name = "vmSnapshotLimit")
private Long vmSnapshotLimit;

@Column(name = "vmSnapshotTotal")
private Long vmSnapshotTotal;

@Column(name="templateLimit")
private Long templateLimit;

Expand Down Expand Up @@ -311,8 +317,14 @@ public void setSnapshotTotal(Long snapshotTotal) {
this.snapshotTotal = snapshotTotal;
}

public Long getVmSnapshotTotal() {
return vmSnapshotTotal;
}


public void setVmSnapshotTotal(Long vmSnapshotTotal) {
this.vmSnapshotTotal = vmSnapshotTotal;
}

public Long getTemplateTotal() {
return templateTotal;
Expand Down Expand Up @@ -433,6 +445,14 @@ public void setSnapshotLimit(Long snapshotLimit) {
this.snapshotLimit = snapshotLimit;
}

public Long getVmSnapshotLimit() {
return vmSnapshotLimit;
}


public void setVmSnapshotLimit(Long vmSnapshotLimit) {
this.vmSnapshotLimit = vmSnapshotLimit;
}

public Long getTemplateLimit() {
return templateLimit;
Expand Down
2 changes: 2 additions & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2503,8 +2503,10 @@
"label.vmfs": "VMFS",
"label.vmipaddress": "Instance IP address",
"label.vmlimit": "Instance limits",
Comment thread
Tonitzpp marked this conversation as resolved.
"label.maxvmsnapshot": "Max. Instance snapshot",
"label.vmname": "Instance name",
"label.vms": "Instances",
"label.vmsnapshotlimit": "Instance snapshot limits",
"label.vmscheduleactions": "Actions",
"label.vmstate": "Instance state",
"label.vmtotal": "Total of Instances",
Expand Down
1 change: 1 addition & 0 deletions ui/public/locales/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@
"label.vmlimit": "Limites de inst\u00e2ncias",
"label.vmname": "Nome da VM",
"label.vms": "VMs",
"label.vmsnapshotlimit": "Limite de snapshots de inst\u00e2ncias",
"label.vmstate": "Estado da VM",
"label.vmtotal": "VMs totais",
"label.vmware.storage.policy": "Pol\u00edtica de armazenamento do VMWare",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/view/ResourceCountUsage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
return {
usageList: [
'vm', 'cpu', 'memory', 'primarystorage', 'volume', 'ip', 'network',
'vpc', 'secondarystorage', 'snapshot', 'template', 'project'
'vpc', 'secondarystorage', 'snapshot', 'vmsnapshot', 'template', 'project'
],
taggedUsage: {},
tagData: {},
Expand Down
Loading