def power_on_instance(session, instance, vm_ref=None):
 if (vm_ref is None):
  vm_ref = get_vm_ref(session, instance)
 LOG.debug('Powering on the VM', instance=instance)
 try:
  poweron_task = session._call_method(session.vim, 'PowerOnVM_Task', vm_ref)
  session._wait_for_task(poweron_task)
  LOG.debug('Powered on the VM', instance=instance)
 except vexc.InvalidPowerStateException:
  LOG.debug('VM already powered on', instance=instance)

def power_on_instance ( session , instance , vm_ref = None ) : if ( vm_ref is None ) : vm_ref = get_vm_ref ( session , instance ) LOG . debug ( 'Powering on the VM' , instance = instance ) try : poweron_task = session . _call_method ( session . vim , 'PowerOnVM_Task' , vm_ref ) session . _wait_for_task ( poweron_task ) LOG . debug ( 'Powered on the VM' , instance = instance ) except vexc . InvalidPowerStateException : LOG . debug ( 'VM already powered on' , instance = instance )
power on the specified instance .