rafaelweingartner commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181783355
 
 

 ##########
 File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ##########
 @@ -2337,8 +2337,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) 
{
                     
disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
                 }
             }
-
-            vm.getDevices().addDevice(disk);
+            if (vm.getDevices() != null) {
 
 Review comment:
   I only mentioned an exception for a single reason. Right now the code works; 
and, if we ever get a null calling `vm.getDevices() `, a run time exception 
will be thrown, and we will be able to easily pin point the problem. However, 
after applying your code, for sure something else will break or not work as 
expected, which will make more difficult for us to pin point the problem later 
(if it ever happens). 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to