def run_instances(self, parameters, secret):
    parameters, secret = self.__validate_args(parameters, secret)

    utils.log('Received a request to run instances.')

    if self.secret != secret:
      utils.log('Incoming secret {0} does not match the current secret {1} - '\
                'Rejecting request.'.format(secret, self.secret))
      return self.__generate_response(False, self.REASON_BAD_SECRET)

    for param in self.RUN_INSTANCES_REQUIRED_PARAMS:
      if not utils.has_parameter(param, parameters):
        return self.__generate_response(False, 'no ' + param)

    num_vms = int(parameters[self.PARAM_NUM_VMS])
    if num_vms <= 0:
      utils.log('Invalid VM count: {0}'.format(num_vms))
      return self.__generate_response(False, self.REASON_BAD_VM_COUNT)

    infrastructure = parameters[self.PARAM_INFRASTRUCTURE]
    agent = self.agent_factory.create_agent(infrastructure)
    try:
      agent.assert_required_parameters(parameters, BaseAgent.OPERATION_RUN)
    except AgentConfigurationException as exception:
      return self.__generate_response(False, str(exception))

    reservation_id = utils.get_random_alphanumeric()
    status_info = {
      'success': True,
      'reason': 'received run request',
      'state': self.STATE_PENDING,
      'vm_info': None
    }
    self.reservations.put(reservation_id, status_info)
    utils.log('Generated reservation id {0} for this request.'.format(
      reservation_id))
    try:
      if self.blocking:
        self.__spawn_vms(agent, num_vms, parameters, reservation_id)
      else:
        thread.start_new_thread(self.__spawn_vms,
          (agent, num_vms, parameters, reservation_id))
    except AgentConfigurationException as exception:
      status_info = {
        'success' : False,
        'reason' : str(exception),
        'state' : self.STATE_FAILED,
        'vm_info' : None
      }
      self.reservations.put(reservation_id, status_info)
      utils.log('Updated reservation id {0} with failed status because: {1}' \
        .format(reservation_id, str(exception)))

    utils.log('Successfully started request {0}.'.format(reservation_id))
    return self.__generate_response(True,
      self.REASON_NONE, {'reservation_id': reservation_id})
Create new subdispatcher and register all public object methods on
dataset/ETHPy150Open AppScale/appscale/InfrastructureManager/infrastructure_manager.py/InfrastructureManager.run_instances--crossover with--dataset/ETHPy150Open mbr/tinyrpc/tinyrpc/dispatch/__init__.py/RPCDispatcher.register_instance