cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Start VM (with considerlasthost=true) failed with NPE when last host removed

Open sureshanaparti opened this issue 3 months ago • 0 comments

Start VM (with considerlasthost=true) failed with NPE when last host removed

ISSUE TYPE
  • Bug Report
COMPONENT NAME
VM
CLOUDSTACK VERSION
4.18.1.0 
CONFIGURATION

Advanced + KVM

OS / ENVIRONMENT
SUMMARY

Start VM (with considerlasthost=true) fails with NPE when last host removed.

2024-05-03 04:29:16,017 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46 ctx-d175b339) (logid:f3db126d) Trying to allocate a host and storage pools from dc:1, pod:1,cluster:1, requested cpu: 500, requested ram: (512.00 MB) 536870912
2024-05-03 04:29:16,017 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46 ctx-d175b339) (logid:f3db126d) Is ROOT volume READY (pool already allocated)?: Yes
2024-05-03 04:29:16,024 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46 ctx-d175b339) (logid:f3db126d) Deploy avoids pods: [], clusters: [], hosts: []
2024-05-03 04:29:16,024 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46 ctx-d175b339) (logid:f3db126d) Deploy hosts with priorities {} , hosts have NORMAL priority by default
2024-05-03 04:29:16,025 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46 ctx-d175b339) (logid:f3db126d) This VM has last host_id specified, trying to choose the same host: 3
2024-05-03 04:29:16,034 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-35:ctx-9d6f6a8f job-46) (logid:f3db126d) Unexpected exception while executing org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin
java.lang.NullPointerException
	at com.cloud.host.dao.HostDaoImpl.loadHostTags(HostDaoImpl.java:841)
	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 com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	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.$Proxy82.loadHostTags(Unknown Source)
	at com.cloud.deploy.DeploymentPlanningManagerImpl.planDeployment(DeploymentPlanningManagerImpl.java:418)
	at org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl.reserveVirtualMachine(VMEntityManagerImpl.java:206)
	at org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl.reserve(VirtualMachineEntityImpl.java:202)
	at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:5400)
	at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:5251)
	at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3179)
	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.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	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.$Proxy185.startVirtualMachine(Unknown Source)
	at org.apache.cloudstack.api.command.user.vm.StartVMCmd.execute(StartVMCmd.java:181)
	at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163)
	at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
	at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:620)
	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:568)
	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)
2024-05-03 04:29:16,039 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-35:ctx-9d6f6a8f job-46) (logid:f3db126d) Complete async job-46, jobStatus: FAILED, resultCode: 530, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530"}
STEPS TO REPRODUCE
  • Deploy a VM, say on Host1
  • Stop the VM
  • Remove Host1
  • Start the VM with considerlasthost=true

EXPECTED RESULTS
VM should start on other available hosts if last host doesn't exists, otherwise fail appropriately.
ACTUAL RESULTS
VM start fails with "Command failed due to Internal Server Error" and NPE noticed in logs.
VMStartIssue

sureshanaparti avatar May 03 '24 04:05 sureshanaparti