[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15146782#comment-15146782
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9280:
--------------------------------------------

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.


> System VM volumes cannot be deleted when there are no system VMs
> ----------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9280
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9280
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.6.0, 4.7.0
>            Reporter: Jeff Hair
>
> Scenario: When deleting a zone, everything under it must be removed. This 
> results in the system VMs being destroyed as there are no more hosts running.
> The storage cleanup thread properly detects that there are volumes to be 
> deleted, but it cannot delete them because the endpoint selection fails with 
> "No remote endpoint to send DeleteCommand, check if host or ssvm is down?"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to