Github user GabrielBrascher commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1406#discussion_r52851113
  
    --- Diff: 
engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
 ---
    @@ -350,6 +359,24 @@ public EndPoint select(DataObject object, 
StorageAction action) {
                         }
                     }
                 }
    +
    +            //Handle case where the volume is a volume of an expunging 
system VM and there are
    +            //no other system VMs existing in the zone.
    +            if (vm != null) {
    +                VirtualMachine.Type type = 
volume.getAttachedVM().getType();
    +                if ((type == VirtualMachine.Type.SecondaryStorageVm || 
type == VirtualMachine.Type.ConsoleProxy) &&
    +                        (vm.getState() == State.Expunging || vm.getState() 
== State.Destroyed)) {
    +
    +                    List<SecondaryStorageVmVO> ssvms = 
ssvmDao.listByZoneId(Role.templateProcessor, volume.getDataCenterId());
    +                    if (ssvms == null || ssvms.isEmpty()) {
    --- End diff --
    
    @ProjectMoon As a sujestion, this conditional (ssvms == null || 
ssvms.isEmpty()) can be done using the Apache CollectionUtils.isEmpty method 
(http://commons.apache.org/proper/commons-collections/javadocs/api-release/org/apache/commons/collections4/CollectionUtils.html#isEmpty%28java.util.Collection%29).
 It is a null safe verification if the List is empty.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to