This is to avoid problems with newly created instances.
GoGrid does not assign a real ID number to an instance
until it has gone through some backend initialization.
That means trying to look up an instance by ID that you
just created will fail, which is pretty non-intuitive
behavior.  Fix this by using the name as the ID, which
probably should be unique enough for our purposes.

Signed-off-by: Chris Lalancette <[email protected]>
---
 .../lib/deltacloud/drivers/gogrid/gogrid_driver.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb 
b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
index cbd39ce..ff46fab 100644
--- a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+++ b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
@@ -256,7 +256,11 @@ class GogridDriver < Deltacloud::BaseDriver
     hwp_name = instance['image']['name']
 
     Instance.new(
-      :id => instance['id'],
+       # note that we use 'name' as the id here, because newly created 
instances
+       # don't get a real ID until later on.  The name is good enough; from
+       # what I can tell, 'name' per user is unique, so it should be sufficient
+       # to uniquely identify this instance.
+      :id => instance['name'],
       :owner_id => owner_id,
       :image_id => instance['image']['id'],
       :instance_profile => InstanceProfile.new(hwp_name),
-- 
1.6.6.1

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to