Skip to content

Commit

Permalink
vmware: support new VDDK in bareos_vadp_dumper
Browse files Browse the repository at this point in the history
By cmake check for physicalSectorSize member in VixDiskLibCreateParams
the build of bareos_vadp_dumper now works with VDDK 6.5.2, 6.7.3 an 7.0

Original Author: Stephan Duehr <stephan.duehr@bareos.com>

(backported from commit 6dafbaf)
  • Loading branch information
arogge committed Dec 10, 2020
1 parent 55a043f commit 6c09f81
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vmware/vadp_dumper/CMakeLists.txt
Expand Up @@ -2,6 +2,20 @@ include_directories(/usr/lib/vmware-vix-disklib/include)
link_directories(/usr/lib/vmware-vix-disklib/lib64)
add_executable(bareos_vadp_dumper bareos_vadp_dumper.cc cbuf.cc copy_thread.cc)
target_link_libraries(bareos_vadp_dumper vixDiskLib pthread jansson)

include(CheckStructHasMember)
check_struct_has_member(
"VixDiskLibCreateParams" physicalSectorSize
/usr/lib/vmware-vix-disklib/include/vixDiskLib.h
VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE
)

if(VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE)
target_compile_definitions(
bareos_vadp_dumper PUBLIC VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE
)
endif()

install(TARGETS bareos_vadp_dumper DESTINATION "${CMAKE_INSTALL_SBINDIR}")
install(
FILES bareos_vadp_dumper_wrapper.sh
Expand Down
12 changes: 12 additions & 0 deletions vmware/vadp_dumper/bareos_vadp_dumper.cc
Expand Up @@ -681,6 +681,14 @@ static inline void do_vixdisklib_open(const char* key,
VixDiskLib_FreeErrorText(error_txt);
goto bail_out;
}
#ifdef VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE
if (verbose) {
fprintf(stderr, "DiskInfo logicalSectorSize: %u\n",
info->logicalSectorSize);
fprintf(stderr, "DiskInfo physicalSectorSize: %u\n",
info->physicalSectorSize);
}
#endif
}

if (verbose) {
Expand Down Expand Up @@ -737,6 +745,10 @@ static inline void do_vixdisklib_create(const char* key,
} else {
createParams.diskType = VIXDISKLIB_DISK_MONOLITHIC_SPARSE;
}
#ifdef VIXDISKLIBCREATEPARAMS_HAS_PHYSICALSECTORSIZE
createParams.physicalSectorSize = VIXDISKLIB_SECTOR_SIZE;
createParams.logicalSectorSize = VIXDISKLIB_SECTOR_SIZE;
#endif
createParams.hwVersion = 7; /* for ESX(i)4 */
err = VixDiskLib_Create(connection, disk_path, &createParams, NULL, NULL);
if (VIX_FAILED(err)) {
Expand Down

0 comments on commit 6c09f81

Please sign in to comment.