Skip to content

Commit 8856437

Browse files
committed
CSTACKEX-212: resolving comments
1 parent 1e71f85 commit 8856437

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet
160160

161161
volumeVO.setPoolType(storagePool.getPoolType());
162162
volumeVO.setPoolId(storagePool.getId());
163+
volumeVO.setFormat(getImageFormatByHypervisor(storagePool.getHypervisor()));
164+
logger.info("createAsync: Volume format set to [{}] for hypervisor [{}]", volumeVO.getFormat(), storagePool.getHypervisor());
163165

164166
if (ProtocolType.ISCSI.name().equalsIgnoreCase(details.get(OntapStorageConstants.PROTOCOL))) {
165167
String lunName = created != null && created.getLun() != null ? created.getLun().getName() : null;
@@ -174,15 +176,11 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet
174176
volumeVO.setFolder(created.getLun().getUuid());
175177
}
176178

177-
volumeVO.setFormat(getImageFormatByHypervisor(storagePool.getHypervisor()));
178-
logger.info("createAsync: Volume format set to [{}] for hypervisor [{}] and protocol [{}]", volumeVO.getFormat(), storagePool.getHypervisor(), details.get(OntapStorageConstants.PROTOCOL));
179179
logger.info("createAsync: Created LUN [{}] for volume [{}]. LUN mapping will occur during grantAccess() to per-host igroup.",
180180
lunName, volumeVO.getId());
181181
createCmdResult = new CreateCmdResult(lunName, new Answer(null, true, null));
182182
} else if (ProtocolType.NFS3.name().equalsIgnoreCase(details.get(OntapStorageConstants.PROTOCOL))) {
183183

184-
volumeVO.setFormat(getImageFormatByHypervisor(storagePool.getHypervisor()));
185-
logger.info("createAsync: Volume format set to [{}] for hypervisor [{}] and protocol [{}]", volumeVO.getFormat(), storagePool.getHypervisor(), details.get(OntapStorageConstants.PROTOCOL));
186184
createCmdResult = new CreateCmdResult(volInfo.getUuid(), new Answer(null, true, null));
187185
logger.info("createAsync: Managed NFS volume [{}] with path [{}] associated with pool {}",
188186
volumeVO.getId(), volInfo.getUuid(), storagePool.getId());
@@ -1011,7 +1009,7 @@ private String buildSnapshotName(String cloudStackSnapshotName, long snapshotId)
10111009

10121010

10131011
private Storage.ImageFormat getImageFormatByHypervisor(HypervisorType hypervisorType) {
1014-
if (hypervisorType == HypervisorType.KVM) {
1012+
if (hypervisorType.equals(HypervisorType.KVM)) {
10151013
return Storage.ImageFormat.QCOW2;
10161014
}
10171015
throw new CloudRuntimeException("Unsupported hypervisor [" + hypervisorType + "] for ONTAP image format resolution");

0 commit comments

Comments
 (0)