Skip to content

NPE migrating volume to non-created storage pool #11505

Closed

Description

@BartJM

problem

When migrating a volume to a storage pool that is not created on the hypervisor it will cause a NullPointerException.

2025-08-25 10:44:18,239 DEBUG [kvm.storage.LibvirtStorageAdaptor] (agentRequest-Handler-7:null) (logid:3570ae3f) Attempting to create storage pool 2fe96505-06a5-3ae7-a97b-483da5425fd1
2025-08-25 10:44:18,242 WARN  [cloud.agent.Agent] (agentRequest-Handler-7:null) (logid:3570ae3f) Caught: 
java.lang.NullPointerException
        at com.cloud.hypervisor.kvm.storage.LibvirtStorageAdaptor.createRBDStoragePool(LibvirtStorageAdaptor.java:422)
        at com.cloud.hypervisor.kvm.storage.LibvirtStorageAdaptor.createStoragePool(LibvirtStorageAdaptor.java:774)
        at com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager.createStoragePool(KVMStoragePoolManager.java:365)
        at com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager.createStoragePool(KVMStoragePoolManager.java:352)
        at com.cloud.hypervisor.kvm.storage.KVMStorageProcessor.copyVolumeFromImageCacheToPrimary(KVMStorageProcessor.java:509)
        at com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.execute(StorageSubsystemCommandHandlerBase.java:110)
        at com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.handleStorageCommands(StorageSubsystemCommandHandlerBase.java:64)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStorageSubSystemCommandWrapper.execute(LibvirtStorageSubSystemCommandWrapper.java:36)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStorageSubSystemCommandWrapper.execute(LibvirtStorageSubSystemCommandWrapper.java:30)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper.execute(LibvirtRequestWrapper.java:78)
        at com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.executeRequest(LibvirtComputingResource.java:1934)
        at com.cloud.agent.Agent.processRequest(Agent.java:683)
        at com.cloud.agent.Agent$AgentRequestHandler.doTask(Agent.java:1106)
        at com.cloud.utils.nio.Task.call(Task.java:83)
        at com.cloud.utils.nio.Task.call(Task.java:29)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

Cause seems to be in com.cloud.hypervisor.kvm.storage.KVMStorageProcessor.copyVolumeFromImageCacheToPrimary(KVMStorageProcessor.java:509) where the userinfo is set to null.

versions

KVM
CS 4.19.3

The steps to reproduce the bug

  1. Create volume
  2. Migrate volume to a new storage pool

Activity

  1. harikrishna-patnala commented on Sep 1, 2025

    @harikrishna-patnala
    Member

    @BartJM can you please help us in some more detailed steps to reproduce, how you had the situation of a storage pool that is not created on the hypervisor

  2. BartJM commented on Sep 1, 2025

    @BartJM
    ContributorAuthor

    The situation where a storage pool was not created on the hypervisor occurred after we enabled a storage pool that was not yet in use but had been added to cloudstack and disabled.
    Cloudstack did not create this storage pool in libvirt on the hypervisors when it was disabled or after enabling the storage pool.
    When running a migration of a volume to the storage pool Cloudstack will attempt to create it but this failes with the error in my original comment.

    Would need to check if I can attempt to reproduce in a test environment for better steps, but the steps taken were:

    1. Create ceph storage pool
    2. Disable ceph storage pool pending taking the cluster in production. (in our case around a month or two)
    3. Enable the storage pool
    4. Migrate a volume to the storage pool

    After a restart of the Cloudstack agent the storage pool is created in libvirt without issue and migrating works.

  3. harikrishna-patnala commented on Sep 2, 2025

    @harikrishna-patnala
    Member

    @BartJM I think that sort of storagepool has to be set in maintenance mode and not in disable state. Can you please try putting that storagepool in maintenance mode and cancelling the maintenance mode will prepare the storage pool in MS in better way ? Ideally I also feel that storagepool should not be added if it is not ready to use.

  4. locked and limited conversation to collaborators on Sep 18, 2025
  5. converted this issue into a discussion #11669 on Sep 18, 2025
  6. added this to the unplanned milestone on Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions