Use a new image name each time we snapshot.
Work around a bug in RS cloud servers where after deleting an image, you may not be able to create a new one with the same name. Instead, generate a unique name for every image, and when we go to use it, find an image that _starts_ with the name we're looking for. Change-Id: I2e674c544b96e976c0460298ab74de1da8e7144c
This commit is contained in:
@@ -52,7 +52,10 @@ if CLOUD_SERVERS_DRIVER == 'rackspace':
|
||||
sizes = [sz for sz in conn.list_sizes() if sz.ram >= MIN_RAM]
|
||||
sizes.sort(lambda a,b: cmp(a.ram, b.ram))
|
||||
size = sizes[0]
|
||||
image = [img for img in conn.list_images() if img.name==IMAGE_NAME][0]
|
||||
images = [img for img in conn.list_images()
|
||||
if img.name.startswith(IMAGE_NAME)]
|
||||
images.sort()
|
||||
image = images[-1]
|
||||
else:
|
||||
raise Exception ("Driver not supported")
|
||||
|
||||
|
||||
@@ -50,11 +50,8 @@ if CLOUD_SERVERS_DRIVER == 'rackspace':
|
||||
node = [n for n in conn.list_nodes() if n.name==SERVER_NAME][0]
|
||||
|
||||
print "Searching for %s image" % IMAGE_NAME
|
||||
image = [img for img in conn.list_images() if img.name==IMAGE_NAME]
|
||||
if image:
|
||||
image = image[0]
|
||||
else:
|
||||
image = None
|
||||
images = [img for img in conn.list_images()
|
||||
if img.name.startswith(IMAGE_NAME)]
|
||||
else:
|
||||
raise Exception ("Driver not supported")
|
||||
|
||||
@@ -81,9 +78,11 @@ run('run puppet', 'sudo bash -c "cd /root/openstack-ci-puppet && /usr/bin/git pu
|
||||
run('stop mysql', 'sudo /etc/init.d/mysql stop')
|
||||
run('stop rabbitmq', 'sudo /etc/init.d/rabbitmq-server stop')
|
||||
|
||||
if image:
|
||||
for image in images:
|
||||
conn.ex_delete_image(image)
|
||||
|
||||
IMAGE_NAME = IMAGE_NAME+'-'+str(int(time.time()))
|
||||
|
||||
image = conn.ex_save_image(node=node, name=IMAGE_NAME)
|
||||
|
||||
last_extra = None
|
||||
|
||||
Reference in New Issue
Block a user