image retry bug - dianaclarke/openstack-notes GitHub Wiki

def call(exception):
    for x in [1, 2, 3]:
        if exception:
            raise Exception("BOOM!")
        yield x

try:
   images = call(exception=True)
except:
   print 'retrying...'
   images = call(exception=False)

print images
<generator object call at 0x10a04e050>
  • The goal is something more like this:
def call(exception):
    for x in [1, 2, 3]:
        if exception:
            raise Exception("BOOM!")
        yield x

try:
   images = list(call(exception=True))
except:
   print 'retrying...'
   images = list(call(exception=False))

print images
retrying...
[1, 2, 3]
  • The DevStack config I used to manually test this:
$ cat local.conf 
[local](/dianaclarke/openstack-notes/wiki/localrc)
DEST=/opt/stack/
LOGDIR=$DEST/logs
LOGFILE=$LOGDIR/stack.sh.log
RABBIT_PASSWORD=123456
MYSQL_PASSWORD=123456
SERVICE_TOKEN=123456
SERVICE_PASSWORD=123456
ADMIN_PASSWORD=123456
DATABASE_QUERY_LOGGING=True

[post-config](/dianaclarke/openstack-notes/wiki/$NOVA_CONF)
[database]
connection_debug=50
[glance]
api_servers=http://192.168.122.30:9292/v1,http://192.168.122.31:9292/v1
num_retries = 5