Fix sunstone upload for images in locked_used state

This commit is contained in:
Carlos Martín committed 2016-05-20 18:07:36 +02:00
1 parent c60e021dc4
commit 4c25cb4a4f
1 file changed
+12 -3
+12 -3
View File
@@ -167,12 +167,21 @@ class SunstoneServer < CloudServer
return [500, rc.to_json]
end
image.info
rc = image.info
#wait until image is ready to return
while (image.state_str == 'LOCKED') && (image['RUNNING_VMS'] == '0') do
while ( !OpenNebula.is_error?(rc) &&
(image.state_str == 'LOCKED' ||
image.state_str == 'LOCKED_USED' ||
image.state_str == 'LOCKED_USED_PERS') ) do
sleep IMAGE_POLL_SLEEP_TIME
image.info
rc = image.info
end
if OpenNebula.is_error?(rc)
return [404, rc.to_json]
end
return [201, image.to_json]
end