DaanHoogland commented on code in PR #8353:
URL: https://github.com/apache/cloudstack/pull/8353#discussion_r1427789443


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -684,12 +685,19 @@ public boolean stop() {
         return true;
     }
 
-    private DataStore createLocalStorage(Map<String, Object> poolInfos) throws 
ConnectionException{
+    protected DataStore createLocalStorage(Map<String, Object> poolInfos) 
throws ConnectionException{
         Object existingUuid = poolInfos.get("uuid");
         if( existingUuid == null ){
             poolInfos.put("uuid", UUID.randomUUID().toString());
         }
-        String hostAddress = poolInfos.get("host").toString();
+        String hostAddress = poolInfos.get("host") == null ? null : 
poolInfos.get("host").toString();
+        if (StringUtils.isEmpty(hostAddress)) {
+            throw new InvalidParameterValueException("Invalid host provided");
+        }
+        String hostPath = poolInfos.get("hostPath") == null ? null : 
poolInfos.get("hostPath").toString();
+        if (StringUtils.isEmpty(hostPath)) {
+            throw new InvalidParameterValueException("Invalid path provided");
+        }

Review Comment:
   yes @shwstppr 
   @weizhouapache if that is the case we need more refactoring, not less. 
Organising the methods into logical groups and extract them into their own 
modules. The only trade-off is "Do we have enough time to do it" imnsho.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to