Skip to content

Commit 1c16a1f

Browse files
Added new response parameter “supportsStorageSnapshot” (true/false) to volume response, and Updated UI to hide the async backup option while taking snapshot for volume(s) with storage snapshot support.
1 parent 9e92647 commit 1c16a1f

5 files changed

Lines changed: 27 additions & 4 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ public class ApiConstants {
339339
public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
340340
public static final String SNAPSHOT_TYPE = "snapshottype";
341341
public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
342+
public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot";
342343
public static final String SOURCE_ZONE_ID = "sourcezoneid";
343344
public static final String START_DATE = "startdate";
344345
public static final String START_ID = "startid";

api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,12 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
248248
@Param(description = "need quiesce vm or not when taking snapshot", since = "4.3")
249249
private boolean needQuiescevm;
250250

251+
@SerializedName(ApiConstants.SUPPORTS_STORAGE_SNAPSHOT)
252+
@Param(description = "true if storage snapshot is supported for the volume, false otherwise", since = "4.16")
253+
private boolean supportsStorageSnapshot;
254+
251255
@SerializedName(ApiConstants.PHYSICAL_SIZE)
252-
@Param(description = "the bytes alloaated")
256+
@Param(description = "the bytes allocated")
253257
private Long physicalsize;
254258

255259
@SerializedName(ApiConstants.VIRTUAL_SIZE)
@@ -538,6 +542,14 @@ public boolean isNeedQuiescevm() {
538542
return this.needQuiescevm;
539543
}
540544

545+
public void setSupportsStorageSnapshot(boolean supportsStorageSnapshot) {
546+
this.supportsStorageSnapshot = supportsStorageSnapshot;
547+
}
548+
549+
public boolean getSupportsStorageSnapshot() {
550+
return this.supportsStorageSnapshot;
551+
}
552+
541553
public String getIsoId() {
542554
return isoId;
543555
}

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,9 @@ public ListResponse<VolumeResponse> searchForVolumes(ListVolumesCmd cmd) {
19011901
if (caps != null) {
19021902
boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
19031903
vr.setNeedQuiescevm(quiescevm);
1904+
1905+
boolean supportsStorageSnapshot = Boolean.parseBoolean(caps.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()));
1906+
vr.setSupportsStorageSnapshot(supportsStorageSnapshot);
19041907
}
19051908
}
19061909
response.setResponses(volumeResponses, result.second());

ui/src/views/compute/CreateSnapshotWizard.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</span>
6565
<a-switch v-decorator="['quiescevm', { initialValue: false }]"/>
6666
</a-form-item>
67-
<a-form-item>
67+
<a-form-item v-if="!supportsStorageSnapshot">
6868
<span slot="label" :title="apiParams.asyncbackup.description">
6969
{{ $t('label.asyncbackup') }}
7070
<a-tooltip>
@@ -97,6 +97,7 @@ export default {
9797
return {
9898
loading: false,
9999
isQuiesceVm: false,
100+
supportsStorageSnapshot: false,
100101
listVolumes: []
101102
}
102103
},
@@ -131,7 +132,10 @@ export default {
131132
const params = {}
132133
params.volumeid = values.volumeid
133134
params.name = values.name
134-
params.asyncbackup = values.asyncbackup
135+
params.asyncbackup = false
136+
if (values.asyncbackup) {
137+
params.asyncbackup = values.asyncbackup
138+
}
135139
params.quiescevm = values.quiescevm
136140
137141
const title = this.$t('label.action.vmstoragesnapshot.create')
@@ -176,6 +180,7 @@ export default {
176180
const volumeFilter = this.listVolumes.filter(volume => volume.id === volumeId)
177181
if (volumeFilter && volumeFilter.length > 0) {
178182
this.isQuiesceVm = volumeFilter[0].quiescevm
183+
this.supportsStorageSnapshot = volumeFilter[0].supportsstoragesnapshot
179184
}
180185
},
181186
closeAction () {

ui/src/views/storage/TakeSnapshot.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
:placeholder="apiParams.name.description" />
3535
</a-form-item>
3636
</a-col>
37-
<a-col :md="24" :lg="24">
37+
<a-col :md="24" :lg="24" v-if="!supportsStorageSnapshot">
3838
<a-form-item :label="$t('label.asyncbackup')">
3939
<a-switch v-decorator="['asyncbackup']" />
4040
</a-form-item>
@@ -113,6 +113,7 @@ export default {
113113
return {
114114
actionLoading: false,
115115
quiescevm: false,
116+
supportsStorageSnapshot: false,
116117
inputValue: '',
117118
inputKey: '',
118119
inputVisible: '',
@@ -130,6 +131,7 @@ export default {
130131
},
131132
mounted () {
132133
this.quiescevm = this.resource.quiescevm
134+
this.supportsStorageSnapshot = this.resource.supportsstoragesnapshot
133135
},
134136
methods: {
135137
handleSubmit (e) {

0 commit comments

Comments
 (0)