Getting error while deploying VM in vcenter

Tue May 30 17:14:05 2017 [Z0][VM][I]: New state is ACTIVE
Tue May 30 17:14:05 2017 [Z0][VM][I]: New LCM state is PROLOG
Tue May 30 17:14:05 2017 [Z0][VM][I]: New LCM state is BOOT
Tue May 30 17:14:05 2017 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/40/deployment.0
Tue May 30 17:14:05 2017 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue May 30 17:14:06 2017 [Z0][VMM][I]: Command execution fail: /var/lib/one/remotes/vmm/vcenter/deploy ‘/var/lib/one/vms/40/deployment.0’ ‘VMcluster’ 40 VMcluster
Tue May 30 17:14:06 2017 [Z0][VMM][I]: /usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/type_loader.rb:66: warning: already initialized constant RbVmomi::VIM::Datastore
Tue May 30 17:14:06 2017 [Z0][VMM][I]: /usr/lib/one/ruby/vcenter_driver.rb:50: warning: previous definition of Datastore was here
Tue May 30 17:14:06 2017 [Z0][VMM][I]: Deploy of VM 40 on host VMcluster with /var/lib/one/vms/40/deployment.0 failed due to "Cannot clone VM Template: undefined method `parent’ for nil:NilClass"
Tue May 30 17:14:06 2017 [Z0][VMM][I]: ExitCode: 255
Tue May 30 17:14:06 2017 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Tue May 30 17:14:06 2017 [Z0][VMM][E]: Error deploying virtual machine
Tue May 30 17:14:06 2017 [Z0][VM][I]: New LCM state is BOOT_FAILURE

Hi Amit!
following the code, the possible reason for that error is that OpenNebula can’t find the template in vCenter. Could you answer the following questions so we have more info about this issue?

What OpenNebula version are you using?

Have you created your own OpenNebula template or have you imported a vCenter template using the import tool (either Sunstone or the onevcenter tool) as explained here?

Can you check if the template has the attributes VM_TEMPLATE or the VCENTER_REF inside the PUBLIC_CLOUD section? Could you post a screenshot of the output of the following commands?:

  • onetemplate show TEMPLATE_ID -x where TEMPLATE_ID is the ID of your template in OpenNebula
  • onevm show 40 -x

Cheers!