|
64 | 64 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
65 | 65 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
66 | 66 | import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper; |
67 | | -import org.apache.commons.lang.StringUtils; |
68 | 67 | import org.apache.log4j.Logger; |
69 | 68 |
|
70 | 69 | import javax.inject.Inject; |
@@ -132,10 +131,9 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
132 | 131 | Long zoneId = (Long)dsInfos.get("zoneId"); |
133 | 132 | String url = (String)dsInfos.get("url"); |
134 | 133 | 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"); |
139 | 137 | } |
140 | 138 | if (clusterId != null && podId == null) { |
141 | 139 | throw new InvalidParameterValueException("Cluster id requires pod id"); |
@@ -254,15 +252,15 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
254 | 252 | parameters.setPath(hostPath.replaceFirst("/", "")); |
255 | 253 | parameters.setUserInfo(userInfo); |
256 | 254 | } else if (scheme.equalsIgnoreCase("PreSetup")) { |
257 | | - if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) { |
| 255 | + if (hypervisorType.equals(HypervisorType.VMware)) { |
258 | 256 | validateVcenterDetails(zoneId, podId, clusterId,storageHost); |
259 | 257 | } |
260 | 258 | parameters.setType(StoragePoolType.PreSetup); |
261 | 259 | parameters.setHost(storageHost); |
262 | 260 | parameters.setPort(0); |
263 | 261 | parameters.setPath(hostPath); |
264 | 262 | } else if (scheme.equalsIgnoreCase("DatastoreCluster")) { |
265 | | - if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) { |
| 263 | + if (hypervisorType.equals(HypervisorType.VMware)) { |
266 | 264 | validateVcenterDetails(zoneId, podId, clusterId,storageHost); |
267 | 265 | } |
268 | 266 | parameters.setType(StoragePoolType.DatastoreCluster); |
@@ -342,7 +340,7 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
342 | 340 | uuid = (String)existingUuid; |
343 | 341 | } else if (scheme.equalsIgnoreCase("sharedmountpoint") || scheme.equalsIgnoreCase("clvm")) { |
344 | 342 | 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)) { |
346 | 344 | uuid = hostPath.replace("/", ""); |
347 | 345 | } else { |
348 | 346 | uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); |
|
0 commit comments