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 command -v gsutil >/dev/null; then
19 if gsutil -q stat gs://$gs_url/$image_name.qcow2; then
20 echo "Image already exists at http://$gs_url/$image_name.qcow2"
24 echo "Cannot check image availability in OPNFV artifact repository (gsutil not available)"
27 # install diskimage-builder
28 if [ -d dib-venv ]; then
29 . dib-venv/bin/activate
32 . dib-venv/bin/activate
33 pip install diskimage-builder
36 # Add nfvbenchvm_centos elements directory to the DIB elements path
37 export ELEMENTS_PATH=`pwd`/elements
39 # canned user/password for direct login
40 export DIB_DEV_USER_USERNAME=nfvbench
41 export DIB_DEV_USER_PASSWORD=nfvbench
42 export DIB_DEV_USER_PWDLESS_SUDO=Y
44 # Set the data sources to have ConfigDrive only
45 export DIB_CLOUD_INIT_DATASOURCES="ConfigDrive"
48 export DIB_YUM_REPO_CONF=$ELEMENTS_PATH/nfvbenchvm/fdio-release.repo
50 # Use ELRepo to have latest kernel
51 export DIB_USE_ELREPO_KERNEL=True
53 echo "Building $image_name.qcow2..."
54 time disk-image-create -o $image_name centos7 nfvbenchvm
55 ls -l $image_name.qcow2
57 if command -v gsutil >/dev/null; then
58 echo "Uploading $image_name.qcow2..."
59 gsutil cp $image_name.qcow2 gs://$gs_url/$image_name.qcow2
60 echo "You can access to image at http://$gs_url/$image_name.qcow2"
62 echo "Cannot upload new image to the OPNFV artifact repository (gsutil not available)"