Don't refetch same image over and over

During tempest configuration, we create two images - general and alt -
though they are backed by the same image file.  Each time we fetch the
same image from the internet, which is not optimal. This patch makes it
so that when the file already exists in the destination, it's taken on
face value and used to upload the image to the cloud.

Change-Id: I12600ea81ff2c634a720ab82c14433a434e548a1
This commit is contained in:
Ihar Hrachyshka 2018-01-15 11:48:12 -08:00
parent e99569419c
commit 6bc39206f0

View File

@ -1064,6 +1064,9 @@ def configure_discovered_services(conf, services):
def _download_file(url, destination):
if os.path.exists(destination):
LOG.info("Image '%s' already fetched to '%s'.", url, destination)
return
LOG.info("Downloading '%s' and saving as '%s'", url, destination)
f = urllib2.urlopen(url)
data = f.read()