diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2016-07-15 09:04:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-07-15 09:04:30 +0000 |
commit | acd405c3199a03ae58844a6c6f0e5595fb877da3 (patch) | |
tree | 7871dbf13c1076aaa822231a861f2ff7b6325fa5 | |
parent | bbfc6ca841faa75e42c123e01856bad12629721d (diff) | |
parent | 9bcec4b381877cd223ebe32beb69d3c1c6585883 (diff) |
Merge "Use local QTIP_CentOS.qcow2 img file."
-rw-r--r-- | func/fetchimg.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/func/fetchimg.py b/func/fetchimg.py index 6cae426e..88178bed 100644 --- a/func/fetchimg.py +++ b/func/fetchimg.py @@ -9,20 +9,27 @@ import os
import time
+IMGSTORE="/home/opnfv/imgstore"
class FetchImg:
def __init__(self):
print 'Fetching Image!'
- print 'Fetching QTIP_VM Image'
@staticmethod
def download():
time.sleep(2)
- os.system(
- 'mkdir -p Temp_Img && wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img')
-
+ os.system('mkdir -p Temp_Img')
filepath = './Temp_Img/QTIP_CentOS.qcow2'
- while not os.path.isfile(filepath):
- time.sleep(10)
- print 'Download Completed!'
+ imgstorepath = IMGSTORE+"/QTIP_CentOS.qcow2"
+ if os.path.isfile(imgstorepath):
+ os.system("ln -s %s %s" % (imgstorepath, filepath))
+ print "QTIP_CentOS.qcow2 exists locally. Skipping the download and using the file from IMG store"
+ else:
+ print 'Fetching QTIP_CentOS.qcow2'
+ os.system(
+ 'wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img')
+
+ while not os.path.isfile(filepath):
+ time.sleep(10)
+ print 'Download Completed!'
|