Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_wait_time for ready_image => wait_until_image is hard coded to 10 minutes #188

Open
hh opened this issue Jun 7, 2016 · 2 comments
Open

Comments

@hh
Copy link
Contributor

hh commented Jun 7, 2016

We should increase it to 60 minutes until we have a reasonable way to set it to something higher via the machine_image resource. Currently on Rackspace Private Cloud backended with CloudFiles for image storage, even 40gb images can take 35-45 minutes.

Here is the hardcoding in https://github.com/chef/chef-provisioning-fog/blob/master/lib/chef/provisioning/fog_driver/providers/openstack.rb:

      def wait_until_image(action_handler, image_spec, image=nil, &block)
        image ||= image_for(image_spec)
        time_elapsed = 0
        sleep_time = 10
        max_wait_time = 300

And here is the call chain:

      def ready_image(action_handler, image_spec, image_options)
        actual_image = image_for(image_spec)
        if actual_image.nil?
          raise 'Cannot ready an image that does not exist'
        else
          if actual_image.status != 'ACTIVE'
            action_handler.report_progress 'Waiting for image to be active ...'
            wait_until_ready_image(action_handler, image_spec, actual_image)
          else
            action_handler.report_progress "Image #{image_spec.name} is active!"
          end
        end
      end

      def wait_until_ready_image(action_handler, image_spec, image=nil)
        wait_until_image(action_handler, image_spec, image) { image.status == 'ACTIVE' }
      end

      def wait_until_image(action_handler, image_spec, image=nil, &block)
        image ||= image_for(image_spec)
        time_elapsed = 0
        sleep_time = 10
        max_wait_time = 300
        if !yield(image)
          action_handler.report_progress "waiting for image #{image_spec.name} (#{image.id} on #{driver_url}) to be active ..."
          while time_elapsed < max_wait_time && !yield(image)
           action_handler.report_progress "been waiting #{time_elapsed}/#{max_wait_time} -- sleeping #{sleep_time} seconds for image #{image_spec.name} (#{image.id} on #{driver_url}) to be ACTIVE instead of #{image.status}..."
           sleep(sleep_time)
           image.reload
           time_elapsed += sleep_time
          end
          unless yield(image)
            raise "Image #{image.id} did not become ready within #{max_wait_time} seconds"
          end
          action_handler.report_progress "Image #{image_spec.name} is now ready"
        end
      end
hh added a commit to hh/chef-provisioning-fog that referenced this issue Jun 7, 2016
Temporary hard code to an  hour for chef-boneyard#188.
Eventually would like to make configurable via machine_image resource option.
@jjasghar
Copy link
Contributor

jjasghar commented Jun 7, 2016

@hh maybe make that an option you can manipulate? Have it default to 10 mins but then allow you to bump if needed?

@hh
Copy link
Contributor Author

hh commented Jun 17, 2016

Would probably be fine as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants