Attempting to build nfvbench VM images with diskimage_builder (dib)
3.16.0 leads to the following error:
diskimage_builder.element_dependencies.MissingElementException: Element
'block-device' not found
Something changed at some point of diskimage_builder history, and the
updated doc states: "When using the vm element, an element that provides
block-device should be included".
To fix this and prevent future similar issues, this patch:
- adds the "block-device-mbr" element to the dependency list
- sets diskimage_builder version
By the way:
- replace the deprecated "centos7" element with the more generic
"centos" element.
- add missing dependencies in the pre-requisites section of nfvbenchvm
doc
- install pip with package manager (the current latest version of
get-pip.py is not compatible with python 3.6, so let's use the
occasion to stop getting pip directly from the Internet)
- use Python 3 in build-image.sh
Change-Id: I3198a1042eca04224b2a62db443c39a76903cf22
Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
--------------
- must run on Linux
- the following packages must be installed prior to using this script:
--------------
- must run on Linux
- the following packages must be installed prior to using this script:
+ - python3 (+ python3-venv on Ubuntu)
+ - python3-pip
+ - qemu-img (CentOs) or qemu-utils (Ubuntu)
+.. note:: the image build process is based on `diskimage-builder
+ <https://docs.openstack.org/diskimage-builder/latest/index.html>`_
+ that will be installed in a Python virtual environment by nfvbenchvm
+ build script build-image.sh.
+
+.. note:: build-image.sh uses the `gsutil <https://pypi.org/project/gsutil/>`_
+ tool to interact with Google cloud storage (to check if the images
+ exist and to upload the images). This is normally only needed in the
+ context of OPNFV build infrastructure, and build-image.sh can be used
+ without that tool in development environments.
+
Build the image
---------------
- cd dib
Build the image
---------------
- cd dib
# A shell script to build the VPP VM image or NFVbench+TRex VM image using diskinage-builder
#
# The following packages must be installed prior to using this script:
# A shell script to build the VPP VM image or NFVbench+TRex VM image using diskinage-builder
#
# The following packages must be installed prior to using this script:
-# sudo apt-get -y install python-virtualenv qemu-utils kpartx
+# Ubuntu: sudo apt-get -y install python3 python3-venv qemu-utils kpartx
+# CentOS: sudo yum install -y python3 qemu-img kpartx
usage() {
echo "Usage: $0 [-l] [-g] [-v]"
usage() {
echo "Usage: $0 [-l] [-g] [-v]"
if [ -d dib-venv ]; then
. dib-venv/bin/activate
else
if [ -d dib-venv ]; then
. dib-venv/bin/activate
else
+ python3 -m venv dib-venv
- pip install diskimage-builder
+ pip install diskimage-builder==3.16.0
fi
# Add nfvbenchvm_centos elements directory to the DIB elements path
fi
# Add nfvbenchvm_centos elements directory to the DIB elements path
export TREX_VER=$(awk '/ENV TREX_VER/ {print $3}' ../../docker/Dockerfile | sed 's/"//g' | sed 's/\r//g')
fi
export TREX_VER=$(awk '/ENV TREX_VER/ {print $3}' ../../docker/Dockerfile | sed 's/"//g' | sed 's/\r//g')
fi
+ # Specify CentOS version
+ export DIB_RELEASE=7
+
echo "Building $1.qcow2..."
echo "Building $1.qcow2..."
- time disk-image-create -o $1 centos7 nfvbenchvm
+ time disk-image-create -o $1 centos nfvbenchvm
echo "Build generator image"
build_image $generator_image_name
fi
echo "Build generator image"
build_image $generator_image_name
fi
-fi
\ No newline at end of file
cloud-init-datasources
install-static
package-installs
cloud-init-datasources
install-static
package-installs
dpdk-tools:
git:
python3-dev:
dpdk-tools:
git:
python3-dev:
-libpython3.6-dev:
\ No newline at end of file
+libpython3.6-dev:
+python3-pip:
-cd /tmp
-wget https://bootstrap.pypa.io/get-pip.py
-python3 get-pip.py
-
-pip3 install setuptools wheel pbr
-pip3 install pyyaml
+python3 -m pip install --upgrade pip
+python3 -m pip install setuptools wheel pbr
+python3 -m pip install pyyaml
cd /opt
git clone https://gerrit.opnfv.org/gerrit/nfvbench
cd nfvbench/
cd /opt
git clone https://gerrit.opnfv.org/gerrit/nfvbench
cd nfvbench/
-pip3 install . --use-deprecated=legacy-resolver
+python3 -m pip install . --use-deprecated=legacy-resolver
cp xtesting/testcases.yaml /usr/local/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
python3 ./docker/cleanup_generators.py
rm -rf /opt/nfvbench/.git
cp xtesting/testcases.yaml /usr/local/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
python3 ./docker/cleanup_generators.py
rm -rf /opt/nfvbench/.git