3 # A shell script to build the VPP VM image using diskinage-builder
5 # The following packages must be installed prior to using this script:
6 # sudo apt-get -y install python-virtualenv qemu-utils kpartx
11 gs_url=artifacts.opnfv.org/nfvbench/images
13 # image version number
15 image_name=nfvbenchvm_centos-$__version__
17 # if image exists skip building
18 if gsutil -q stat gs://$gs_url/$image_name.qcow2; then
19 echo "Image already exists at http://$gs_url/$image_name.qcow2"
23 # install diskimage-builder
24 if [ -d dib-venv ]; then
25 . dib-venv/bin/activate
28 . dib-venv/bin/activate
29 pip install diskimage-builder
32 # Add nfvbenchvm_centos elements directory to the DIB elements path
33 export ELEMENTS_PATH=`pwd`/elements
35 # canned user/password for direct login
36 export DIB_DEV_USER_USERNAME=nfvbench
37 export DIB_DEV_USER_PASSWORD=nfvbench
38 export DIB_DEV_USER_PWDLESS_SUDO=Y
40 # Set the data sources to have ConfigDrive only
41 export DIB_CLOUD_INIT_DATASOURCES="ConfigDrive"
44 export DIB_YUM_REPO_CONF=$ELEMENTS_PATH/nfvbenchvm/fdio-release.repo
46 # Use ELRepo to have latest kernel
47 export DIB_USE_ELREPO_KERNEL=True
49 echo "Building $image_name.qcow2..."
50 time disk-image-create -o $image_name centos7 nfvbenchvm
51 ls -l $image_name.qcow2
53 echo "Uploading $image_name.qcow2..."
54 gsutil cp $image_name.qcow2 gs://$gs_url/$image_name.qcow2
55 echo "You can access to image at http://$gs_url/$image_name.qcow2"