rafaelweingartner commented on a change in pull request #2518: 
CLOUDSTACK-10348: Don't specify cache mode for empty cdrom device
URL: https://github.com/apache/cloudstack/pull/2518#discussion_r178522730
 
 

 ##########
 File path: 
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
 ##########
 @@ -819,8 +819,12 @@ public String toString() {
             diskBuilder.append(" type='" + _diskType + "'");
             diskBuilder.append(">\n");
             if(qemuDriver) {
-                diskBuilder.append("<driver name='qemu'" + " type='" + 
_diskFmtType
-                        + "' cache='" + _diskCacheMode + "' ");
+                if (_deviceType == DeviceType.CDROM && _sourcePath == null) {
 
 Review comment:
   What about extracting this bit of code that appends the disk information to 
a XML to a method called? Then, it is possible to further document it (when the 
cache mode is used and why it is not used sometimes), and of course it would 
enable us to unit test this logic of creating the disk entry.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to