Skip to content

Maintenance mode destination nullpointer with local storage data disk #9887

Open
@BartJM

Description

@BartJM
ISSUE TYPE
  • Bug Report
COMPONENT NAME
Maintenance Mode
CLOUDSTACK VERSION
4.19.1.2
CONFIGURATION
host.maintenance.local.storage.strategy: Migration
OS / ENVIRONMENT
SUMMARY

Nullpointer exception when setting a host in maintenance if the host has a running vm with a local storage data disk.

Found the bug while fixing another bug where the host going into maintenance is not avoided so maintenance for local storage vms can fail.
During testing I did not find a path in the current version to reach the breaking code without a debugger attached.

Bug is caused by the deployment returning null causing a nullpointer in

Deployment returns null as the only suitable storage pool returned by findSuitablePoolsForVolumes in server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java for the data disk is the host the data disk is located on. (Only applies for data disk, for a local storage root disk all suitable storage pools are evaluated). With that host being avoided to prepare it for maintenance the deployment planner has no suitable hosts returning null.

Migrating the vm using the ui does not cause issues.

STEPS TO REPRODUCE
EXPECTED RESULTS

VM migrated and host going into maintenance

ACTUAL RESULTS
2024-11-01 16:04:39,428 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-5:ctx-b739d4ae job-371) (logid:51494050) Unexpected exception while executing org.apache.cloudstack.api.command.
admin.host.PrepareForMaintenanceCmd
java.lang.NullPointerException
        at com.cloud.resource.ResourceManagerImpl.migrateAwayVmWithVolumes(ResourceManagerImpl.java:1471)
        at com.cloud.resource.ResourceManagerImpl.doMaintain(ResourceManagerImpl.java:1403)
        at com.cloud.resource.ResourceManagerImpl.maintain(ResourceManagerImpl.java:1489)
        at com.cloud.resource.ResourceManagerImpl.maintain(ResourceManagerImpl.java:1543)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at com.sun.proxy.$Proxy200.maintain(Unknown Source)
        at org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd.execute(PrepareForMaintenanceCmd.java:101)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
        at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
        at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
        at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:602)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions