parameters: (self, label, task)
docstring: Start a virtual machine.
          @param label: vm uuid
          @param task: task object.
docstring_summary: Start a virtual machine.
docstring_tokens: Start a virtual machine .
function: def start(self, label, task):
          """Start a virtual machine.
          @param label: vm uuid
          @param task: task object.
          """
          vm_ref = self._get_vm_ref(label)
          vm = self._get_vm_record(vm_ref)
  
          if not self._is_halted(vm):
              raise CuckooMachineError("Vm is already running: %s", label)
  
          snapshot = self._snapshot_from_vm_uuid(label)
          if snapshot:
              snapshot_ref = self._get_vm_ref(snapshot)
              try:
                  log.debug("Reverting vm %s to snapshot %s", label, snapshot)
                  self.session.xenapi.VM.revert(snapshot_ref)
                  log.debug("Revert completed for vm %s", label)
              except XenAPI.Failure as e:
                  raise CuckooMachineError("Unable to revert vm %s: %s"
                                           % (label, e.details[0]))
  
              try:
                  log.debug("Resuming reverted vm %s", label)
                  self.session.xenapi.VM.resume(vm_ref, False, False)
              except XenAPI.Failure as e:
                  raise CuckooMachineError("Unable to resume vm %s: %s"
                                           % (label, e.details[0]))
          else:
              log.debug("No snapshot found for vm, booting: %s", label)
              try:
                  self.session.xenapi.VM.start(vm_ref, False, False)
              except XenAPI.Failure as e:
                  raise CuckooMachineError("Unable to start vm %s: %s"
                                           % (label, e.details[0]))
  
          log.debug("Started vm: %s", label)
function_tokens: def start ( self , label , task ) : vm_ref = self . _get_vm_ref ( label ) vm = self . _get_vm_record ( vm_ref ) if not self . _is_halted ( vm ) : raise CuckooMachineError ( "Vm is already running: %s" , label ) snapshot = self . _snapshot_from_vm_uuid ( label ) if snapshot : snapshot_ref = self . _get_vm_ref ( snapshot ) try : log . debug ( "Reverting vm %s to snapshot %s" , label , snapshot ) self . session . xenapi . VM . revert ( snapshot_ref ) log . debug ( "Revert completed for vm %s" , label ) except XenAPI . Failure as e : raise CuckooMachineError ( "Unable to revert vm %s: %s" % ( label , e . details [ 0 ] ) ) try : log . debug ( "Resuming reverted vm %s" , label ) self . session . xenapi . VM . resume ( vm_ref , False , False ) except XenAPI . Failure as e : raise CuckooMachineError ( "Unable to resume vm %s: %s" % ( label , e . details [ 0 ] ) ) else : log . debug ( "No snapshot found for vm, booting: %s" , label ) try : self . session . xenapi . VM . start ( vm_ref , False , False ) except XenAPI . Failure as e : raise CuckooMachineError ( "Unable to start vm %s: %s" % ( label , e . details [ 0 ] ) ) log . debug ( "Started vm: %s" , label )