Deploy vm (vcenter) failed somtimes

When i`ll try to deploy a VM something it will failed.

Tue Mar 24 14:16:49 2020 [Z0][VM][I]: New state is ACTIVE
Tue Mar 24 14:16:49 2020 [Z0][VM][I]: New LCM state is PROLOG
Tue Mar 24 14:16:49 2020 [Z0][VM][I]: New LCM state is BOOT
Tue Mar 24 14:16:49 2020 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/115/deployment.0
Tue Mar 24 14:16:49 2020 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Tue Mar 24 14:16:49 2020 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue Mar 24 14:16:58 2020 [Z0][VMM][I]: Command execution failed (exit code: 255): /var/lib/one/remotes/vmm/vcenter/deploy '/var/lib/one/vms/115/deployment.0' 'VCENTERCLUSTER' 115 VCENTERCLUSTER
Tue Mar 24 14:16:58 2020 [Z0][VMM][E]: deploy: Deploy of VM 115 on vCenter cluster VCENTERCLUSTER with /var/lib/one/vms/115/deployment.0 failed due to "NoPermission: "on attempt #0.
Tue Mar 24 14:16:58 2020 [Z0][VMM][E]: deploy: Deploy of VM 115 on vCenter cluster VCENTERCLUSTER with /var/lib/one/vms/115/deployment.0 failed due to "Cannot clone VM Template to StoragePod: Cannot clone VM Template: NoPermission:
Tue Mar 24 14:16:58 2020 [Z0][VMM][I]: ["/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:198:in `_get_property'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:35:in `block (2 levels) in init'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/Task.rb:6:in `block in wait_for_completion'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:19:in `block in wait_until'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:16:in `loop'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:16:in `wait_until'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/Task.rb:6:in `wait_for_completion'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:490:in `storagepod_clonevm_task'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:412:in `clone_vm'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2444:in `block in new_from_clone'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2443:in `tap'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2443:in `new_from_clone'", "/var/lib/one/remotes/vmm/vcenter/deploy:65:in `<main>'"]"on attempt #1.
Tue Mar 24 14:16:58 2020 [Z0][VMM][E]: deploy: Deploy of VM 115 on vCenter cluster VCENTERCLUSTER with /var/lib/one/vms/115/deployment.0 failed due to "Cannot clone VM Template to StoragePod: Cannot clone VM Template: NoPermission:
Tue Mar 24 14:16:58 2020 [Z0][VMM][I]: ["/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:198:in `_get_property'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:35:in `block (2 levels) in init'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/Task.rb:6:in `block in wait_for_completion'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:19:in `block in wait_until'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:16:in `loop'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/ManagedObject.rb:16:in `wait_until'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/vim/Task.rb:6:in `wait_for_completion'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:490:in `storagepod_clonevm_task'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:412:in `clone_vm'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2444:in `block in new_from_clone'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2443:in `tap'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:2443:in `new_from_clone'", "/var/lib/one/remotes/vmm/vcenter/deploy:65:in `<main>'"]"on attempt #2.
Tue Mar 24 14:16:58 2020 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Tue Mar 24 14:16:58 2020 [Z0][VMM][E]: Error deploying virtual machine
Tue Mar 24 14:16:58 2020 [Z0][VM][I]: New LCM state is BOOT_FAILURE

When looking at vcenter i`ll get this message this looks like a attempt.

Apply Storage DRS recommendations
Status:
The name 'one-115-123Test' already exists.

And the VM is created. I`ll can do recover from opennebula with status success. Everythings looks fine at that moment.

But if i`ll wait and try again. It will succeed.

Tue Mar 24 14:29:22 2020 [Z0][VM][I]: New state is ACTIVE
Tue Mar 24 14:29:22 2020 [Z0][VM][I]: New LCM state is PROLOG
Tue Mar 24 14:29:22 2020 [Z0][VM][I]: New LCM state is BOOT
Tue Mar 24 14:29:22 2020 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/116/deployment.0
Tue Mar 24 14:29:22 2020 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Tue Mar 24 14:29:22 2020 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue Mar 24 14:29:41 2020 [Z0][VMM][I]: Successfully execute virtualization driver operation: deploy.
Tue Mar 24 14:29:41 2020 [Z0][VMM][I]: Successfully execute network driver operation: post.
Tue Mar 24 14:29:41 2020 [Z0][VM][I]: New LCM state is RUNNING

It looks like a timing issue or something. Can someone help me with this?

which version are you using?
Have you checked your vcenter permissions? Here is an error about that: failed due to "NoPermission: "

THanks i didn’t know where the NoPermission came from. That wasn’t clear to me.
I`ll give the user more permissions from Administrator DC level to VC level. Maybe this will help.

But that doesn’t explain why sometimes the deploy works.

Which Opennebula versions are you using?

Sorry…
opennebula 5.10.1-1

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

Try to update to the latest version. Rbvmomi ( Ruby for vcenter ) was changed and some changes deploying vms was done