Skip to content

Commit f1a5394

Browse files
changed type to HypervisorType instead of String
1 parent c43f08e commit f1a5394

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
6565
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
6666
import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper;
67-
import org.apache.commons.lang.StringUtils;
6867
import org.apache.log4j.Logger;
6968

7069
import javax.inject.Inject;
@@ -132,10 +131,9 @@ public DataStore initialize(Map<String, Object> dsInfos) {
132131
Long zoneId = (Long)dsInfos.get("zoneId");
133132
String url = (String)dsInfos.get("url");
134133
String providerName = (String)dsInfos.get("providerName");
135-
Object hypervisorTypeObj = dsInfos.get("hypervisorType");
136-
String hypervisorType = "";
137-
if(hypervisorTypeObj != null) {
138-
hypervisorType = hypervisorTypeObj.toString();
134+
HypervisorType hypervisorType = HypervisorType.None;
135+
if(dsInfos.containsKey("hypervisorType")) {
136+
hypervisorType = (HypervisorType)dsInfos.get("hypervisorType");
139137
}
140138
if (clusterId != null && podId == null) {
141139
throw new InvalidParameterValueException("Cluster id requires pod id");
@@ -254,15 +252,15 @@ public DataStore initialize(Map<String, Object> dsInfos) {
254252
parameters.setPath(hostPath.replaceFirst("/", ""));
255253
parameters.setUserInfo(userInfo);
256254
} else if (scheme.equalsIgnoreCase("PreSetup")) {
257-
if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) {
255+
if (hypervisorType.equals(HypervisorType.VMware)) {
258256
validateVcenterDetails(zoneId, podId, clusterId,storageHost);
259257
}
260258
parameters.setType(StoragePoolType.PreSetup);
261259
parameters.setHost(storageHost);
262260
parameters.setPort(0);
263261
parameters.setPath(hostPath);
264262
} else if (scheme.equalsIgnoreCase("DatastoreCluster")) {
265-
if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) {
263+
if (hypervisorType.equals(HypervisorType.VMware)) {
266264
validateVcenterDetails(zoneId, podId, clusterId,storageHost);
267265
}
268266
parameters.setType(StoragePoolType.DatastoreCluster);
@@ -342,7 +340,7 @@ public DataStore initialize(Map<String, Object> dsInfos) {
342340
uuid = (String)existingUuid;
343341
} else if (scheme.equalsIgnoreCase("sharedmountpoint") || scheme.equalsIgnoreCase("clvm")) {
344342
uuid = UUID.randomUUID().toString();
345-
} else if (scheme.equalsIgnoreCase("PreSetup") && !(StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware))) {
343+
} else if (scheme.equalsIgnoreCase("PreSetup") && !hypervisorType.equals(HypervisorType.VMware)) {
346344
uuid = hostPath.replace("/", "");
347345
} else {
348346
uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString();

0 commit comments

Comments
 (0)