Skip to content

Commit

Permalink
Merge pull request #544 from bareos/dev/pstorz/master/vmware-test
Browse files Browse the repository at this point in the history
vmware plugin: merge into subdirectories, add system test
  • Loading branch information
pstorz committed Jul 1, 2020
2 parents fd28191 + d7eab7f commit 0c7cc18
Show file tree
Hide file tree
Showing 75 changed files with 989 additions and 261 deletions.
25 changes: 13 additions & 12 deletions core/CMakeLists.txt
Expand Up @@ -20,13 +20,13 @@
cmake_minimum_required(VERSION 3.0)
project(bareos C CXX)

if (POLICY CMP0054)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif (POLICY CMP0054)
endif(POLICY CMP0054)

if (POLICY CMP0057)
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif (POLICY CMP0057)
endif(POLICY CMP0057)

# disable in-source builds
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
Expand Down Expand Up @@ -62,13 +62,14 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
if(${compiler_format_security})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat")
endif()
check_cxx_compiler_flag(-Werror=format-security compiler_error_format_security)
check_cxx_compiler_flag(
-Werror=format-security compiler_error_format_security
)
if(${compiler_error_format_security})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
endif()
endif()


option(DEBUG_PREFIX_MAP
"remap absolute debug paths to relative if compiler supports it" ON
)
Expand Down Expand Up @@ -236,15 +237,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(PSCMD "ps -e -o pid,comm")
link_libraries(nsl socket curses sec)


if (${CMAKE_C_COMPILER_ID} MATCHES SunPro)
if(${CMAKE_C_COMPILER_ID} MATCHES SunPro)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif()

