apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.06k stars 1.1k forks source link

Template: no usable volumes found for VM #5250

Closed tampler closed 3 years ago

tampler commented 3 years ago
ISSUE TYPE
COMPONENT NAME
Management, Template
CLOUDSTACK VERSION
4.15.1
CONFIGURATION

KVM Hypervisor Basic Zone Storage: virtio

OS / ENVIRONMENT

Ubuntu 20.04.2

SUMMARY

I was trying to create an instance from template and failed with:

"jobresult": {
    "errorcode": 530,
    "errortext": "Unable to create deployment, no usable volumes found for the VM: 22"
  },
STEPS TO REPRODUCE
  1. Create a proper instance in VirtManager GUI with QEMU + KVM
  2. Use virtio 10GB drive for storage
  3. Shut down the VM
  4. file image.qcow2 - QEMU QCOW2 Image (v3), 10737418240 bytes
  5. Create a template from this qcow2 image in CloudStack
  6. Verify template status after installation log
  7. Create an instance from template
  8. Got error message error
  9. I indeed do NOT see any volumes in GUI, but I expect CloudStack to create a volume and instance for my template
  10. VM description is here
EXPECTED RESULTS
A new instance and volumes are successfully created from the template
ACTUAL RESULTS
503 - no usable volumes found for the VM
DaanHoogland commented 3 years ago

The management server cannot find a suitable pool (primary) to deploy your VM on @tampler . The message is a bit misleading but the stackttrace tells you:

com.cloud.utils.exception.CloudRuntimeException: Unable to create deployment, no usable volumes found for the VM: 22
    at com.cloud.deploy.DeploymentPlanningManagerImpl.findSuitablePoolsForVolumes(DeploymentPlanningManagerImpl.java:1470)
    at com.cloud.deploy.DeploymentPlanningManagerImpl.checkClustersforDestination(DeploymentPlanningManagerImpl.java:1126)
    at com.cloud.deploy.DeploymentPlanningManagerImpl.planDeployment(DeploymentPlanningManagerImpl.java:530)
    at org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl.reserveVirtualMachine(VMEntityManagerImpl.java:203)
    at org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl.reserve(VirtualMachineEntityImpl.java:202)
    at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:4929)
    at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:2901)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
tampler commented 3 years ago

@DaanHoogland Okay, and what do I do? I have only a QCOW2 image, which I created on my local machine and can easily run it locally.

Shouldn't volumes be created automatically, when I launch an instance from the QCOW2 template? My instance should use the VM template ROOT system Plus I added an extra volume to it

Note, that CloudStack creates a volume for a new instance automatically, when I use my ISO. I'd expect to have the same functionality when creating an instance for a QCOW2 template.

slavkap commented 3 years ago

@tampler, when you deploy a VM from a template CS creates a volume automatically. I saw the log with the error but it doesn't match the steps you have mention:

  • Create an instance from template

  • Got error message error

the error in the log says that you're trying to start a VM, but what happened with the failed deployment has to be in another log

And you can't run a VM in error state from your VM description "state": "Error"

DaanHoogland commented 3 years ago

@tampler in that stacktrace the first line is at com.cloud.deploy.DeploymentPlanningManagerImpl.findSuitablePoolsForVolumes(DeploymentPlanningManagerImpl.java:1470), the message is thrown because there is no primary storage pool that contains the image, not because there is no image. @slavkap is probably right when she says that the deployment failed.

nvazquez commented 3 years ago

Hi @tampler, as @slavkap pointed out the logs you have shared belong to a startVirtualMachine API:

2021-07-28 18:01:29,789 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (qtp2109798150-519:ctx-148bd1aa ctx-5832b23b) (logid:269f731d) submit async job-130, details: AsyncJobVO {id:130, userId: 2, accountId: 2, instanceType: VirtualMachine, instanceId: 22, cmd: org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin, cmdInfo: {"response":"json","ctxUserId":"2","sessionkey":"jOX8IVV7LOmU0usFaOqhWjjyWUA","httpmethod":"GET","ctxStartEventId":"348","id":"efb8bc53-a7bc-4f5f-88a7-76315b37bff9","ctxDetails":"{\"interface com.cloud.vm.VirtualMachine\":\"efb8bc53-a7bc-4f5f-88a7-76315b37bff9\"}","ctxAccountId":"2","uuid":"efb8bc53-a7bc-4f5f-88a7-76315b37bff9","cmdEventType":"VM.START"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 279278805452959, completeMsid: null, lastUpdated: null, lastPolled: null, created: null, removed: null}
2021-07-28 18:01:29,790 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-19:ctx-0cbc44bc job-130) (logid:08d468e0) Executing AsyncJobVO {id:130, userId: 2, accountId: 2, instanceType: VirtualMachine, instanceId: 22, cmd: org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin, cmdInfo: {"response":"json","ctxUserId":"2","sessionkey":"jOX8IVV7LOmU0usFaOqhWjjyWUA","httpmethod":"GET","ctxStartEventId":"348","id":"efb8bc53-a7bc-4f5f-88a7-76315b37bff9","ctxDetails":"{\"interface com.cloud.vm.VirtualMachine\":\"efb8bc53-a7bc-4f5f-88a7-76315b37bff9\"}","ctxAccountId":"2","uuid":"efb8bc53-a7bc-4f5f-88a7-76315b37bff9","cmdEventType":"VM.START"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 279278805452959, completeMsid: null, lastUpdated: null, lastPolled: null, created: null, removed: null}

Can you please repeat the deployment of a new VM from the template and share the logs for the deployVirtualMachine API?

tampler commented 3 years ago

This error was a result of SSVM misconfiguration. Before deploying VMs, make sure to have ssvm-check.sh running without errorrs