Skip to content

Commit 0d3f4b7

Browse files
CSTACKEX-200: incorporate one round of review comments
1 parent 26f20d7 commit 0d3f4b7

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ private long resolveSnapshotPoolId(String poolIdStr, long snapshotId) {
352352
}
353353
SnapshotVO snapshotVO = snapshotDao.findById(snapshotId);
354354
if (snapshotVO == null) {
355-
throw new CloudRuntimeException("Cannot resolve storage pool for snapshot [" + snapshotId + "]");
355+
throw new CloudRuntimeException("Snapshot not found for snapshot [" + snapshotId + "]");
356356
}
357357
VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(snapshotVO.getVolumeId());
358358
if (volumeVO == null) {
359-
throw new CloudRuntimeException("Cannot resolve storage pool for snapshot [" + snapshotId + "]");
359+
throw new CloudRuntimeException("CloudStack Volume not found for snapshot [" + snapshotId + "]");
360360
}
361361
Long poolId = volumeVO.getPoolId() != null ? volumeVO.getPoolId() : volumeVO.getLastPoolId();
362362
if (poolId == null || poolId <= 0) {
@@ -685,7 +685,7 @@ public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCm
685685

686686
VolumeVO volumeVO = volumeDao.findById(volumeInfo.getId());
687687
if (volumeVO == null) {
688-
throw new CloudRuntimeException("VolumeVO not found for id: " + volumeInfo.getId());
688+
throw new CloudRuntimeException("CloudStack Volume not found for id: " + volumeInfo.getId());
689689
}
690690

691691
StoragePoolVO storagePool = storagePoolDao.findById(volumeVO.getPoolId());
@@ -718,11 +718,10 @@ public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCm
718718
String lunUuid = null;
719719
if (ProtocolType.ISCSI.name().equalsIgnoreCase(protocol)) {
720720
VolumeDetailVO lunDetail = volumeDetailsDao.findDetail(volumeVO.getId(), OntapStorageConstants.LUN_DOT_UUID);
721-
String lunUUID = lunDetail != null ? lunDetail.getValue() : null;
722-
if (lunUUID == null) {
721+
if (lunDetail.getValue() == null) {
723722
throw new CloudRuntimeException("LUN UUID not found for iSCSI volume " + volumeVO.getId());
724723
}
725-
lunUuid = lunUUID;
724+
lunUuid = lunDetail.getValue();
726725
}
727726

728727
// Create FlexVolume snapshot via ONTAP REST API

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public boolean connect(boolean validateAggregatesForVolumeCreation) {
143143
if (Objects.equals(storage.getProtocol(), ProtocolType.NFS3) && !svm.getNfsEnabled()) {
144144
logger.error("NFS protocol is not enabled on SVM " + svmName);
145145
throw new CloudRuntimeException("NFS protocol is not enabled on SVM " + svmName);
146-
} else if (Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) && !svm.getIscsiEnabled()) {
146+
} else if (Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) && !svm.getIscsiEnabled()) {
147147
logger.error("ISCSI protocol is not enabled on SVM " + svmName);
148148
throw new CloudRuntimeException("ISCSI protocol is not enabled on SVM " + svmName);
149149
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public static String getLunName(String volName, String lunName) {
166166
/**
167167
* Builds an ONTAP-safe name token from user-provided snapshot text.
168168
*/
169-
public static String getOntapCloneName(String cloudStackSnapshotName) {
169+
public static String getOntapSnapshotName(String cloudStackSnapshotName) {
170170
if (cloudStackSnapshotName == null || cloudStackSnapshotName.trim().isEmpty()) {
171171
throw new InvalidParameterValueException("Snapshot name cannot be null or blank");
172172
}
@@ -190,7 +190,7 @@ public static String getOntapCloneName(String cloudStackSnapshotName) {
190190
public static String buildOntapSnapshotName(String cloudStackSnapshotName, String uniquenessSuffix) {
191191
String normalizedBase = (cloudStackSnapshotName == null || cloudStackSnapshotName.trim().isEmpty())
192192
? "snapshot"
193-
: getOntapCloneName(cloudStackSnapshotName);
193+
: getOntapSnapshotName(cloudStackSnapshotName);
194194
String suffix = (uniquenessSuffix == null || uniquenessSuffix.isEmpty())
195195
? ""
196196
: "_" + uniquenessSuffix.replaceAll("[^a-zA-Z0-9_]", "_");

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/vmsnapshot/OntapVMSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ void createVmSnapshotsViaSingleFlexVol(VMSnapshot vmSnapshot, UserVm userVm,
677677
flexVolUuid, snapshotUuid, snapshotNameBase, volumePath, groupInfo.poolId, protocol));
678678
}
679679

680-
logger.info("takeVMSnapshot: [FlexVol] Snapshot [{}] (uuid={}) on FlexVol [{}] completed in {} ms. Covers volumes: {}",
680+
logger.debug("takeVMSnapshot: [FlexVol] Snapshot [{}] (uuid={}) on FlexVol [{}] completed in {} ms. Covers volumes: {}",
681681
snapshotNameBase, snapshotUuid, flexVolUuid,
682682
TimeUnit.MILLISECONDS.convert(System.nanoTime() - startSnapshot, TimeUnit.NANOSECONDS),
683683
groupInfo.volumeIds);

0 commit comments

Comments
 (0)