Add the scipts to build NFVbench VM
[nfvbench.git] / nfvbenchvm / dib / build-image.sh
1 #!/bin/bash
2 #
3 # A shell script to build the VPP VM image using diskinage-builder
4 #
5 # The following packages must be installed prior to using this script:
6 # sudo apt-get -y install python-virtualenv qemu-utils kpartx
7
8 # image version number
9 __version__=0.3
10 image_name=nfvbenchvm_centos-$__version__
11
12 # install diskimage-builder
13 if [ -d dib-venv ]; then
14     . dib-venv/bin/activate
15 else
16     virtualenv dib-venv
17     . dib-venv/bin/activate
18     pip install diskimage-builder
19 fi
20
21 # Add nfvbenchvm_centos elements directory to the DIB elements path
22 export ELEMENTS_PATH=`pwd`/elements
23
24 # canned user/password for direct login
25 export DIB_DEV_USER_USERNAME=nfvbench
26 export DIB_DEV_USER_PASSWORD=nfvbench
27 export DIB_DEV_USER_PWDLESS_SUDO=Y
28
29 # Set the data sources to have ConfigDrive only
30 export DIB_CLOUD_INIT_DATASOURCES="ConfigDrive"
31
32 # Configure VPP REPO
33 export DIB_YUM_REPO_CONF=$ELEMENTS_PATH/nfvbenchvm/fdio-release.repo
34
35 # Use ELRepo to have latest kernel
36 export DIB_USE_ELREPO_KERNEL=True
37
38 echo "Building $image_name.qcow2..."
39 time disk-image-create -o $image_name centos7 nfvbenchvm
40
41 ls -l $image_name.qcow2