Commit 9a301bf3 authored by Łukasz Nowak's avatar Łukasz Nowak

Update Release Candidate

parents 0507aa0f 82d84972
......@@ -3,15 +3,14 @@ parts =
boost-lib
extends =
../bzip2/buildout.cfg
../patch/buildout.cfg
../zlib/buildout.cfg
../xz-utils/buildout.cfg
[boost-lib]
recipe = slapos.recipe.cmmi
shared = true
url = https://boostorg.jfrog.io/artifactory/main/release/1.67.0/source/boost_1_67_0.tar.bz2
md5sum = ced776cb19428ab8488774e1415535ab
url = https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2
md5sum = db0112a3a37a3742326471d20f1a186a
location = @@LOCATION@@
configure-command = ./bootstrap.sh --prefix=${:location} --without-icu $${PYTHON:+--with-python=$PYTHON}
make-binary =
......@@ -25,7 +24,3 @@ environment =
ZLIB_LIBPATH=${zlib:location}/lib
LZMA_INCLUDE=${xz-utils:location}/include
LZMA_LIBRARY_PATH=${xz-utils:location}/lib
patch-options = -p1
patches =
https://sources.debian.org/data/main/b/boost1.67/1.67.0-13+deb10u1/debian/patches/fix-ftbfs-python-3.3.patch#c85fb479d51354deafd1cc7af78f25d2
patch-binary = ${patch:location}/bin/patch
[buildout]
extends =
../boost-lib/buildout.cfg
../cmake/buildout.cfg
../cryptsetup/buildout.cfg
../curl/buildout.cfg
../keyutils/buildout.cfg
../libnl/buildout.cfg
../ncurses/buildout.cfg
../ninja/buildout.cfg
../openssl/buildout.cfg
../patch/buildout.cfg
../snappy/buildout.cfg
../systemd/buildout.cfg
../util-linux/buildout.cfg
../zlib/buildout.cfg
../pkgconfig/buildout.cfg
[pyyaml-download]
recipe = slapos.recipe.build:download
shared = true
url = https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/${:filename}
filename = PyYAML-5.1.2.tar.gz
md5sum = 20f87ab421b0271dbf371dc5c1cddb5c
[pyaml-download]
recipe = slapos.recipe.build:download
shared = true
url = https://files.pythonhosted.org/packages/b6/f0/dbb524509ce28f5cfd4e1d9e3ef955f51186cfd1b8297f6e158778c4a8ef/${:filename}
filename = pyaml-21.10.1.tar.gz
md5sum = a915f577f6fc62344fa4775b22db9052
[librbd-python]
recipe = slapos.recipe.build
shared = true
pyyaml = ${pyyaml-download:target}
pyaml = ${pyaml-download:target}
install =
import os
call([options['python'], '-m', 'venv', '--clear', location])
pip = os.path.join(location, 'bin', 'pip')
call([pip, 'install', '--no-index', options['pyyaml'], options['pyaml']])
call([pip, 'uninstall', '-y', 'pip', 'setuptools'])
# selftest
python = os.path.join(location, 'bin', 'python3')
call([python, '-c', 'import yaml'])
python = ${python3:executable}
[librbd-python:python3]
python = ${buildout:executable}
[librbd]
# CEPH only for librbd
recipe = slapos.recipe.cmmi
shared = true
url = https://download.ceph.com/tarballs/ceph_17.1.0.orig.tar.gz
md5sum = 1f2ed3f17f76ea71d555428f26644610
# Note: SlapOSifying whole ceph, including it's managers, is an enormous effort
# so only "librbd" is provided with header files and this requires
# careful selection and ordering of ninja's targets and also manual
# copying of common library
configure-command = cmake
make-binary = ninja -C build librbd librados
make-targets = src/librbd/install src/librados/install src/common/install src/include/install ; cp build/lib/libceph-common.so build/lib/libceph-common.so.2 %(location)s/lib ; cd %(location)s/lib
patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
${:_profile_base_location_}/ceph-minimal.patch#a84c4d30586c8b8f87a581fed5fbf5d8
CMAKE_LIBRARY_PATH="${util-linux:location}/lib;${ncurses:location}/lib;${keyutils:location}/x86_64-linux-gnu;${cryptsetup:location}/lib;${snappy:location}/lib;${systemd:location}/lib64;${zlib:location}/lib;${libnl:location}/lib;${boost-lib:location}/lib;${curl:location}/lib;${openssl:location}/lib"
CMAKE_INCLUDE_PATH="${systemd:location}/include;${util-linux:location}/include;${boost-lib:location}/include;${ncurses:location}/include;${keyutils:location}/include;${cryptsetup:location}/include;${snappy:location}/include;${zlib:location}/include;${libnl:location}/include;${curl:location}/include;${openssl:location}/include"
environment =
PATH=${cmake:location}/bin:${ninja:location}/bin:${patch:location}/bin:${pkgconfig:location}/bin:${librbd-python:location}/bin:%(PATH)s
configure-options =
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_INCLUDE_PATH=${:CMAKE_INCLUDE_PATH}
-DCMAKE_INSTALL_PREFIX=%(location)s
-DCMAKE_LIBRARY_PATH=${:CMAKE_LIBRARY_PATH}
-DCMAKE_INSTALL_RPATH=%(location)s/lib
-DDEBUG_GATHER=OFF
-DWITH_SYSTEM_ROCKSDB=OFF
-DWITH_BABELTRACE=OFF
-DWITH_BLUESTORE=OFF
-DWITH_CEPHFS=OFF
-DWITH_FUSE=OFF
-DWITH_FUSE=OFF
-DWITH_KRBD=OFF
-DWITH_LIBCEPHFS=OFF
-DWITH_LIBCEPHSQLITE=OFF
-DWITH_LTTNG=OFF
-DWITH_LZ4=OFF
-DWITH_MANPAGE=OFF
-DWITH_MGR=OFF
-DWITH_MGR_DASHBOARD_FRONTEND=OFF
-DWITH_OPENLDAP=OFF
-DWITH_RADOSGW=OFF
-DWITH_RADOSGW_AMQP_ENDPOINT=OFF
-DWITH_RADOSGW_BEAST_OPENSSL=OFF
-DWITH_RADOSGW_DBSTORE=OFF
-DWITH_RADOSGW_KAFKA_ENDPOINT=OFF
-DWITH_RADOSGW_LUA_PACKAGES=OFF
-DWITH_RADOSGW_SELECT_PARQUET=OFF
-DWITH_RBD=ON
-DWITH_RDMA=OFF
-DWITH_SYSTEMD=OFF
-DWITH_SYSTEM_BOOST=ON
-DWITH_TESTS=OFF
-DWITH_XFS=OFF
-GNinja
-S . -B build
From 3884a23340defa68ce84590e4a3175d7ea59bbbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Mon, 11 Apr 2022 13:49:17 +0200
Subject: [PATCH 1/3] cmake: Drop FindCython.cmake
Cython is not required while building minimal ceph - librbd only support,
and dropping it simplifies build process and removes a lot of additional
dependencies.
---
cmake/modules/FindCython.cmake | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/cmake/modules/FindCython.cmake b/cmake/modules/FindCython.cmake
index 8eb9e42f402..e69de29bb2d 100644
--- a/cmake/modules/FindCython.cmake
+++ b/cmake/modules/FindCython.cmake
@@ -1,16 +0,0 @@
-#
-# Cython
-#
-
-# Try to run Cython, to make sure it works:
-execute_process(
- COMMAND ${Python3_EXECUTABLE} -m cython --version
- RESULT_VARIABLE cython_result
- ERROR_VARIABLE cython_output)
-if(cython_result EQUAL 0)
- string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+).*" "\\1" CYTHON_VERSION "${cython_output}")
-else()
- message(SEND_ERROR "Could not find cython${PYTHON_VERSION}: ${cython_output}")
-endif()
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Cython${PYTHON_VERSION} DEFAULT_MSG CYTHON_VERSION)
--
2.30.2
From 17131b5c0619a8bf2e56e6a8d63649d3d1b2a432 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Mon, 11 Apr 2022 13:50:33 +0200
Subject: [PATCH 2/3] librbd: drop needless udev
It's automatically added by cmake and such configuration results with linker
not being able to find libudev in case if it lives outside of typical
directory structure.
---
src/librbd/CMakeLists.txt | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt
index ad23f0975fd..5bd011bf242 100644
--- a/src/librbd/CMakeLists.txt
+++ b/src/librbd/CMakeLists.txt
@@ -337,10 +337,6 @@ target_link_libraries(librbd PRIVATE
pthread
${CMAKE_DL_LIBS}
${EXTRALIBS} ${GSSAPI_LIBRARIES})
-if(HAVE_UDEV)
- target_link_libraries(librbd PRIVATE
- udev)
-endif()
if(ENABLE_SHARED)
set_target_properties(librbd PROPERTIES
OUTPUT_NAME rbd
--
2.30.2
From 7d16861edea2609e0f6b29b146ed928c63a6ee08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Mon, 11 Apr 2022 13:50:03 +0200
Subject: [PATCH 3/3] common: Fix missing cmake declarations
Original ceph build process can't find some dependencies in case if it's run
on machines which do not have installed in standard /usr locations.
---
src/common/CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 3bf28659e1c..005d08c1caa 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -184,6 +184,8 @@ add_library(common-common-objs OBJECT
# retrieved OpenSSL location. This is especially important when cross
# compiling (e.g. targeting Windows).
target_include_directories(common-common-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
+target_include_directories(common-common-objs PRIVATE ${UDEV_INCLUDE_DIR})
+target_include_directories(common-common-objs PRIVATE ${BLKID_INCLUDE_DIR})
# for options.cc
target_compile_definitions(common-common-objs PRIVATE
"CMAKE_INSTALL_LIBDIR=\"${CMAKE_INSTALL_LIBDIR}\""
@@ -241,4 +243,5 @@ if(HAVE_KEYUTILS)
set(parse_secret_srcs
secret.c)
add_library(parse_secret_objs OBJECT ${parse_secret_srcs})
+ target_include_directories(parse_secret_objs PRIVATE ${KEYUTILS_INCLUDE_DIR})
endif()
--
2.30.2
[buildout]
extends =
../util-linux/buildout.cfg
../lvm2/buildout.cfg
../popt/buildout.cfg
../pkgconfig/buildout.cfg
../json-c/buildout.cfg
../openssl/buildout.cfg
[cryptsetup]
recipe = slapos.recipe.cmmi
shared = true
url = https://www.kernel.org/pub/linux/utils/cryptsetup/v2.4/cryptsetup-2.4.3.tar.xz
md5sum = 2303d57e78d4977344188a46e125095c
configure-options =
--disable-external-tokens
--disable-ssh-token
--disable-luks2-reencryption
--disable-cryptsetup
--disable-veritysetup
--disable-cryptsetup-reencrypt
--disable-integritysetup
--disable-selinux
--disable-udev
--disable-kernel_crypto
--disable-blkid
environment =
PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${json-c:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig
CFLAGS=-I${libuuid:location}/include -I${lvm2:location}/include -I${popt:location}/include -I${json-c:location}/include -I${openssl:location}/include
LDFLAGS=-L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -L${lvm2:location}/lib -Wl,-rpath=${lvm2:location}/lib -L${popt:location}/lib -Wl,-rpath=${popt:location}/lib -L${json-c:location}/lib -Wl,-rpath=${json-c:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib
[buildout]
extends =
../cmake/buildout.cfg
[json-c]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/json-c/json-c/archive/refs/tags/json-c-0.15-20200726.tar.gz
md5sum = b3841c9abdca837ea00ce6a5ada4bb2c
configure-command = mkdir build ; cd build ; ../cmake-configure
configure-options = --prefix=%(location)s
make-binary = cd build ; make
environment =
PATH=${cmake:location}/bin:%(PATH)s
[buildout]
extends =
../patch/buildout.cfg
[keyutils]
recipe = slapos.recipe.cmmi
shared = true
url = https://people.redhat.com/~dhowells/keyutils/keyutils-1.6.1.tar.bz2
md5sum = 919af7f33576816b423d537f8a8692e8
patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
${:_profile_base_location_}/keyutils-ln.diff#775e8e4efd35103335bff2ac951ea22e
configure-command = echo
make-options = DESTDIR=%(location)s INCLUDEDIR=/include SHAREDIR=/share/keyutils PREFIX=/ MANDIR=/share/man LDFLAGS=-Wl,-rpath=%(location)s/x86_64-linux-gnu
Link relatively to the directory instead from /x86_64-linux-gnu/
diff --git a/Makefile b/Makefile
index 5f8b163..0d20499 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ ifeq ($(NO_SOLIB),0)
$(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
$(LNS) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
mkdir -p $(DESTDIR)$(USRLIBDIR)
- $(LNS) $(LIBDIR)/$(SONAME) $(DESTDIR)$(USRLIBDIR)/$(DEVELLIB)
+ $(LNS) $(SONAME) $(DESTDIR)$(USRLIBDIR)/$(DEVELLIB)
sed \
-e 's,@VERSION\@,$(VERSION),g' \
-e 's,@prefix\@,$(PREFIX),g' \
......@@ -2,6 +2,7 @@
extends =
../attr/buildout.cfg
../gperf/buildout.cfg
parts = libcap
......@@ -19,6 +20,9 @@ make-options =
LDFLAGS="-L${attr:location}/lib/ -Wl,-rpath=${attr:location}/lib/ -Wl,-rpath=${:location}/lib/"
install
environment =
PATH=${gperf:location}/bin:%(PATH)s
# if lib64 exists, then create a symlink from lib to lib64
post-install =
cd ${:location}
......
[buildout]
extends =
../flex/buildout.cfg
../bison/buildout.cfg
[libnl]
recipe = slapos.recipe.cmmi
shared = true
url = https://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz
md5sum = 03f74d0cd5037cadc8cdfa313bbd195c
environment =
PATH=${flex:location}/bin:${bison:location}/bin:%(PATH)s
[buildout]
extends =
../libaio/buildout.cfg
[lvm2]
recipe = slapos.recipe.cmmi
shared = true
url = https://mirrors.kernel.org/sourceware/lvm2/LVM2.2.03.15.tgz
md5sum = 0dbe745e945461419b56c7a21d7e47e2
location = @@LOCATION@@
configure-options =
--with-confdir=${:location}/etc
environment =
CFLAGS=-I${libaio:location}/include
LDFLAGS=-L${libaio:location}/lib -Wl,-rpath=${libaio:location}/lib -Wl,-rpath=${:location}/lib
......@@ -13,10 +13,12 @@ extends =
../meson/buildout.cfg
../ncurses/buildout.cfg
../ninja/buildout.cfg
../patch/buildout.cfg
../pkgconfig/buildout.cfg
../xorg/buildout.cfg
../zlib/buildout.cfg
../glib/buildout.cfg
../ceph/buildout.cfg
[gcc]
min_version = 7.4
......@@ -26,6 +28,10 @@ recipe = slapos.recipe.cmmi
shared = true
url = https://download.qemu.org/qemu-7.0.0.tar.xz
md5sum = bfb5b09a0d1f887c8c42a6d5f26971ab
# fix for https://bugzilla.redhat.com/show_bug.cgi?id=2079938
patches =
https://gitlab.com/redhat/centos-stream/src/qemu-kvm/-/merge_requests/87.diff#ad41b138aa6f330f95811c9a83637b85
patch-options = -p1
pre-configure =
sed -i '/^libmigration\b/s/$/ dependencies: [zlib],/' meson.build
sed -i 's/\bsnappy,/zlib, \0/' dump/meson.build
......@@ -49,11 +55,12 @@ configure-options =
--enable-vnc-png
--disable-vnc-jpeg
--disable-werror
--enable-rbd
environment =
CFLAGS=-I${gettext:location}/include -I${libaio:location}/include -I${liburing:location}/include -I${libcap-ng:location}/include
LDFLAGS=-L${gettext:location}/lib -L${libaio:location}/lib -L${libcap-ng:location}/lib -Wl,-rpath=${libcap-ng:location}/lib -Wl,-rpath=${glib:location}/lib -Wl,-rpath=${gnutls:location}/lib -Wl,-rpath=${nettle:location}/lib -Wl,-rpath=${pixman:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${gettext:location}/lib -Wl,-rpath=${libpng:location}/lib -Wl,-rpath=${libaio:location}/lib -Wl,-rpath=${liburing:location}/lib -Wl,-rpath=${libcap-ng:location}/lib
PATH=${pkgconfig:location}/bin:${bzip2:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${gnutls:location}/lib/pkgconfig:${gnutls:pkg-config-path}:${libpng:location}/lib/pkgconfig:${liburing:location}/lib/pkgconfig:${ncurses:location}/lib/pkgconfig:${pcre:location}/lib/pkgconfig:${pixman:location}/lib/pkgconfig
CFLAGS=-I${librbd:location}/include/ -I${gettext:location}/include -I${libaio:location}/include -I${liburing:location}/include -I${libcap-ng:location}/include
LDFLAGS=-L${librbd:location}/lib -Wl,-rpath=${librbd:location}/lib -L${gettext:location}/lib -L${libaio:location}/lib -L${libcap-ng:location}/lib -Wl,-rpath=${libcap-ng:location}/lib -Wl,-rpath=${glib:location}/lib -Wl,-rpath=${gnutls:location}/lib -Wl,-rpath=${nettle:location}/lib -Wl,-rpath=${pixman:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${gettext:location}/lib -Wl,-rpath=${libpng:location}/lib -Wl,-rpath=${libaio:location}/lib -Wl,-rpath=${liburing:location}/lib -Wl,-rpath=${libcap-ng:location}/lib
PATH=${patch:location}/bin:${pkgconfig:location}/bin:${bzip2:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${gnutls:location}/lib/pkgconfig:${gnutls:pkg-config-path}:${libpng:location}/lib/pkgconfig:${liburing:location}/lib/pkgconfig:${ncurses:location}/lib/pkgconfig:${pcre:location}/lib/pkgconfig:${pixman:location}/lib/pkgconfig:${librbd:location}/lib/pkgconfig
[qemu:sys.version_info < (3,6)]
environment +=
......
......@@ -9,16 +9,77 @@ extends =
../pkgconfig/buildout.cfg
../util-linux/buildout.cfg
../xz-utils/buildout.cfg
../ninja/buildout.cfg
../meson/buildout.cfg
[systemd-markupsafe-download]
recipe = slapos.recipe.build:download
shared = true
url = https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/${:filename}
filename = MarkupSafe-1.0.tar.gz
md5sum = 2fcedc9284d50e577b5192e8e3578355
[systemd-jinja2-download]
recipe = slapos.recipe.build:download
shared = true
url = https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/${:filename}
filename = Jinja2-2.11.3.tar.gz
md5sum = 231dc00d34afb2672c497713fa9cdaaa
[systemd-python]
recipe = slapos.recipe.build
shared = true
markupsafe = ${systemd-markupsafe-download:target}
jinja2 = ${systemd-jinja2-download:target}
install =
import os
call([options['python'], '-m', 'venv', '--clear', location])
pip = os.path.join(location, 'bin', 'pip')
call([pip, 'install', '--no-index', options['markupsafe'], options['jinja2']])
call([pip, 'uninstall', '-y', 'pip', 'setuptools'])
# selftest
python = os.path.join(location, 'bin', 'python3')
call([python, '-c', 'import jinja2'])
python = ${python3:executable}
[systemd-python:python3]
python = ${buildout:executable}
[systemd]
recipe = slapos.recipe.cmmi
recipe = slapos.recipe.build
shared = true
# XXX This version requires Linux kernel >= 3.7.
url = https://www.freedesktop.org/software/systemd/systemd-221.tar.xz
md5sum = b4d5a253841cf28a98b7ec99c45e3716
location = ${buildout:parts-directory}/${:_buildout_section_name_}
make-options = rootprefix=${:location} SYSTEM_SYSVINIT_PATH=${:location}/etc/init.d
url = https://github.com/systemd/systemd-stable/archive/v249.6.tar.gz
md5sum = eb4a1923009abdb4e25c4802f4921a18
install =
env = self.environ
extract_dir = self.extract(self.download(options['url'], options['md5sum']))
workdir = guessworkdir(extract_dir)
call([
'meson', 'setup', 'build',
'-Dprefix=%s' % (location,),
'-Drootprefix=%s' % (location,),
'-Dsysconfdir=%s/etc' % (location,),
'-Dsysvinit-path=%s/etc/init.d' % (location,),
'-Dsysvrcnd-path=%s/etc/rc.d' % (location,),
'-Dlocalstatedir=%s/var' % (location,),
'-Dcreate-log-dirs=False',
'-Dhwdb=False',
], cwd=workdir, env=env)
call(['meson', 'setup', 'build',], cwd=workdir, env=env)
call(['meson', 'compile', '-C', 'build/'], cwd=workdir, env=env)
call(['meson', 'install', '-C', 'build/'], cwd=workdir, env=env)
import os
# On some systems multiarch is detected, and then libraries go to
# x86_64-linux-gnu, and as there was no way to control this behaviour
# during meson setup build phase, simply link it to lib64, where other
# parts are looking for libraries
if os.path.exists(os.path.join(location, 'x86_64-linux-gnu')):
call(['ln', '-s', 'x86_64-linux-gnu', 'lib64'], cwd=location)
environment =
PATH=${coreutils:location}/bin:${gettext:location}/bin:${gperf:location}/bin:${intltool:location}/bin:${perl-XML-Parser:perl-PATH}:${pkgconfig:location}/bin:${xz-utils:location}/bin:%(PATH)s
PATH=${systemd-python:location}/bin:${meson:location}/bin:${ninja:location}/bin:${coreutils:location}/bin:${gettext:location}/bin:${gperf:location}/bin:${intltool:location}/bin:${perl-XML-Parser:perl-PATH}:${pkgconfig:location}/bin:${xz-utils:location}/bin:%(PATH)s
CPPFLAGS=-I${libcap:location}/include -I${util-linux:location}/include
LDFLAGS=-L${libcap:location}/lib -Wl,-rpath=${libcap:location}/lib -L${util-linux:location}/lib -Wl,-rpath=${util-linux:location}/lib
PKG_CONFIG_PATH=${util-linux:location}/lib/pkgconfig
......@@ -72,12 +72,6 @@ KVM instance parameters:
- hard-drive-url-check-certificate (default: True)
if virtual-hard-drive-url use self-signed https, then specify if https certificate should be verified or not
- external-disk-number (default: 0)
Number of additional disk to attach to this VM. Need slapformat to be configured for this feature.
- external-disk-size (default: 20)
- external-disk-format (default: qcow2)
additional disk format. should be in this list: ['qcow2', 'raw', 'vdi', 'vmdk', 'cloop', 'qed']
- enable-http-server (default: False)
Configure server that will help to get some files into the vm from http
require use-nat = True
......@@ -126,3 +120,83 @@ Updating boot-image-url-select
* update the ``boot-image-url-select`` in:
* ``instance-kvm-input-schema.json``
* ``instance-kvm-cluster-input-schema.json``
Migration to modern external-disk parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Note**: ``external-disk`` and old way are mutually exclusive, thus it will
result with not starting kvm and failing partition for sake of data
consistency.
Despite ``external-disk-number``, ``external-disk-size`` and
``external-disk-format`` are supported fully until unknown moment in the
future, it's advised to migrate to external-disk parameter as soon as possible,
as slapos.core ``slapos.cfg`` ``instance_storage_home`` can become obsoleted
and removed in future versions.
**Note**: Due to how technically ``instance_storage_home`` is implemented, such
migration requires full access to the Compute Node hosting given KVM instance.
Let's imagine that there is a kvm instance which was requested with parameters::
{
"external-disk-number": 2,
"external-disk-size": 10
}
After locating the partition on proper Compute Node, the node administrator
has to find the kvm processing running there with::
slapos node status slappartNN: | grep kvm-
The interesting part is the ``PID``, which can be used to find which disk paths
are configured for the running KVM process with::
ps axu | grep PID | grep --color DATA
It will be possible to find two entries pointing to ``DATA`` directory in the
partition::
-drive file=/srv/slapgrid/slappartNN/DATA/dataX/kvm_virtual_disk.qcow2,if=virtio
-drive file=/srv/slapgrid/slappartNN/DATA/dataY/kvm_virtual_disk.qcow2,if=virtio
**Attention**: Order of the disks is important.
The administrator shall provide absolute path to both for both disks::
readlink -f /srv/slapgrid/slappartNN/DATA/dataX/kvm_virtual_disk.qcow2 --> /<instance_storage_home>/dataX/slappartNN/kvm_virtual_disk.qcow2
readlink -f /srv/slapgrid/slappartNN/DATA/dataY/kvm_virtual_disk.qcow2 --> /<instance_storage_home>/dataY/slappartNN/kvm_virtual_disk.qcow2
And now it will be safe to use the paths in ``external-disk`` parameter::
{
"external-disk": {
"first": {
"path": "/<instance_storage_home>/dataX/slappartNN/kvm_virtual_disk.qcow2",
"index": 1
},
"second": {
"path": "/<instance_storage_home>/dataY/slappartNN/kvm_virtual_disk.qcow2",
"index": 2
}
}
}
Of course ``external-disk-number`` and ``external-disk-size`` HAVE TO be removed
from instance parameters before continuing.
For now such configuration will lead to no starting kvm process, so after
parameters are updated in SlapOS Master **and** are processed on the Compute
Node The administrator shall release the images from automatic detection by
removing files:
* ``etc/.data-disk-amount``
* ``etc/.data-disk-ids``
from the partition (typically ``/srv/slapgrid/slappartNN/`` directory).
The failure observed to confirm the situation can be found in
``.slappartNN_kvm-HASH.log`` with presence of message like::
qemu-system-x86_64: -drive file=/<instance_storage_home>/dataX/slappartNN/kvm_virtual_disk.qcow2,if=virtio,cache=writeback: Failed to get "write" lock
Is another process using the image [/<instance_storage_home>/dataX/slappartNN/kvm_virtual_disk.qcow2]?
......@@ -19,11 +19,11 @@ md5sum = 7e90da1f6dac4233e1aa3248f48e357c
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = 4a3f999a8d1705c0cabf58d563953d4d
md5sum = 44dc93281f2fffe64d014754fae1b38a
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 406bf455afe1c71cb0e8cc04dd877f1d
md5sum = c00608f94ff6cfd8d37a280267c7227f
[template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2
......@@ -55,7 +55,7 @@ md5sum = a8cf453d20f01c707f02c4b4014580d8
[template-kvm-run]
filename = template/template-kvm-run.in
md5sum = 6c100eec00de5e53f64b075dd69a9865
md5sum = 7da4fcd815cb7abe318d8ac4b98c8cf3
[template-kvm-controller]
filename = template/kvm-controller-run.in
......
......@@ -392,34 +392,6 @@
"type": "boolean",
"default": true
},
"external-disk-number": {
"title": "Number of additional disk to create for virtual machine",
"description": "Specify the number of additional disk to create for virtual machine in data folder of SlapOS Node. Requires instance_storage_home to be configured on SlapOS Node.",
"type": "integer",
"minimum": 0,
"default": 0
},
"external-disk-size": {
"title": "Size of additional disk to create for virtual machine, in Gigabytes",
"description": "Specify the size of additional disk to create for virtual machine in data folder of SlapOS Node. Requires instance_storage_home to be configured on SlapOS Node.",
"type": "integer",
"minimum": 5,
"default": 20
},
"external-disk-format": {
"title": "Type of external disk drive to create by QEMU.",
"description": "Type of QEMU disk drive, to create.",
"type": "string",
"default": "qcow2",
"enum": [
"qcow2",
"raw",
"vdi",
"vmdk",
"cloop",
"qed"
]
},
"wipe-disk-ondestroy": {
"title": "Wipe disks when destroy the VM",
"description": "Say if disks should be wiped by writing new data over every single bit before delete them. This option is used to securely delete VM disks",
......@@ -546,6 +518,58 @@
"description": "List of whitelisted domain names to be accessed from the VM. They will be resolved to IPs depending on where the VM end up. IPs can be used too.",
"type": "string",
"textarea": true
},
"external-disk": {
"title": "External disks",
"description": "Allows to set paths and types of manually provided external disks. Use index to order disks. Changing this parameter leads to kvm process restart.",
"type": "object",
"default": {},
"patternProperties": {
".*": {
"properties": {
"path": {
"title": "Path of the provided image",
"description": "Absolute or relative path (to the partition root path) of the provided image. Image has to be provided, with read and write permissions of the partition user. Please note, that if the name starts with 'rbd:' it's considered special and won't be used as relative path.",
"type": "string"
},
"format": {
"title": "Format of a disk image",
"description": "Format of a disk image. Note: rbd type is experimental.",
"type": "string",
"default": "autodetect",
"enum": [
"autodetect",
"qcow2",
"rbd",
"raw",
"vdi",
"vmdk",
"cloop",
"qed"
]
},
"cache": {
"title": "Cache value for the disk",
"description": "Cache value directly passed to the kvm -drive invocation as cache=value.",
"type": "string",
"default": "writeback",
"enum": [
"writeback",
"none",
"unsafe",
"directsync",
"writethrough"
]
},
"index": {
"title": "Index of a disk",
"description": "An index value used to order disks for the VM, required if more than one disk is used to have stable ordering.",
"type": "integer",
"default": 0
}
}
}
}
}
},
"type": "object"
......
......@@ -139,7 +139,7 @@ config-wipe-disk-iterations = {{ dumps(kvm_parameter_dict.get('wipe-disk-iterati
config-document-host = ${apache-conf:ip}
config-document-port = ${apache-conf:port}
config-document-path = ${hash-code:passwd}
{%- for k in ['boot-image-url-list', 'boot-image-url-select', 'whitelist-domains'] %}
{%- for k in ['boot-image-url-list', 'boot-image-url-select', 'whitelist-domains', 'external-disk'] %}
{#- play nice - use parameter only if present #}
{%- if k in kvm_parameter_dict %}
{#- play safe - dumps value #}
......
......@@ -193,34 +193,6 @@
"type": "boolean",
"default": true
},
"external-disk-number": {
"title": "Number of additional disk to create for virtual machine",
"description": "Specify the number of additional disk to create for virtual machine in data folder of SlapOS Node. Requires instance_storage_home to be configured on SlapOS Node.",
"type": "integer",
"minimum": 0,
"default": 0
},
"external-disk-size": {
"title": "Size of additional disk to create for virtual machine, in Gigabytes",
"description": "Specify the size of additional disk to create for virtual machine in data folder of SlapOS Node. Requires instance_storage_home to be configured on SlapOS Node.",
"type": "integer",
"minimum": 1,
"default": 20
},
"external-disk-format": {
"title": "Type of external disk drive to create by QEMU.",
"description": "Type of QEMU disk drive, to create.",
"type": "string",
"default": "qcow2",
"enum": [
"qcow2",
"raw",
"vdi",
"vmdk",
"cloop",
"qed"
]
},
"wipe-disk-ondestroy": {
"title": "Wipe disks when destroy the VM",
"description": "Say if disks should be wiped by writing new data over every single bit before delete them. This option is used to securely delete VM disks",
......@@ -403,6 +375,58 @@
"description": "List of whitelisted domain names to be accessed from the VM. They will be resolved to IPs depending on where the VM end up. IPs can be used too.",
"type": "string",
"textarea": true
},
"external-disk": {
"title": "External disks",
"description": "Allows to set paths and types of manually provided external disks. Use index to order disks. Changing this parameter leads to kvm process restart.",
"type": "object",
"default": {},
"patternProperties": {
".*": {
"properties": {
"path": {
"title": "Path of the provided image",
"description": "Absolute or relative path (to the partition root path) of the provided image. Image has to be provided, with read and write permissions of the partition user. Please note, that if the name starts with 'rbd:' it's considered special and won't be used as relative path.",
"type": "string"
},
"format": {
"title": "Format of a disk image",
"description": "Format of a disk image. Note: rbd type is experimental.",
"type": "string",
"default": "autodetect",
"enum": [
"autodetect",
"qcow2",
"rbd",
"raw",
"vdi",
"vmdk",
"cloop",
"qed"
]
},
"cache": {
"title": "Cache value for the disk",
"description": "Cache value directly passed to the kvm -drive invocation as cache=value.",
"type": "string",
"default": "writeback",
"enum": [
"writeback",
"none",
"unsafe",
"directsync",
"writethrough"
]
},
"index": {
"title": "Index of a disk",
"description": "An index value used to order disks for the VM, required if more than one disk is used to have stable ordering.",
"type": "integer",
"default": 0
}
}
}
}
}
}
}
......@@ -471,6 +471,9 @@ disk-storage-list =
external-disk-number = ${slap-parameter:external-disk-number}
external-disk-size = ${slap-parameter:external-disk-size}
external-disk-format = ${slap-parameter:external-disk-format}
# new external-disk parameter
external-disk = ${slap-parameter:external-disk}
instance-root = ${buildout:directory}
{% if enable_http -%}
httpd-port = ${slap-parameter:httpd-port}
......@@ -1091,6 +1094,7 @@ hard-drive-url-check-certificate = True
external-disk-number = 0
external-disk-size = 20
external-disk-format = qcow2
external-disk = {}
# Help to get some configuration files into the vm from http
enable-http-server = False
......
......@@ -12,6 +12,7 @@ from random import shuffle
import glob
import re
import json
import operator
# XXX: give all of this through parameter, don't use this as template, but as module
qemu_img_path = {{ repr(parameter_dict["qemu-img-path"]) }}
......@@ -46,6 +47,10 @@ pid_file_path = '{{ parameter_dict.get("pid-file-path") }}'
external_disk_number = {{ parameter_dict.get("external-disk-number") }}
external_disk_size = {{ parameter_dict.get("external-disk-size") }}
external_disk_format = {{ repr(parameter_dict["external-disk-format"]) }}
external_disk = {{ parameter_dict['external-disk'] }}
if int(external_disk_number) > 0 and len(external_disk) > 0:
raise ValueError("external-disk-number and external-disk are mutually exclusive.")
instance_root = '{{ parameter_dict['instance-root'] }}'
disk_storage_dict = {}
disk_storage_list = """{{ parameter_dict.get("disk-storage-list") }}""".split('\n')
map_storage_list = []
......@@ -273,7 +278,7 @@ ram = '%sM,slots=128,maxmem=%sM' % (init_ram_size, ram_max_size)
kvm_argument_list = [qemu_path,
'-enable-kvm', '-smp', smp, '-name', vm_name, '-m', ram, '-vga', 'std',
'-vnc', '%s:1,ipv4,password' % listen_ip,
'-vnc', '%s:1,ipv4=on,password=on' % listen_ip,
'-boot', 'order=cd,menu=on',
'-qmp', 'unix:%s,server,nowait' % socket_path,
'-pidfile', pid_file_path, '-msg', 'timestamp=on',
......@@ -305,6 +310,32 @@ for disk in additional_disk_list:
kvm_argument_list.extend([
'-drive', 'file=%s,if=%s' % (disk, disk_type)])
# support external-disk parameter
# allow empty index if only one disk is provided
if len(external_disk) > 1:
for key, value in external_disk.items():
if 'index' not in value:
raise ValueError('index is missing and more than one disk is present in external-disk configuration')
for disk_info in sorted(external_disk.values(), key=operator.itemgetter('index')):
if disk_info['path'].startswith('rbd:') or disk_info['path'].startswith('/'):
path = disk_info['path']
else:
path = os.path.join(instance_root, disk_info['path'])
drive_argument_list = [
"file=%s" %( path,),
"if=%s" % (disk_type,),
"cache=%s" % (disk_info.get('cache', 'writeback'),)
]
if disk_info.get('format', 'autodetect') != 'autodetect':
drive_argument_list.append(
"format=%s" % (disk_info['format'],)
)
kvm_argument_list += (
'-drive',
",".join(drive_argument_list)
)
if auto_ballooning:
kvm_argument_list.extend(['-device', 'virtio-balloon-pci,id=balloon0'])
......
......@@ -1868,8 +1868,25 @@ class TestParameterCluster(TestParameterDefault):
return 'kvm-cluster'
class ExternalDiskMixin(KvmMixin):
def getRunningDriveList(self, kvm_instance_partition):
_match_drive = re.compile('file.*if=virtio.*').match
with self.slap.instance_supervisor_rpc as instance_supervisor:
kvm_pid = next(q for q in instance_supervisor.getAllProcessInfo()
if 'kvm-' in q['name'])['pid']
drive_list = []
for entry in psutil.Process(kvm_pid).cmdline():
m = _match_drive(entry)
if m:
path = m.group(0)
drive_list.append(
path.replace(kvm_instance_partition, '${partition}')
)
return drive_list
@skipUnlessKvm
class TestExternalDisk(InstanceTestCase, KvmMixin):
class TestExternalDisk(InstanceTestCase, ExternalDiskMixin):
__partition_reference__ = 'ed'
kvm_instance_partition_reference = 'ed0'
......@@ -1958,21 +1975,6 @@ class TestExternalDisk(InstanceTestCase, KvmMixin):
super(TestExternalDisk, cls).tearDownClass()
shutil.rmtree(cls.working_directory)
def getRunningDriveList(self, kvm_instance_partition):
_match_drive = re.compile('file=(.+),if=virtio').match
with self.slap.instance_supervisor_rpc as instance_supervisor:
kvm_pid = next(q for q in instance_supervisor.getAllProcessInfo()
if 'kvm-' in q['name'])['pid']
dirve_list = []
for entry in psutil.Process(kvm_pid).cmdline():
m = _match_drive(entry)
if m:
path = m.group(1)
dirve_list.append(
path.replace(kvm_instance_partition, '${partition}')
)
return dirve_list
def test(self):
kvm_instance_partition = os.path.join(
self.slap.instance_directory, self.kvm_instance_partition_reference)
......@@ -2005,3 +2007,191 @@ class TestExternalDisk(InstanceTestCase, KvmMixin):
class TestExternalDiskJson(
KvmMixinJson, TestExternalDisk):
pass
@skipUnlessKvm
class TestExternalDiskModern(InstanceTestCase, ExternalDiskMixin):
__partition_reference__ = 'edm'
kvm_instance_partition_reference = 'edm0'
@classmethod
def getInstanceSoftwareType(cls):
return 'default'
@classmethod
def setUpClass(cls):
super(TestExternalDiskModern, cls).setUpClass()
def getExternalDiskInstanceParameterDict(
self, first, second, third, update_dict=None):
parameter_dict = {
"external-disk": {
"second disk": {
"path": second,
"index": 2,
},
"third disk": {
"path": third,
"index": 3,
"cache": "none"
},
"first disk": {
"path": first,
"index": 1,
"format": "qcow"
},
}
}
if update_dict is not None:
parameter_dict.update(update_dict)
return parameter_dict
def test(self):
# Disks can't be created in /tmp, as it's specially mounted on testnodes
# and then KVM can't use them:
# -drive file=/tmp/tmpX/third_disk,if=virtio,cache=none: Could not open
# '/tmp/tmpX/third_disk': filesystem does not support O_DIRECT
self.working_directory = tempfile.mkdtemp(dir=self.slap.instance_directory)
self.addCleanup(shutil.rmtree, self.working_directory)
kvm_instance_partition = os.path.join(
self.slap.instance_directory, self.kvm_instance_partition_reference)
# find qemu_img from the tested SR via it's partition parameter, as
# otherwise qemu-kvm would be dependency of test suite
with open(
os.path.join(self.computer_partition_root_path, 'buildout.cfg')) as fh:
qemu_img = [
q for q in fh.readlines()
if 'raw qemu_img_executable_location' in q][0].split()[-1]
self.first_disk = os.path.join(self.working_directory, 'first_disk')
subprocess.check_call([
qemu_img, "create", "-f", "qcow", self.first_disk, "1M"])
second_disk = 'second_disk'
self.second_disk = os.path.join(kvm_instance_partition, second_disk)
subprocess.check_call([
qemu_img, "create", "-f", "qcow2", os.path.join(
kvm_instance_partition, self.second_disk), "1M"])
self.third_disk = os.path.join(self.working_directory, 'third_disk')
subprocess.check_call([
qemu_img, "create", "-f", "qcow2", self.third_disk, "1M"])
self.rerequestInstance({'_': json.dumps(
self.getExternalDiskInstanceParameterDict(
self.first_disk, second_disk, self.third_disk))})
self.waitForInstance()
drive_list = self.getRunningDriveList(kvm_instance_partition)
self.assertEqual(
drive_list,
[
'file=${partition}/srv/virtual.qcow2,if=virtio,discard=on,'
'format=qcow2',
'file=%s/first_disk,if=virtio,cache=writeback,format=qcow' % (
self.working_directory,),
'file=${partition}/second_disk,if=virtio,cache=writeback',
'file=%s/third_disk,if=virtio,cache=none' % (
self.working_directory,)
]
)
update_dict = {
"external-disk-number": 1,
"external-disk-size": 100,
"external-disk-format": "qcow2",
}
parameter_dict = self.getExternalDiskInstanceParameterDict(
self.first_disk, second_disk, self.third_disk, update_dict)
# assert mutual exclusivity
self.rerequestInstance({'_': json.dumps(parameter_dict)})
self.raising_waitForInstance(3)
@skipUnlessKvm
class TestExternalDiskModernCluster(TestExternalDiskModern):
kvm_instance_partition_reference = 'edm1'
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({
"kvm-partition-dict": {
"kvm-default": {
"disable-ansible-promise": True,
}
}
})}
@classmethod
def getInstanceSoftwareType(cls):
return 'kvm-cluster'
def getExternalDiskInstanceParameterDict(self, *args, **kwargs):
partition_dict = super(
TestExternalDiskModernCluster, self
).getExternalDiskInstanceParameterDict(*args, **kwargs)
partition_dict.update({"disable-ansible-promise": True})
return {
"kvm-partition-dict": {
"kvm-default": partition_dict
}
}
@skipUnlessKvm
class TestExternalDiskModernIndexRequired(InstanceTestCase, ExternalDiskMixin):
__partition_reference__ = 'edm'
kvm_instance_partition_reference = 'edm0'
@classmethod
def getInstanceSoftwareType(cls):
return 'default'
@classmethod
def setUpClass(cls):
super(TestExternalDiskModernIndexRequired, cls).setUpClass()
def getExternalDiskInstanceParameterDict(self, first, second, third):
return {
"external-disk": {
"second disk": {
"path": second,
},
"third disk": {
"path": third,
"index": 3,
},
"first disk": {
"path": first,
"index": 1,
},
}
}
def test(self):
# Disks can't be created in /tmp, as it's specially mounted on testnodes
# and then KVM can't use them:
# -drive file=/tmp/tmpX/third_disk,if=virtio,cache=none: Could not open
# '/tmp/tmpX/third_disk': filesystem does not support O_DIRECT
self.working_directory = tempfile.mkdtemp(dir=self.slap.instance_directory)
self.addCleanup(shutil.rmtree, self.working_directory)
kvm_instance_partition = os.path.join(
self.slap.instance_directory, self.kvm_instance_partition_reference)
# find qemu_img from the tested SR via it's partition parameter, as
# otherwise qemu-kvm would be dependency of test suite
with open(
os.path.join(self.computer_partition_root_path, 'buildout.cfg')) as fh:
qemu_img = [
q for q in fh.readlines()
if 'raw qemu_img_executable_location' in q][0].split()[-1]
self.first_disk = os.path.join(self.working_directory, 'first_disk')
subprocess.check_call([
qemu_img, "create", "-f", "qcow", self.first_disk, "1M"])
second_disk = 'second_disk'
self.second_disk = os.path.join(kvm_instance_partition, second_disk)
subprocess.check_call([
qemu_img, "create", "-f", "qcow2", os.path.join(
kvm_instance_partition, self.second_disk), "1M"])
self.third_disk = os.path.join(self.working_directory, 'third_disk')
subprocess.check_call([
qemu_img, "create", "-f", "qcow2", self.third_disk, "1M"])
self.rerequestInstance({'_': json.dumps(
self.getExternalDiskInstanceParameterDict(
self.first_disk, second_disk, self.third_disk))})
self.raising_waitForInstance(10)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment