import os\r
import time\r
\r
+IMGSTORE="/home/opnfv/imgstore"\r
\r
class FetchImg:\r
\r
def __init__(self):\r
print 'Fetching Image!'\r
- print 'Fetching QTIP_VM Image'\r
\r
@staticmethod\r
def download():\r
time.sleep(2)\r
- os.system(\r
- 'mkdir -p Temp_Img && wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img')\r
-\r
+ os.system('mkdir -p Temp_Img')\r
filepath = './Temp_Img/QTIP_CentOS.qcow2'\r
- while not os.path.isfile(filepath):\r
- time.sleep(10)\r
- print 'Download Completed!'\r
+ imgstorepath = IMGSTORE+"/QTIP_CentOS.qcow2"\r
+ if os.path.isfile(imgstorepath):\r
+ os.system("ln -s %s %s" % (imgstorepath, filepath))\r
+ print "QTIP_CentOS.qcow2 exists locally. Skipping the download and using the file from IMG store"\r
+ else:\r
+ print 'Fetching QTIP_CentOS.qcow2'\r
+ os.system(\r
+ 'wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img')\r
+\r
+ while not os.path.isfile(filepath):\r
+ time.sleep(10)\r
+ print 'Download Completed!'\r