I don’t know if this is a bug with the vCenter driver, but what I’m seen when I initiate a delete from command line, or Sunstone UI is that the VM that I delete gets purged from OpenNebula, but the VM is still in vCenter.
Below is the section of the log, I grabbed:
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:5280 UID:0 VirtualMachineAction invoked , "delete", 527
Sun Oct 25 22:31:04 2015 [Z0][DiM][D]: Finalizing VM 527
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:5280 UID:0 VirtualMachineAction result SUCCESS, 527
Sun Oct 25 22:31:04 2015 [Z0][VMM][D]: Message received: LOG I 527 Driver command for 527 cancelled
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:2688 UID:0 VirtualMachineInfo invoked , 527
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:2688 UID:0 VirtualMachineInfo result SUCCESS, "<VM><ID>527</ID><UID..."
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:1200 UID:0 HostPoolInfo invoked
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:1200 UID:0 HostPoolInfo result SUCCESS, "<HOST_POOL><HOST><ID..."
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:2192 UID:0 SystemConfig invoked
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:2192 UID:0 SystemConfig result SUCCESS, "<TEMPLATE><AUTH_MAD>..."
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:7952 UID:0 HostInfo invoked , 2
Sun Oct 25 22:31:04 2015 [Z0][ReM][D]: Req:7952 UID:0 HostInfo result SUCCESS, "<HOST><ID>2</ID><NAM..."
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 526 Successfully execute virtualization driver operation: cancel.
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 526 Successfully execute network driver operation: clean.
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: CLEANUP SUCCESS 526
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 527 Command execution fail: /var/lib/one/remotes/vmm/vcenter/cancel '4221c123-b4c9-4fa7-e0b2-e25f1c0afaa5' 'SJCCLUSTER' 527 SJCCLUSTER
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 527 Cancel of VM 4221c123-b4c9-4fa7-e0b2-e25f1c0afaa5 on host SJCCLUSTER failed due to "uninitialized constant VCenterDriver::VIClient::ManagedObjectNotFound"
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 527 ExitCode: 255
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 527 Failed to execute virtualization driver operation: cancel.
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: LOG I 527 Successfully execute network driver operation: clean.
Sun Oct 25 22:31:05 2015 [Z0][VMM][D]: Message received: CLEANUP SUCCESS 527
In this case the object did exist and was available, but for some reason the vCenter driver could not find it. This happens on average 1 to 2 times for every 10 deletes, which means that by the end of a run that deletes about 180 VMs, I have over 20 to 30 VMs that did not get deleted.
Let me know if there is debug option I can turn on in OpenNebula so that I can experiment and test to get to the root cause.
We are trying to reproduce this problem without luck so far. We would like indeed more debug information. Assuming you are running OpenNebula 4.14.0, please replace file /var/lib/one/remotes/vmm/vcenter/cancel with this one:
First of all, I would like to state that DELETE is an admin operation, only indicated for situations where the VM is in a non recoverable state. For other scenarios, please use SHUTDOWN, since any failure will be reflected in OpenNebula (failures for DELETED would be painfully forgotten).
Having said that, we can certainly make this operation more resilient. I’ve opened a bug ticket to keep track of the solution: