def create_instance(name, img, machineType, disk, start, attempts)
      #add a new instance of the image
      instance = execute( instance_insert_req( name, img['selfLink'], machineType['selfLink'], disk['selfLink'] ), start, attempts)
      status = ''
      try = (Time.now - start) / SLEEPWAIT
      while status !~ /RUNNING/ and try <= attempts
        begin
          instance = execute( instance_get_req( name ), start, attempts )
          status = instance['status']
        rescue GoogleComputeError => e
          @logger.debug("Waiting for #{name} instance creation")
          sleep(SLEEPWAIT)
        end
        try += 1
      end
      if status == ''
        raise "Unable to create instance #{name}"
      end
      instance
    end
def create_instance(name, img, machineType, disk, start, attempts)
      #add a new instance of the image
      instance = execute( instance_insert_req( name, img['selfLink'], machineType['selfLink'], disk['selfLink'] ), start, attempts)
      status = ''
      try = (Time.now - start) / SLEEPWAIT
      while status !~ /RUNNING/ and try <= attempts
        begin
          instance = execute( instance_get_req( name ), start, attempts )
          status = instance['status']
        rescue GoogleComputeError => e
          @logger.debug("Waiting for #{name} instance creation")
          sleep(SLEEPWAIT)
        end
        try += 1
      end
      if status == ''
        raise "Unable to create instance #{name}"
      end
      instance
    end
Create a Google Compute instance on the current connection

 @param [String] name The name of the instance to create

 @param [Hash] img The Google Compute image to use for instance creation

 @param [Hash] machineType The Google Compute machineType

 @param [Hash] disk The Google Compute disk to attach to the newly created
 instance

 @param [Integer] start The time when we started code execution, it is
 compared to Time.now to determine how many further code execution
 attempts remain

 @param [Integer] attempts The total amount of attempts to execute that we
 are willing to allow

 @raise [Exception] Raised if we fail create the instance, either through
 errors or running out of attempts