if (${CMAKE_CXX_COMPILER_ID} MATCHES SunPro)
if(${CMAKE_CXX_COMPILER_ID} MATCHES SunPro)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
endif()
endif()
Expand Down Expand Up @@ -749,9 +749,7 @@ message(" Host: ${host} -- ${PLATFORM} ${DISTVER} ")
message(
" Bareos version: ${BAREOS} ${BAREOS_FULL_VERSION} (${DATE}) "
)
message(
" Build platform: ${PLATFORM}"
)
message(" Build platform: ${PLATFORM}")
message(" Source code location: ${srcdir} ")
message(" Modify Debian Control file: ${GENERATE_DEBIAN_CONTROL} ")
message(" Install binaries: ${bindir} ")
Expand Down Expand Up @@ -830,6 +828,9 @@ message(
message(
" JANSSON support: ${JANSSON_FOUND} ${JANSSON_LIBRARIES} ${JANSSON_INCLUDE_DIRS} "
)
message(
" VIXDISKLIB support: ${VIXDISKLIB_FOUND} ${VIXDISKLIB_LIBRARIES} ${VIXDISKLIB_INCLUDE_DIRS} "
)
message(" LMDB support: ${lmdb} ")
message(" NDMP support: ${ndmp} ")
message(" Build ndmjob binary: ${build_ndmjob} ")
Expand Down
79 changes: 59 additions & 20 deletions core/cmake/BareosFindAllLibraries.cmake
Expand Up @@ -24,14 +24,7 @@ endif()

if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# make sure we get python 2 not 3
set(
Python_ADDITIONAL_VERSIONS
2.5
2.6
2.7
2.8
2.9
)
set(Python_ADDITIONAL_VERSIONS 2.5 2.6 2.7 2.8 2.9)
find_package(PythonInterp)
include(FindPythonLibs)

Expand All @@ -55,34 +48,80 @@ endif()

include(BareosFindLibraryAndHeaders)

bareosfindlibraryandheaders("jansson" "jansson.h")
bareosfindlibraryandheaders("rados" "rados/librados.h")
bareosfindlibraryandheaders("radosstriper" "radosstriper/libradosstriper.h")
bareosfindlibraryandheaders("cephfs" "cephfs/libcephfs.h")
bareosfindlibraryandheaders("pthread" "pthread.h")
bareosfindlibraryandheaders("cap" "sys/capability.h")
bareosfindlibraryandheaders("gfapi" "glusterfs/api/glfs.h")
bareosfindlibraryandheaders("droplet" "droplet.h")
bareosfindlibraryandheaders(
"vixDiskLib" "vixDiskLib.h" "/usr/lib/vmware-vix-disklib-distrib;/usr/lib/vmware-vix-disklib"
)

# check for structmember physicalSectorSize in struct VixDiskLibCreateParams
if(VIXDISKLIB_FOUND)
include(CheckStructHasMember)
CHECK_STRUCT_HAS_MEMBER("VixDiskLibCreateParams" physicalSectorSize
${VIXDISKLIB_INCLUDE_DIRS}/vixDiskLib.h VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE)
endif()

if(VIXDISKLIB_FOUND)
if((NOT DEFINED vmware_server)
OR (NOT DEFINED vmware_user)
OR (NOT DEFINED vmware_password)
OR (NOT DEFINED vmware_datacenter)
OR (NOT DEFINED vmware_folder)
)
string(
CONCAT
MSG
"VMware Vix Disklib was found. To enable the vmware plugin test, "
"please provide the required information:"
"example:"
" -Dvmware_user=Administrator@vsphere.local "
" -Dvmware_password=\"@one2threeBareos\" "
" -Dvmware_vm_name=testvm1 "
" -Dvmware_datacenter=mydc1 "
" -Dvmware_folder=\"/webservers\" "
" -Dvmware_server=139.178.73.195"
)
message(WARNING ${MSG})
else()
set(enable_vmware_test 1 PARENT_SCOPE)
endif()
elseif(
(DEFINED vmware_server)
OR (DEFINED vmware_user)
OR (DEFINED vmware_password)
OR (DEFINED vmware_datacenter)
OR (DEFINED vmware_folder)
)
message(
FATAL_ERROR "vmware options were set but VMware Vix Disklib was not found. Cannot run vmware tests."
)
endif()

bareosfindlibraryandheaders("jansson" "jansson.h" "")
bareosfindlibraryandheaders("rados" "rados/librados.h" "")
bareosfindlibraryandheaders("radosstriper" "radosstriper/libradosstriper.h" "")
bareosfindlibraryandheaders("cephfs" "cephfs/libcephfs.h" "")
bareosfindlibraryandheaders("pthread" "pthread.h" "")
bareosfindlibraryandheaders("cap" "sys/capability.h" "")
bareosfindlibraryandheaders("gfapi" "glusterfs/api/glfs.h" "")
bareosfindlibraryandheaders("droplet" "droplet.h" "")

bareosfindlibraryandheaders("pam" "security/pam_appl.h")
bareosfindlibraryandheaders("pam" "security/pam_appl.h" "")

bareosfindlibraryandheaders("lzo2" "lzo/lzoconf.h")
bareosfindlibraryandheaders("lzo2" "lzo/lzoconf.h" "")
if(${LZO2_FOUND})
set(HAVE_LZO 1)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LZO2_LIBRARIES "/usr/local/opt/lzo/lib/liblzo2.a")
endif()
endif()

# MESSAGE(FATAL_ERROR "exit")
include(BareosFindLibrary)

bareosfindlibrary("tirpc")
bareosfindlibrary("util")
bareosfindlibrary("dl")
bareosfindlibrary("acl")
# BareosFindLibrary("wrap")
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES SunPro)
if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES SunPro)
bareosfindlibrary("gtest")
bareosfindlibrary("gtest_main")
bareosfindlibrary("gmock")
Expand Down
8 changes: 4 additions & 4 deletions core/cmake/BareosFindLibraryAndHeaders.cmake
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
# Copyright (C) 2017-2020 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -19,7 +19,7 @@

# generic macro to find libraries and headers

macro(BareosFindLibraryAndHeaders LIBNAME HEADERFILE)
macro(BareosFindLibraryAndHeaders LIBNAME HEADERFILE ADDITIONAL_PATHS)
message(STATUS "checking for library ${LIBNAME} and ${HEADERFILE} header ...")

string(TOUPPER ${LIBNAME} LIBNAME_UPCASE)
Expand All @@ -28,8 +28,8 @@ macro(BareosFindLibraryAndHeaders LIBNAME HEADERFILE)
set(FOUND_VAR_NAME ${LIBNAME_UPCASE}_FOUND)
set(HAVE_VAR_NAME HAVE_${LIBNAME_UPCASE})

