Copilot commented on code in PR #11177:
URL: https://github.com/apache/cloudstack/pull/11177#discussion_r2204657637


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -1315,14 +1317,22 @@ public KVMPhysicalDisk 
createDiskFromTemplate(KVMPhysicalDisk template,
                         
passphraseObjects.add(QemuObject.prepareSecretForQemuImg(format, 
QemuObject.EncryptFormat.LUKS, keyFile.toString(), "sec0", options));
                         
disk.setQemuEncryptFormat(QemuObject.EncryptFormat.LUKS);
                     }
+
+                    QemuImgFile srcFile = new QemuImgFile(template.getPath(), 
template.getFormat());
+                    Boolean createFullClone = 
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.CREATE_FULL_CLONE);

Review Comment:
   [nitpick] Prefer using a primitive `boolean` instead of the `Boolean` 
wrapper to avoid potential null unboxing issues and reduce overhead.
   ```suggestion
                       boolean createFullClone = 
Boolean.TRUE.equals(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.CREATE_FULL_CLONE));
   ```



##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -1315,14 +1317,22 @@ public KVMPhysicalDisk 
createDiskFromTemplate(KVMPhysicalDisk template,
                         
passphraseObjects.add(QemuObject.prepareSecretForQemuImg(format, 
QemuObject.EncryptFormat.LUKS, keyFile.toString(), "sec0", options));
                         
disk.setQemuEncryptFormat(QemuObject.EncryptFormat.LUKS);
                     }
+
+                    QemuImgFile srcFile = new QemuImgFile(template.getPath(), 
template.getFormat());
+                    Boolean createFullClone = 
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.CREATE_FULL_CLONE);

Review Comment:
   Reading the agent properties on each disk creation may incur unnecessary 
overhead; consider caching the CREATE_FULL_CLONE value or loading it once at 
adaptor initialization.
   ```suggestion
   
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to