You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/12/05 18:06:20 UTC

[PATCH core 2/2] SBC: Make sure the hwp_id is not Nil when creating new instance (DTACLOUD-388)

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/sbc/sbc_driver.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/sbc/sbc_driver.rb b/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
index 2e09a15..c994064 100644
--- a/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
+++ b/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
@@ -87,7 +87,11 @@ class SbcDriver < Deltacloud::BaseDriver
     # Map DeltaCloud keywords to SBC
     body['imageID'] = opts[:image_id]
     body['location'] = opts[:realm_id] || @last_image['location']
-    body['instanceType'] = opts[:hwp_id].gsub('-', '/') || @last_image['supportedInstanceTypes'][0]['id']
+    if opts[:hwp_id]
+      body['instanceType'] = opts[:hwp_id].gsub('-', '/')
+    else
+      body['instanceType'] = @last_image['supportedInstanceTypes'][0]['id']
+    end
 
     if not body['name']
       body['name'] = Time.now.to_i.to_s
-- 
1.8.0.1