|
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,7 +131,7 @@ 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 | | - String hypervisorType = (String)dsInfos.get("hypervisorType"); |
| 134 | + HypervisorType hypervisorType = (HypervisorType)dsInfos.get("hypervisorType"); |
136 | 135 | if (clusterId != null && podId == null) { |
137 | 136 | throw new InvalidParameterValueException("Cluster id requires pod id"); |
138 | 137 | } |
@@ -250,15 +249,15 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
250 | 249 | parameters.setPath(hostPath.replaceFirst("/", "")); |
251 | 250 | parameters.setUserInfo(userInfo); |
252 | 251 | } else if (scheme.equalsIgnoreCase("PreSetup")) { |
253 | | - if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) { |
| 252 | + if (hypervisorType.equals(HypervisorType.VMware)) { |
254 | 253 | validateVcenterDetails(zoneId, podId, clusterId,storageHost); |
255 | 254 | } |
256 | 255 | parameters.setType(StoragePoolType.PreSetup); |
257 | 256 | parameters.setHost(storageHost); |
258 | 257 | parameters.setPort(0); |
259 | 258 | parameters.setPath(hostPath); |
260 | 259 | } else if (scheme.equalsIgnoreCase("DatastoreCluster")) { |
261 | | - if (StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware)) { |
| 260 | + if (hypervisorType.equals(HypervisorType.VMware)) { |
262 | 261 | validateVcenterDetails(zoneId, podId, clusterId,storageHost); |
263 | 262 | } |
264 | 263 | parameters.setType(StoragePoolType.DatastoreCluster); |
@@ -338,7 +337,7 @@ public DataStore initialize(Map<String, Object> dsInfos) { |
338 | 337 | uuid = (String)existingUuid; |
339 | 338 | } else if (scheme.equalsIgnoreCase("sharedmountpoint") || scheme.equalsIgnoreCase("clvm")) { |
340 | 339 | uuid = UUID.randomUUID().toString(); |
341 | | - } else if (scheme.equalsIgnoreCase("PreSetup") && !(StringUtils.isNotBlank(hypervisorType) && HypervisorType.getType(hypervisorType).equals(HypervisorType.VMware))) { |
| 340 | + } else if (scheme.equalsIgnoreCase("PreSetup") && !hypervisorType.equals(HypervisorType.VMware)) { |
342 | 341 | uuid = hostPath.replace("/", ""); |
343 | 342 | } else { |
344 | 343 | uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); |
|
0 commit comments