From 54c0ae12ffb60661e0458121dd28749b23fd4f57 Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Tue, 29 Sep 2020 14:42:26 +0200 Subject: [PATCH] B #5110: race condition vdc (#266) Signed-off-by: Jorge Lobo (cherry picked from commit f4dc20b187340524ac5b0f03cf501446d2ca6153) --- src/sunstone/models/SunstoneServer.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 57a8633511..0a3417db2e 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -140,8 +140,12 @@ class SunstoneServer < CloudServer if OpenNebula.is_error?(rc) return [500, rc.to_json] else - resource.info - return [201, resource.to_json] + rc = resource.info + if OpenNebula.is_error?(rc) + return [201, "{\"#{kind.upcase}\": {\"ID\": \"#{resource.id}\"}}"] + else + return [201, resource.to_json] + end end end @@ -219,6 +223,7 @@ class SunstoneServer < CloudServer return [404, resource.to_json] end rc = resource.perform_action(action_json) + if OpenNebula.is_error?(rc) return [500, rc.to_json] else