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


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -775,23 +781,22 @@ public KVMPhysicalDisk createPhysicalDisk(String name, 
KVMStoragePool pool,
         s_logger.info("Attempting to create volume " + name + " (" + 
pool.getType().toString() + ") in pool "
                 + pool.getUuid() + " with size " + toHumanReadableSize(size));
 
-        switch (pool.getType()) {
-            case RBD:
-                return createPhysicalDiskByLibVirt(name, pool, 
PhysicalDiskFormat.RAW, provisioningType, size);
-            case NetworkFilesystem:
-            case Filesystem:
-                switch (format) {
-                    case QCOW2:
-                    case RAW:
-                        return createPhysicalDiskByQemuImg(name, pool, format, 
provisioningType, size, passphrase);
-                    case DIR:
-                    case TAR:
-                        return createPhysicalDiskByLibVirt(name, pool, format, 
provisioningType, size);
-                    default:
-                        throw new CloudRuntimeException("Unexpected disk 
format is specified.");
-                }
-            default:
-                return createPhysicalDiskByLibVirt(name, pool, format, 
provisioningType, size);
+        StoragePoolType poolType = pool.getType();

Review Comment:
   can we use `switch (poolType /*.toString*/)` here? jabva supports switching 
on strings, so no reason to do this refactor.



##########
framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java:
##########
@@ -650,7 +655,7 @@ protected void setField(Object entity, Field field, 
ResultSet rs, int index) thr
             } else if (type == byte[].class) {
                 field.set(entity, rs.getBytes(index));
             } else {
-                field.set(entity, rs.getObject(index));
+                field.set(entity, 
_conversionSupport.convertToEntityAttribute(field, rs.getObject(index)));

Review Comment:
   is this unconditionally? below a check for the annotation is done (see line 
1603)



-- 
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