VcEventType.VmPoweredOff, getMoRef(),
new IVcPseudoTaskBody () {
@Override
public ManagedObjectReference body() throws Exception {
VirtualMachine vm = getManagedObject();
vm.shutdownGuest(); // Initiates shutdown.
if (!waitForPowerOff(timeoutMillis)) {
throw VcException.GUEST_TIMEOUT();
}
return getMoRef();
}