Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-6934

NPE at VolumeOrchestrator.java:868 during vm expunge when vm has volumes in Allocated state (not created on storage yet)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.4.0
    • 4.5.0
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      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.

      Attachments

        Activity

          People

            alena1108 Alena Prokharchyk
            alena1108 Alena Prokharchyk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: