Cache a copy of all images on the template VM.
This is part 1 of a 2 part change that will get the images pre-populated in the devstack directory on the vm so that they aren't downloaded via the Internet each time. This needs to be merged first so that the directory with the images is available on the vm. The next change, to the gate-host script, will expect it to be there. Change-Id: I230e3d3032a9d605b2e1192e1f1df6d5da75d01e
This commit is contained in:
@@ -41,6 +41,7 @@ IMAGE_NAME = 'devstack-oneiric'
|
||||
|
||||
debs = ' '.join(open(sys.argv[1]).read().split('\n'))
|
||||
pips = ' '.join(open(sys.argv[2]).read().split('\n'))
|
||||
filedir = sys.argv[3]
|
||||
|
||||
if CLOUD_SERVERS_DRIVER == 'rackspace':
|
||||
Driver = get_driver(Provider.RACKSPACE)
|
||||
@@ -70,6 +71,16 @@ def run(action, x):
|
||||
if ret:
|
||||
raise Exception("Unable to %s" % action)
|
||||
|
||||
def scp(source, dest):
|
||||
print 'copy', source, dest
|
||||
ftp = client.open_sftp()
|
||||
ftp.put(source, dest)
|
||||
ftp.close()
|
||||
|
||||
run('make file cache directory', 'mkdir -p files')
|
||||
for fn in os.listdir(filedir):
|
||||
source = os.path.join(filedir, fn)
|
||||
scp(source, 'files/%s'%fn)
|
||||
run('update package list', 'sudo apt-get update')
|
||||
run('install packages', 'sudo DEBIAN_FRONTEND=noninteractive apt-get --option "Dpkg::Options::=--force-confold" --assume-yes install %s' % debs)
|
||||
run('install pips', 'sudo pip install %s' % pips)
|
||||
|
||||
@@ -32,4 +32,16 @@ cd $WORKSPACE
|
||||
cat devstack/files/apts/* | grep -v NOPRIME | cut -d\# -f1 > devstack-debs
|
||||
cat devstack/files/pips/* > devstack-pips
|
||||
|
||||
$CI_SCRIPT_DIR/devstack-vm-update-image.py $WORKSPACE/devstack-debs $WORKSPACE/devstack-pips
|
||||
source $WORKSPACE/devstack/stackrc
|
||||
mkdir -p files
|
||||
# Excerpt from devstack that downloads the images
|
||||
for image_url in ${IMAGE_URLS//,/ }; do
|
||||
# Downloads the image (uec ami+aki style), then extracts it.
|
||||
IMAGE_FNAME=`echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]"`
|
||||
IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"`
|
||||
if [ ! -f files/$IMAGE_FNAME ]; then
|
||||
wget -c $image_url -O files/$IMAGE_FNAME
|
||||
fi
|
||||
done
|
||||
|
||||
$CI_SCRIPT_DIR/devstack-vm-update-image.py $WORKSPACE/devstack-debs $WORKSPACE/devstack-pips $WORKSPACE/files
|
||||
|
||||
Reference in New Issue
Block a user