Handle multiple instances with spot request #787

wants to merge 5 commits into


None yet

2 participants

rwjblue commented Mar 9, 2012

Previously (current HEAD) you could instantiate many spot requests by using instance_count, but only the first was added to the SpotRequests collection and returned.

This pull request updates Fog::Compute::AWS::SpotRequest#save so that it initializes and adds all newly created spot requests to the Fog::Compute::AWS::SpotRequests collection. If instance_count is 1 (which is the default) it returns the generated spot_request. If instance_count is greater than 1 it will return an array of the newly created spot requests.

(Please note: this does not change the result of spot_requests.create because Fog::Collection#create automatically returns the object created when SpotRequest.new is called (not the result of SpotRequest#save).

This pull request also updates Fog::Compute::AWS::SpotRequests#bootstrap to allow it to bootstrap multiple servers at once if instance_count is more than one. Fog::Compute::AWS::SpotRequests#bootstrap will then return an array of Fog::Compute::AWS::Server objects (when instance_count == 1) or it will return the first Fog::Compute::AWS::Server (when instance_count == 1).

I do not see any tests specific to Fog::Compute::AWS::SpotRequests or Fog::Compute::AWS::SpotRequest, but I certainly can try to add some testing with a bit of direction.

In the default case of instance_count == 1 both Fog::Compute::AWS::SpotRequests#bootstrap and Fog::Compute::AWS::SpotRequest#save return the same value as current HEAD.

geemus commented Mar 13, 2012

@rjackson thanks for this. I think we should add some more testing as well though. Probably should go in fog/tests/aws/models/compute. Not sure how/why we ended up in a state where there don't appear to be any tests for spot stuff, but if you could add some there that would be awesome. Thanks!

Robert Jackson Merge branch 'master' of git://github.com/fog/fog into handle_multipl…
@rwjblue rwjblue closed this Jun 14, 2013
geemus commented Jun 14, 2013

@rjackson - sorry this got misplaced. Anything we should still do related to this? Thanks!

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