scripts/qemu: enable libpmem

Enable libpmem to support PMEM when running under Kubernetes.

see https://github.com/kata-containers/runtime/issues/2262

According to QEMU's nvdimm documentation: When 'pmem' is 'on' and QEMU is
built with libpmem support, QEMU will take necessary operations to guarantee
the persistence of its own writes to the vNVDIMM backend.

fixes #958

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2020-02-28 17:50:09 +00:00
parent 9a37ebec66
commit c0d45d8ace
6 changed files with 10 additions and 6 deletions

View File

@ -6,7 +6,7 @@ export LANG=C
override_dh_auto_configure: override_dh_auto_configure:
chmod a+x "../SOURCES/configure-hypervisor.sh" chmod a+x "../SOURCES/configure-hypervisor.sh"
eval "../SOURCES/configure-hypervisor.sh" "qemu-vanilla" | xargs ./configure --prefix=/usr eval "../SOURCES/configure-hypervisor.sh" "qemu-vanilla" | sed -e 's/--enable-libpmem//g' | xargs ./configure --prefix=/usr
override_dh_auto_build: override_dh_auto_build:
make make
@ -24,4 +24,3 @@ override_dh_auto_test:
override_dh_auto_clean: override_dh_auto_clean:
echo "Skip auto clean" echo "Skip auto clean"

View File

@ -47,6 +47,7 @@ BuildRequires : python
BuildRequires : python-devel BuildRequires : python-devel
BuildRequires : zlib-devel BuildRequires : zlib-devel
BuildRequires : pkgconfig(pixman-1) BuildRequires : pkgconfig(pixman-1)
BuildRequires : libpmem-devel
# Patches # Patches
@RPM_PATCH_LIST@ @RPM_PATCH_LIST@

View File

@ -330,10 +330,6 @@ generate_qemu_options() {
qemu_options+=(size:--disable-linux-aio) qemu_options+=(size:--disable-linux-aio)
if [[ "${qemu_version_major}" -ge 4 || ( "${qemu_version_major}" -eq 3 && "${qemu_version_minor}" -ge 1 ) ]]; then if [[ "${qemu_version_major}" -ge 4 || ( "${qemu_version_major}" -eq 3 && "${qemu_version_minor}" -ge 1 ) ]]; then
# Disable libpmem, vNVDIMM backend (aka rootfs image) shouldn't be modifed
# by the guest
qemu_options+=(security:--disable-libpmem)
# Disable graphics # Disable graphics
qemu_options+=(size:--disable-virglrenderer) qemu_options+=(size:--disable-virglrenderer)
@ -396,6 +392,11 @@ generate_qemu_options() {
fi fi
# Enable libc malloc_trim() for memory optimization. # Enable libc malloc_trim() for memory optimization.
qemu_options+=(speed:--enable-malloc-trim) qemu_options+=(speed:--enable-malloc-trim)
# According to QEMU's nvdimm documentation: When 'pmem' is 'on' and QEMU is
# built with libpmem support, QEMU will take necessary operations to guarantee
# the persistence of its own writes to the vNVDIMM backend.
qemu_options+=(functionality:--enable-libpmem)
fi fi
#--------------------------------------------------------------------- #---------------------------------------------------------------------

View File

@ -338,6 +338,7 @@ parts:
- curl - curl
- libcapstone-dev - libcapstone-dev
- bc - bc
- libpmem-dev
override-build: | override-build: |
kata_version=$(cat ${SNAPCRAFT_STAGE}/kata_version) kata_version=$(cat ${SNAPCRAFT_STAGE}/kata_version)
yq=$(realpath ../../yq/build/yq) yq=$(realpath ../../yq/build/yq)

View File

@ -26,6 +26,7 @@ RUN apt-get install -y \
libglib2.0-dev git \ libglib2.0-dev git \
libltdl-dev \ libltdl-dev \
libpixman-1-dev \ libpixman-1-dev \
libpmem-dev \
libseccomp-dev \ libseccomp-dev \
libtool \ libtool \
patch \ patch \

View File

@ -26,6 +26,7 @@ RUN apt-get install -y \
libglib2.0-dev git \ libglib2.0-dev git \
libltdl-dev \ libltdl-dev \
libpixman-1-dev \ libpixman-1-dev \
libpmem-dev \
libtool \ libtool \
pkg-config \ pkg-config \
pkg-config \ pkg-config \