find_path(${INCLUDE_VAR_NAME} NAMES ${HEADERFILE})
find_library(${LIB_VAR_NAME} NAMES ${LIBNAME})
find_path(${INCLUDE_VAR_NAME} NAMES ${HEADERFILE} PATHS ${ADDITIONAL_PATHS} PATH_SUFFIXES include)
find_library(${LIB_VAR_NAME} NAMES ${LIBNAME} PATHS ${ADDITIONAL_PATHS} PATH_SUFFIXES lib64)

# MESSAGE(STATUS "find path result for ${INCLUDE_VAR_NAME} is
# ${${INCLUDE_VAR_NAME}}") MESSAGE(STATUS "find library result for
Expand Down
7 changes: 6 additions & 1 deletion core/cmake/BareosGenerateDebianInfo.cmake
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2019 Bareos GmbH & Co. KG
# Copyright (C) 2018-2020 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -51,4 +51,9 @@ if(GENERATE_DEBIAN_CONTROL)
DEBIAN_CONTROL_UNIVENTION_BAREOS)
endif()

if (VIXDISKLIB_FOUND)
file(READ ./debian/control.vmware
DEBIAN_CONTROL_VMWARE)
endif()

endif()
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions core/debian/control.in
Expand Up @@ -333,3 +333,5 @@ Description: Backup Archiving Recovery Open Sourced - common tools
@DEBIAN_CONTROL_TRAYMONITOR@

@DEBIAN_CONTROL_UNIVENTION_BAREOS@

@DEBIAN_CONTROL_VMWARE@
26 changes: 6 additions & 20 deletions vmware/debian/control → core/debian/control.vmware
@@ -1,21 +1,7 @@
Source: bareos-vmware
Section: admin
Priority: extra
Maintainer: packager@bareos.com
Build-Depends:
cmake (>= 3.0.0) | cmake-mozilla,
debhelper (>= 8.0.0),
libjansson-dev,
bareos-vmware-vix-disklib-dev
Standards-Version: 3.9.3
Homepage: http://www.bareos.org/
Vcs-Git: git://github.com/bareos/bareos.git
Vcs-Browser: https://github.com/bareos/bareos-vmware

Package: bareos-vmware-plugin
Architecture: any
Depends: bareos-vadp-dumper, bareos-filedaemon-python-plugin (>= 15.2), python-pyvmomi
Description: Bareos VMware plugin
Description: Bareos VMware plugin
Uses the VMware API to take snapshots of running VMs and takes
full and incremental backup so snapshots. Restore of a snapshot
is currently supported to the origin VM.
Expand All @@ -39,9 +25,9 @@ Description: vStorage APIs for Data Protection Dumper program
# This package only contains the distributable code to comply with
# https://communities.vmware.com/viewwebdoc.jspa?documentID=DOC-10141

Package: bareos-vmware-plugin-compat
Architecture: any
Depends: bareos-vmware-plugin
Description: Bareos VMware plugin compatibility
Keeps bareos/plugins/vmware_plugin subdirectory, which have been used in Bareos <= 16.2.
#Package: bareos-vmware-plugin-compat
#Architecture: any
#Depends: bareos-vmware-plugin
#Description: Bareos VMware plugin compatibility
# Keeps bareos/plugins/vmware_plugin subdirectory, which have been used in Bareos <= 16.2.

2 changes: 1 addition & 1 deletion core/debian/rules
Expand Up @@ -126,7 +126,7 @@ override_dh_makeshlibs:
dh_makeshlibs -n

override_dh_auto_test:
cd obj-x86_64-linux-gnu && make clean && make -j4 Continuous || echo "ctest failed"
cd obj-x86_64-linux-gnu && make clean && REGRESS_DEBUG=1 ctest -j 1 -V -D Continuous || echo "ctest failed"

override_dh_shlibdeps:
dh_shlibdeps -l$(shell pwd)/debian/tmp/usr/lib/bareos
Expand Down
3 changes: 0 additions & 3 deletions core/debian/watch

This file was deleted.

0 comments on commit 0c7cc18

Please sign in to comment.