Alena Prokharchyk created CLOUDSTACK-6934:
---------------------------------------------

             Summary: NPE at VolumeOrchestrator.java:868 during vm expunge when 
vm has volumes in Allocated state (not created on storage yet)
                 Key: CLOUDSTACK-6934
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6934
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
    Affects Versions: 4.4.0
            Reporter: Alena Prokharchyk
            Assignee: Alena Prokharchyk
             Fix For: 4.5.0


Steps to reproduce:
1) Deploy 2 vms; VM2 should be deployed with startVm=false option.
2) Stop VM1. Detach the Root disks from VM1 and VM2; attach the root disk of 
VM2 to VM1.
3) Try to expunge the VM1 now. NPE happens on 

INFO  [o.a.c.f.j.i.AsyncJobMonitor] (Work-Job-Executor-2:ctx-228bd156 
job-890/job-892) Remove job-892 from job monitoring
WARN  [c.c.v.UserVmManagerImpl] (UserVm-Scavenger-1:ctx-d72384e8) Unable to 
expunge VM[User|i-2-24-st]
java.lang.NullPointerException
        at 
org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.disconnectVolumesFromHost(VolumeOrchestrator.java:868)
        at 
com.cloud.vm.VirtualMachineManagerImpl.advanceExpunge(VirtualMachineManagerImpl.java:528)
        at 
com.cloud.vm.VirtualMachineManagerImpl.advanceExpunge(VirtualMachineManagerImpl.java:464)
        at com.cloud.vm.UserVmManagerImpl.expunge(UserVmManagerImpl.java:1670)
        at com.cloud.vm.UserVmManagerImpl.expungeVm(UserVmManagerImpl.java:3691)

NPE happens because in the code we assume that when VM has not null 
hostId/lastHostId (indicating it had been running at some point), then its 
volumes should have not null storagepoolId. This assumption is incorrect, and 
we should check storagePoolId of the volume first before attempting to 
disconnect it from the host.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to