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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void execute() {
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled"));
response.setSnapshotShowChainSize((Boolean)capabilities.get("SnapshotShowChainSize"));
response.setAllowUserViewDestroyedVM((Boolean)capabilities.get("allowUserViewDestroyedVM"));
response.setAllowUserExpungeRecoverVM((Boolean)capabilities.get("allowUserExpungeRecoverVM"));
response.setAllowUserExpungeRecoverVolume((Boolean)capabilities.get("allowUserExpungeRecoverVolume"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public class CapabilitiesResponse extends BaseResponse {
@Param(description = "True if Snapshot is supported for KVM host, false otherwise")
private boolean kvmSnapshotEnabled;

@SerializedName("snapshotshowchainsize")
@Param(description = "True to show the parent and chain size (sum of physical size of snapshot and all its parents) for incremental snapshots", since = "4.22.1")
private boolean snapshotShowChainSize;
Comment on lines +76 to +78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By chain size, I believe that the end users can infer that it refers to the number of snapshots in the chain


@SerializedName("apilimitmax")
@Param(description = "Max allowed number of api requests within the specified interval")
private Integer apiLimitMax;
Expand Down Expand Up @@ -197,6 +201,10 @@ public void setKVMSnapshotEnabled(boolean kvmSnapshotEnabled) {
this.kvmSnapshotEnabled = kvmSnapshotEnabled;
}

public void setSnapshotShowChainSize(boolean snapshotShowChainSize) {
this.snapshotShowChainSize = snapshotShowChainSize;
}

public void setApiLimitInterval(Integer apiLimitInterval) {
this.apiLimitInterval = apiLimitInterval;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
@Param(description = "download progress of a snapshot", since = "4.19.0")
private Map<String, String> downloadDetails;

@SerializedName("parent")
@Param(description = "The parent ID of the Snapshot", since = "4.22.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Param(description = "The parent ID of the Snapshot", since = "4.22.1")
@Param(description = "The parent ID of the snapshot", since = "4.22.1")

private String parent;

@SerializedName("parentname")
@Param(description = "The parent name of the Snapshot", since = "4.22.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Param(description = "The parent name of the Snapshot", since = "4.22.1")
@Param(description = "The parent name of the snapshot", since = "4.22.1")

private String parentName;

public SnapshotResponse() {
tags = new LinkedHashSet<ResourceTagResponse>();
}
Expand Down Expand Up @@ -313,4 +321,12 @@ public void setDatastoreType(String datastoreType) {
public void setDownloadDetails(Map<String, String> downloadDetails) {
this.downloadDetails = downloadDetails;
}

public void setParent(String parent) {
this.parent = parent;
}

public void setParentName(String parentName) {
this.parentName = parentName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ private void setSnapshotInfoDetailsInResponse(SnapshotJoinVO snapshot, SnapshotR
if (showChainSize && snapshotInfo.getParent() != null) {
long chainSize = calculateChainSize(snapshotInfo);
snapshotResponse.setChainSize(chainSize);
snapshotResponse.setParent(snapshotInfo.getParent().getUuid());
snapshotResponse.setParentName(snapshotInfo.getParent().getName());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4799,6 +4799,7 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
final long diskOffMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
final long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
final boolean KVMSnapshotEnabled = SnapshotManager.KVMSnapshotEnabled.value();
final boolean SnapshotShowChainSize = SnapshotManager.snapshotShowChainSize.value();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really aware of why the snapshot.show.chain.size setting has been created. But, in what scenarios would it be interesting to hide these new fields from the API response?


final boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());

Expand Down Expand Up @@ -4839,6 +4840,7 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
capabilities.put("customDiskOffMaxSize", diskOffMaxSize);
capabilities.put("regionSecondaryEnabled", regionSecondaryEnabled);
capabilities.put("KVMSnapshotEnabled", KVMSnapshotEnabled);
capabilities.put("SnapshotShowChainSize", SnapshotShowChainSize);
capabilities.put("allowUserViewDestroyedVM", allowUserViewDestroyedVM);
capabilities.put("allowUserExpungeRecoverVM", allowUserExpungeRecoverVM);
capabilities.put("allowUserExpungeRecoverVolume", allowUserExpungeRecoverVolume);
Expand Down
11 changes: 10 additions & 1 deletion ui/src/config/section/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ export default {
resourceType: 'Snapshot',
columns: () => {
var fields = ['name', 'state', 'volumename', 'intervaltype', 'physicalsize', 'created']
if (store.getters.features.snapshotshowchainsize) {
fields.splice(fields.indexOf('created'), 0, 'chainsize', 'parentname')
}
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
fields.push('account')
if (store.getters.listAllProjects) {
Expand All @@ -324,7 +327,13 @@ export default {
fields.push('zonename')
return fields
},
details: ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'chainsize', 'account', 'domain', 'created'],
details: () => {
var fields = ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'account', 'domain', 'created']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var fields = ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'account', 'domain', 'created']
const fields = ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'account', 'domain', 'created']

if (store.getters.features.snapshotshowchainsize) {
fields.splice(fields.indexOf('account'), 0, 'chainsize', 'parentname')
}
Comment on lines +332 to +334
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to display for the chainsize the unit of measurement and for the parentname a link to the corresponding snapshot

return fields
},
tabs: [
{
name: 'details',
Expand Down
Loading