Revision c60e021d src/sunstone/models/SunstoneServer.rb

View differences:

src/sunstone/models/SunstoneServer.rb
27 27
    # FLAG that will filter the elements retrieved from the Pools
28 28
    POOL_FILTER = Pool::INFO_ALL
29 29

  
30
    # Secs to sleep between checks to see if image upload to repo is finished
31
    IMAGE_POLL_SLEEP_TIME = 5
32

  
30 33
    def initialize(client, config, logger)
31 34
        super(config, logger)
32 35
        @client = client
......
164 167
            return [500, rc.to_json]
165 168
        end
166 169

  
167
        rc = image.info
168

  
169
        if OpenNebula.is_error?(rc)
170
            return [500, rc.to_json]
170
        image.info
171
        #wait until image is ready to return
172
        while (image.state_str == 'LOCKED') && (image['RUNNING_VMS'] == '0') do
173
            sleep IMAGE_POLL_SLEEP_TIME
174
            image.info
171 175
        end
172

  
173 176
        return [201, image.to_json]
174 177
    end
175 178

  

Also available in: Unified diff