kiranchavala opened a new issue, #8634:
URL: https://github.com/apache/cloudstack/issues/8634

   **ISSUE TYPE**
   
   BUG 
   
   **COMPONENT NAME**
   
   Component: volume, storage
   
   **CLOUDSTACK VERSION**
   
   Cloudstack version 4.18, 4.19
   
   **SUMMARY**
   
   Unable to start virtual machine is root disk is detached and attached
   
   
   **Steps to reproduce the issue**
   
   1. Launch a virtual Machine 
   
   2. Stop the virtual Machine
   
   3. Detach the root disk of the virtual machine
   
   4. Attach the root disk back to the virtual machine
   
   5.  Start the virtual machine 
   
   6.  Virtual Machine fails to start 
   
   
   
   
   Logs and Db records
   
   
   Volume records after starting the vm
   
   
   ```
   mysql> select id,name,instance_id,volume_type from volumes  where id=3;
   +----+--------+-------------+-------------+
   | id | name   | instance_id | volume_type |
   +----+--------+-------------+-------------+
   |  3 | ROOT-3 |           3 | ROOT        |
   +----+--------+-------------+-------------+
   1 row in set (0.00 sec
   
   ```
   
   After detaching the root volume 
   
   ```
   mysql> select id,name,instance_id,volume_type from volumes  where id=3;
   +----+--------+-------------+-------------+
   | id | name   | instance_id | volume_type |
   +----+--------+-------------+-------------+
   |  3 | ROOT-3 |        NULL | DATADISK    |
   +----+--------+-------------+-------------+
   1 row in set (0.00 sec
   
   ```
   
   After attaching back to the instance
   
   The volume_type remains as Datadisk 
   
   ```
   mysql> select id,name,instance_id,volume_type from volumes  where id=3;
   +----+--------+-------------+-------------+
   | id | name   | instance_id | volume_type |
   +----+--------+-------------+-------------+
   |  3 | ROOT-3 |           3 | DATADISK    |
   +----+--------+-------------+-------------+
   1 row in set (0.00 sec)
   ```
   
   
   Logs when the Start vm fails 
   
   Screenshot 
   
   ![Screenshot 2024-02-09 at 10 20 59 
AM](https://github.com/apache/cloudstack/assets/1401014/2df43d4b-7e43-4d12-99b9-13c0085c68ec)
   
   
   
   ```
   2024-02-09 04:50:50,178 ERROR [c.c.a.ApiAsyncJobDispatcher] 
(API-Job-Executor-99:ctx-1a3d5d79 job-162) (logid:dabb906f) Unexpected 
exception while executing 
org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin
   com.cloud.utils.exception.CloudRuntimeException: Unable to prepare volumes 
for vm as ROOT volume is missing
           at 
com.cloud.deploy.DeploymentPlanningManagerImpl.findSuitablePoolsForVolumes(DeploymentPlanningManagerImpl.java:1640)
           at 
com.cloud.deploy.DeploymentPlanningManagerImpl.planDeployment(DeploymentPlanningManagerImpl.java:482)
           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:5433)
           at 
com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:5284)
           at 
com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3199)
           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.$Proxy187.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:641)
           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:589)
           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-02-09 04:50:50,181 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
(API-Job-Executor-99:ctx-1a3d5d79 job-162) (logid:dabb906f) Complete async 
job-162, jobStatus: FAILED, resultCode: 530, result: 
org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"530","errortext":"Unable
 to prepare volumes for vm as ROOT volume is missing"}
   
   ```
   
   The workaround is to update the database
   
   `mysql> update volumes set volume_type="Root" where id=3
   `
   
   
   **Actual Behaviour**
   
   Virtual Machine is failing to start 
   
   
   **Expected Behaviour**
   
   
   Virtual Machine should start without any issue.
   
   Cloudstack should update the volume_type to ROOT and start the virtual 
machine.
   
   
   Currently there is no option to update the volume_type of a volume 
   
   https://cloudstack.apache.org/api/apidocs-4.19/apis/updateVolume.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to