summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-02-22 19:08:12 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-02-22 19:08:12 (GMT)
commite4b71d49a12d384e89931a620428e950dd98e4e8 (patch)
tree94798cf8cb723798fc7fda00a281b712ccdfb427
parent3964f612eba8872d6fc8778f2523fd4bce47f649 (diff)
parent0e402e436d0c58acc72e45ab6153d5662b3148e0 (diff)
downloadhdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.zip
hdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.tar.gz
hdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.tar.bz2
Merge pull request #1574 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:hdf5_rados to hdf5_rados
* commit '0e402e436d0c58acc72e45ab6153d5662b3148e0': Updated the tests to use mobject. Added a RADOS/mobject #ifdef switch. Moved the rados_stat() modifications into a helper function. Finished implementation of RADOS wrappers for calls not implemented in mobject. * Added a rados_read() wrapper function (still uses rados_read()). * Some cleanup in the write wrapper. rados_write_full calls now use write_ops. Added a helper function to wrap rados_write_full(). Both rados_stats calls are wrapped. You can #define OLD_RADOS_CALLS to enable the old way of doing things. Converted one of the stats calls to use a read op instead. * Added a script to run the RADOS examples in order. * Updated BRANCH.txt with useful information about building and testing. * Makefile.am now installs everything you need as well as the test script.
-rw-r--r--BRANCH.txt92
-rw-r--r--examples/Makefile.am3
-rw-r--r--examples/h5rados_dset_create.c2
-rw-r--r--examples/h5rados_dset_open.c2
-rw-r--r--examples/h5rados_dset_read.c2
-rw-r--r--examples/h5rados_dset_rpartial.c2
-rw-r--r--examples/h5rados_dset_wpartial.c2
-rw-r--r--examples/h5rados_dset_write.c2
-rw-r--r--examples/h5rados_example.h8
-rw-r--r--examples/h5rados_file_create.c2
-rw-r--r--examples/h5rados_file_open.c2
-rw-r--r--examples/h5rados_group_create.c2
-rw-r--r--examples/h5rados_group_open.c2
-rw-r--r--examples/run_mobject_examples.sh48
-rwxr-xr-xexamples/run_rados_examples.sh71
-rw-r--r--src/H5VLrados.c204
-rw-r--r--src/H5VLrados_public.h4
17 files changed, 415 insertions, 35 deletions
diff --git a/BRANCH.txt b/BRANCH.txt
index 2cbc975..a0605bf 100644
--- a/BRANCH.txt
+++ b/BRANCH.txt
@@ -1,15 +1,87 @@
-autotools_rework
+This branch is a copy of Neil's RADOS VOL connector branch.
+Very few changes have been made to the branch so it stays
+as a 'known good' version of the connector.
-The purpose of this branch is to make changes to the autotools files,
-particularly configure.ac. This will remove a lot of old cruft and update
-the input files. This effort was started in January 2015 and should be
-completed within the year.
+This is based off the ancient 'vol' branch and is wildy
+out of sync with develop. You will not be able to move
+the RADOS VOL connector built here to HDF5 1.12.0 without
+a lot of surgery. The rados_vol branch in this repository
+is kept in sync with develop and is probably the one
+you want for that.
-This branch tracks the trunk.
+Note that this is a dead branch, so no effort has been
+made to keep the MANIFEST sane, etc.
-Dana Robinson and Allen Byrne are the owners of this branch.
+************
+* BUILDING *
+************
-This branch should be closed when the bulk of the autotools work is
-complete and has been merged into the trunk and 1.8 branch. This
-work should be completed by mid-2015.
+RADOS:
+
+The code for the RADOS VOL connector lies entirely in
+the H5VLrados* files in the src directory. The connector
+is built as a static part of the library.
+
+I build this branch on Ubuntu, with the system default
+librados-dev package and its dependencies installed. I use
+the autotools and the only thing I have to specify is the
+linker flags:
+
+LDFLAGS="-L/path/to/librados -lrados"
+
+YMMV, but the autotools do no librados hunting so you may
+need to specify things it can't figure out on its own.
+
+MOBJECT:
+
+You'll need to be able to find the headers and libs for
+mobject-store. You do not need the RADOS libraries.
+
+On jelly (THG), this will work:
+
+export SPACK_ROOT=/mnt/hdf/jsoumagne/spack
+source $SPACK_ROOT/share/spack/setup-env.sh
+module load GCC
+source <(spack module tcl loads --dependencies mobject)
+
+You will also need to define HDF5_USE_MOBJECT in CPPFLAGS.
+This switches between the RADOS and mobject headers.
+
+
+***********
+* TESTING *
+***********
+
+There are no tests for the RADOS VOL connector in the main
+library, so running 'make check' won't provide much
+information.
+
+RADOS:
+
+Once the library has been built, you can run some smoke
+checks by running 'make install' and going to the
+share/hdf5_examples/c/ directory and running the
+run_rados_examples.sh script found there. That will
+create a small pool (or clear it out if it exists)
+and run all the example scripts in a sane order.
+
+*** YOU WILL NEED TO COPY YOUR ceph.conf FILE
+*** INTO THIS DIRECTORY FIRST!!!
+
+In case it's not obvious, you'll need an active Ceph
+cluster to run the tests :)
+
+MOBJECT:
+
+Same as above, only the script's name is run_mobject_examples.sh.
+
+You can probably ignore any sdskv_put warnings as long as the
+examples pass.
+
+The tests are hard-coded to use /tmp/mobject-clust-test.gid and
+this can be changed in h5rados_example.h.
+
+So to start mobject-server:
+
+mobject-server-daemon na+sm /tmp/mobject-cluster-test.gid
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 323541f..7e56f86 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -63,7 +63,8 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \
h5rados_file_create.c h5rados_file_open.c h5rados_group_create.c \
h5rados_group_open.c h5rados_dset_create.c \
h5rados_dset_open.c h5rados_dset_write.c h5rados_dset_read.c \
- h5rados_dset_wpartial.c h5rados_dset_rpartial.c
+ h5rados_dset_wpartial.c h5rados_dset_rpartial.c \
+ h5rados_example.h run_rados_examples.sh run_mobject_examples.sh
diff --git a/examples/h5rados_dset_create.c b/examples/h5rados_dset_create.c
index 0e14a7f..2ec6bfa 100644
--- a/examples/h5rados_dset_create.c
+++ b/examples/h5rados_dset_create.c
@@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_open.c b/examples/h5rados_dset_open.c
index 19e29ed..a0d4fa7 100644
--- a/examples/h5rados_dset_open.c
+++ b/examples/h5rados_dset_open.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_read.c b/examples/h5rados_dset_read.c
index fc7292c..5dbb91d 100644
--- a/examples/h5rados_dset_read.c
+++ b/examples/h5rados_dset_read.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_rpartial.c b/examples/h5rados_dset_rpartial.c
index 622b961..f6faad7 100644
--- a/examples/h5rados_dset_rpartial.c
+++ b/examples/h5rados_dset_rpartial.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_wpartial.c b/examples/h5rados_dset_wpartial.c
index bb53982..048625e 100644
--- a/examples/h5rados_dset_wpartial.c
+++ b/examples/h5rados_dset_wpartial.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_write.c b/examples/h5rados_dset_write.c
index dad96fa..17e6898 100644
--- a/examples/h5rados_dset_write.c
+++ b/examples/h5rados_dset_write.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_example.h b/examples/h5rados_example.h
index 4516b15..8da9487 100644
--- a/examples/h5rados_example.h
+++ b/examples/h5rados_example.h
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <mpi.h>
#include <hdf5.h>
-#include <rados/librados.h>
#include <H5VLrados_public.h>
/* Macros for printing standard messages and issuing errors */
@@ -12,3 +11,10 @@
#define ERROR do {FAILED(); AT(); goto error;} while(0)
#define PRINTF_ERROR(...) do {FAILED(); AT(); printf(" " __VA_ARGS__); printf("\n"); goto error;} while(0)
+/* Config file */
+#ifdef HDF5_USE_MOBJECT
+#define CEPH_CONFIG_FILE "/tmp/mobject-cluster-test.gid"
+#else
+#define CEPH_CONFIG_FILE "ceph.conf"
+#endif
+
diff --git a/examples/h5rados_file_create.c b/examples/h5rados_file_create.c
index 493be18..04101b3 100644
--- a/examples/h5rados_file_create.c
+++ b/examples/h5rados_file_create.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_file_open.c b/examples/h5rados_file_open.c
index 176d26e..881ab10 100644
--- a/examples/h5rados_file_open.c
+++ b/examples/h5rados_file_open.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_group_create.c b/examples/h5rados_group_create.c
index fcfbbc0..68c6a6d 100644
--- a/examples/h5rados_group_create.c
+++ b/examples/h5rados_group_create.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_group_open.c b/examples/h5rados_group_open.c
index 3339480..4fde06c 100644
--- a/examples/h5rados_group_open.c
+++ b/examples/h5rados_group_open.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/run_mobject_examples.sh b/examples/run_mobject_examples.sh
new file mode 100644
index 0000000..767387d
--- /dev/null
+++ b/examples/run_mobject_examples.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Build mobject examples.
+# Assumes mobject stuff can be found
+echo "Building mobject examples"
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_file_create h5rados_file_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_file_open h5rados_file_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_create h5rados_dset_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_open h5rados_dset_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_group_create h5rados_group_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_group_open h5rados_group_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_write h5rados_dset_write.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_read h5rados_dset_read.c
+
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_rpartial h5rados_dset_rpartial.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_wpartial h5rados_dset_wpartial.c
+echo "DONE"
+echo
+
+# Run the mobject examples
+echo "Running mobject examples"
+# File create/open
+echo "./h5rados_file_create testfile"
+mpiexec -n 2 ./h5rados_file_create testfile
+echo "./h5rados_file_open testfile"
+mpiexec -n 2 ./h5rados_file_open testfile
+# Dataset create/open
+echo "./h5rados_dset_create testfile testdset"
+mpiexec -n 2 ./h5rados_dset_create testfile testdset
+echo "./h5rados_dset_open testfile testdset"
+mpiexec -n 2 ./h5rados_dset_open testfile testdset
+# Group create/open
+echo "./h5rados_group_create testfile testgroup"
+mpiexec -n 2 ./h5rados_group_create testfile testgroup
+echo "./h5rados_group_open testfile testgroup"
+mpiexec -n 2 ./h5rados_group_open testfile testgroup
+# Dataset read/write
+echo "./h5rados_dset_write testfile testdset"
+mpiexec -n 2 ./h5rados_dset_write testfile testdset
+echo "./h5rados_dset_read testfile testdset"
+mpiexec -n 2 ./h5rados_dset_read testfile testdset
+# Dataset read/write (partial)
+echo "./h5rados_dset_wpartial testfile testdset"
+mpiexec -n 2 ./h5rados_dset_wpartial testfile testdset
+echo "./h5rados_dset_rpartial testfile testdset"
+mpiexec -n 2 ./h5rados_dset_rpartial testfile testdset
+echo
+
diff --git a/examples/run_rados_examples.sh b/examples/run_rados_examples.sh
new file mode 100755
index 0000000..7782a56
--- /dev/null
+++ b/examples/run_rados_examples.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+# Build RADOS examples.
+# Assumes RADOS can be found in the usual location.
+echo "Building RADOS examples"
+../../../bin/h5pcc -o h5rados_file_create h5rados_file_create.c -lrados
+../../../bin/h5pcc -o h5rados_file_open h5rados_file_open.c -lrados
+../../../bin/h5pcc -o h5rados_dset_create h5rados_dset_create.c -lrados
+../../../bin/h5pcc -o h5rados_dset_open h5rados_dset_open.c -lrados
+../../../bin/h5pcc -o h5rados_group_create h5rados_group_create.c -lrados
+../../../bin/h5pcc -o h5rados_group_open h5rados_group_open.c -lrados
+../../../bin/h5pcc -o h5rados_dset_write h5rados_dset_write.c -lrados
+../../../bin/h5pcc -o h5rados_dset_read h5rados_dset_read.c -lrados
+
+../../../bin/h5pcc -o h5rados_dset_rpartial h5rados_dset_rpartial.c -lrados
+../../../bin/h5pcc -o h5rados_dset_wpartial h5rados_dset_wpartial.c -lrados
+echo "DONE"
+echo
+
+# Create the pool
+echo "Creating the test pool"
+echo "(Ceph makes it hard to delete pools, so we never do that"
+echo "and you may see a message that the pool already exists.)"
+ceph osd pool create mypool 128
+echo
+
+# Dump some Ceph info
+echo "Pool status at start of tests:"
+rados -p mypool ls
+echo
+
+# Clean out the test pool
+echo "Cleaning out the test pool"
+for i in $(rados -p mypool ls); do echo $i; rados -p mypool rm $i; done
+echo
+
+# Run the RADOS examples
+echo "Running RADOS examples"
+# File create/open
+echo "./h5rados_file_create testfile"
+mpiexec -n 2 ./h5rados_file_create testfile
+echo "./h5rados_file_open testfile"
+mpiexec -n 2 ./h5rados_file_open testfile
+# Dataset create/open
+echo "./h5rados_dset_create testfile testdset"
+mpiexec -n 2 ./h5rados_dset_create testfile testdset
+echo "./h5rados_dset_open testfile testdset"
+mpiexec -n 2 ./h5rados_dset_open testfile testdset
+# Group create/open
+echo "./h5rados_group_create testfile testgroup"
+mpiexec -n 2 ./h5rados_group_create testfile testgroup
+echo "./h5rados_group_open testfile testgroup"
+mpiexec -n 2 ./h5rados_group_open testfile testgroup
+# Dataset read/write
+echo "./h5rados_dset_write testfile testdset"
+mpiexec -n 2 ./h5rados_dset_write testfile testdset
+echo "./h5rados_dset_read testfile testdset"
+mpiexec -n 2 ./h5rados_dset_read testfile testdset
+# Dataset read/write (partial)
+echo "./h5rados_dset_wpartial testfile testdset"
+mpiexec -n 2 ./h5rados_dset_wpartial testfile testdset
+echo "./h5rados_dset_rpartial testfile testdset"
+mpiexec -n 2 ./h5rados_dset_rpartial testfile testdset
+echo
+
+
+# Dump the Ceph info again
+echo "Pool status at end of tests:"
+rados -p mypool ls
+echo
+
diff --git a/src/H5VLrados.c b/src/H5VLrados.c
index 76a865e..0ee5c92 100644
--- a/src/H5VLrados.c
+++ b/src/H5VLrados.c
@@ -200,6 +200,11 @@ static herr_t H5VL_rados_file_flush(H5VL_rados_file_t *file);
static herr_t H5VL_rados_file_close_helper(H5VL_rados_file_t *file,
hid_t dxpl_id, void **req);
+/* read/write_op equivalents for some RADOS calls */
+static int H5VL_rados_read(rados_ioctx_t io, const char *oid, char *buf, size_t len, uint64_t off);
+static int H5VL_rados_write_full(rados_ioctx_t io, const char *oid, const char *buf, size_t len);
+static int H5VL_rados_stat(rados_ioctx_t io, const char *oid, uint64_t *psize, time_t * pmtime);
+
static herr_t H5VL_rados_link_read(H5VL_rados_group_t *grp, const char *name,
H5VL_rados_link_val_t *val);
static herr_t H5VL_rados_link_write(H5VL_rados_group_t *grp, const char *name,
@@ -348,6 +353,179 @@ rados_ioctx_t ioctx_g;
hbool_t ioctx_init_g = FALSE;
+/*-------------------------------------------------------------------------
+ * Function: H5VL_rados_read
+ *
+ * Purpose: Recreates rados_read(). We are trying to use all read_op
+ * calls and this lets us do that without duplicating all
+ * the RADOS boilerplate.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * February, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5VL_rados_read(rados_ioctx_t io, const char *oid, char *buf, size_t len, uint64_t off)
+{
+ int ret = 0;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef OLD_RADOS_CALLS
+ /* Read data from the object */
+ if((ret = rados_read(io, oid, buf, len, off)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, (-1), "can't read metadata from dataset: %s", strerror(-ret))
+#else
+{
+ rados_read_op_t read_op;
+ hbool_t read_op_init = FALSE;
+ size_t bytes_read = 0;
+ int prval;
+
+ /* Create read op */
+ if(NULL == (read_op = rados_create_read_op()))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't create read operation")
+ read_op_init = TRUE;
+
+ /* Add the read operation (returns void) */
+ rados_read_op_read(read_op, off, len, buf, &bytes_read, &prval);
+
+ /* Execute read operation */
+ if((ret = rados_read_op_operate(read_op, io, oid, LIBRADOS_OPERATION_NOFLAG)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't perform read operation: %s", strerror(-ret))
+ if(0 < prval)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, (-1), "RADOS read operation failed for object")
+ if(0 == bytes_read)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, (-1), "metadata not found for object")
+
+ /* clean up */
+ if(read_op_init)
+ rados_release_read_op(read_op);
+}
+#endif
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_rados_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_rados_write_full
+ *
+ * Purpose: Recreates rados_write_full(). We are trying to use all
+ * write_op calls and this lets us do that without duplicating
+ * all the RADOS boilerplate.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * February, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5VL_rados_write_full(rados_ioctx_t io, const char *oid, const char *buf, size_t len)
+{
+ int ret = 0;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef OLD_RADOS_CALLS
+ if((ret = rados_write_full(io, oid, buf, len)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't write metadata to object: %s", strerror(-ret))
+#else
+{
+ rados_write_op_t write_op;
+ hbool_t write_op_init = FALSE;
+
+ /* Create write op */
+ if(NULL == (write_op = rados_create_write_op()))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't create write operation")
+ write_op_init = TRUE;
+
+ /* Add the write full operation (returns void) */
+ rados_write_op_write_full(write_op, buf, len);
+
+ /* Execute write operation */
+ if((ret = rados_write_op_operate(write_op, io, oid, NULL, LIBRADOS_OPERATION_NOFLAG)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't perform write operation: %s", strerror(-ret))
+
+ /* clean up */
+ if(write_op_init)
+ rados_release_write_op(write_op);
+}
+#endif
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_rados_write_full() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_rados_stat
+ *
+ * Purpose: Recreates rados_stat(). We are trying to use all read_op
+ * calls and this lets us do that without duplicating all
+ * the RADOS boilerplate.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * February, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5VL_rados_stat(rados_ioctx_t io, const char *oid, uint64_t *psize, time_t * pmtime)
+{
+ int ret = 0;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef OLD_RADOS_CALLS
+ /* Get the object size and time */
+ if((ret = rados_stat(io, oid, psize, pmtime)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, (-1), "can't read object size and time: %s", strerror(-ret))
+#else
+{
+ rados_read_op_t read_op;
+ hbool_t read_op_init = FALSE;
+ int prval;
+
+ /* Create read op */
+ if(NULL == (read_op = rados_create_read_op()))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't create read operation")
+ read_op_init = TRUE;
+
+ /* Add the get stats operation (returns void) */
+ rados_read_op_stat(read_op, psize, pmtime, &prval);
+
+ /* Execute read operation */
+ if((ret = rados_read_op_operate(read_op, io, oid, LIBRADOS_OPERATION_NOFLAG)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, (-1), "can't perform read operation: %s", strerror(-ret))
+ if(0 < prval)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, (-1), "stats not found for object")
+
+ /* clean up */
+ if(read_op_init)
+ rados_release_read_op(read_op);
+}
+#endif
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_rados_stat() */
+
+
/* Create a RADOS string oid given the file name and binary oid */
static herr_t
H5VL_rados_oid_create_string(const H5VL_rados_file_t *file, uint64_t bin_oid,
@@ -964,7 +1142,7 @@ H5VL_rados_file_open(const char *name, unsigned flags, hid_t fapl_id,
/* Read max oid directly to foi_buf */
/* Check for does not exist here and assume 0? -NAF */
- if((ret = rados_read(ioctx_g, file->glob_md_oid, foi_buf, 8, 0)) < 0)
+ if((ret = H5VL_rados_read(ioctx_g, file->glob_md_oid, foi_buf, 8, 0)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, NULL, "can't read metadata from dataset: %s", strerror(-ret))
/* Decode max oid */
@@ -1272,7 +1450,7 @@ H5VL_rados_write_max_oid(H5VL_rados_file_t *file)
UINT64ENCODE(p, file->max_oid)
- if((ret = rados_write_full(ioctx_g, file->glob_md_oid, (const char *)wbuf, (size_t)8)) < 0)
+ if((ret = H5VL_rados_write_full(ioctx_g, file->glob_md_oid, (const char *)wbuf, (size_t)8)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't write metadata to group: %s", strerror(-ret))
file->max_oid_dirty = FALSE;
} /* end if */
@@ -1822,7 +2000,7 @@ H5VL_rados_group_create_helper(H5VL_rados_file_t *file, hid_t gcpl_id,
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, NULL, "can't serialize gcpl")
/* Write internal metadata to group */
- if((ret = rados_write_full(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_size)) < 0)
+ if((ret = H5VL_rados_write_full(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_size)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't write metadata to group: %s", strerror(-ret))
/* Mark max OID as dirty */
@@ -1946,8 +2124,8 @@ H5VL_rados_group_open_helper(H5VL_rados_file_t *file, uint64_t oid,
{
H5VL_rados_group_t *grp = NULL;
void *gcpl_buf = NULL;
- uint64_t gcpl_len;
- time_t pmtime;
+ uint64_t gcpl_len = 0;
+ time_t pmtime = 0;
int ret;
void *ret_value = NULL;
@@ -1965,8 +2143,8 @@ H5VL_rados_group_open_helper(H5VL_rados_file_t *file, uint64_t oid,
grp->gcpl_id = FAIL;
grp->gapl_id = FAIL;
- /* Read internal metadata size from group */
- if((ret = rados_stat(ioctx_g, grp->obj.oid, &gcpl_len, &pmtime)) < 0)
+ /* Get the object size and time */
+ if((ret = H5VL_rados_stat(ioctx_g, grp->obj.oid, &gcpl_len, &pmtime)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, NULL, "can't read metadata size from group: %s", strerror(-ret))
/* Check for metadata not found */
@@ -1978,7 +2156,7 @@ H5VL_rados_group_open_helper(H5VL_rados_file_t *file, uint64_t oid,
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for serialized gcpl")
/* Read internal metadata from group */
- if((ret = rados_read(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_len, 0)) < 0)
+ if((ret = H5VL_rados_read(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_len, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, NULL, "can't read metadata from group: %s", strerror(-ret))
/* Decode GCPL */
@@ -2674,7 +2852,7 @@ H5VL_rados_dataset_create(void *_item,
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, NULL, "can't serialize dcpl")
/* Write internal metadata to dataset */
- if((ret = rados_write_full(ioctx_g, dset->obj.oid, (const char *)md_buf, md_size)) < 0)
+ if((ret = H5VL_rados_write_full(ioctx_g, dset->obj.oid, (const char *)md_buf, md_size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't write metadata to dataset: %s", strerror(-ret))
/* Mark max OID as dirty */
@@ -2746,7 +2924,7 @@ H5VL_rados_dataset_open(void *_item,
uint64_t type_len = 0;
uint64_t space_len = 0;
uint64_t dcpl_len = 0;
- time_t pmtime;
+ time_t pmtime = 0;
uint8_t dinfo_buf_static[H5VL_RADOS_DINFO_BUF_SIZE];
uint8_t *dinfo_buf_dyn = NULL;
uint8_t *dinfo_buf = dinfo_buf_static;
@@ -2804,8 +2982,8 @@ H5VL_rados_dataset_open(void *_item,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't encode string oid")
} /* end else */
- /* Read internal metadata size from dataset */
- if((ret = rados_stat(ioctx_g, dset->obj.oid, &md_len, &pmtime)) < 0)
+ /* Get the object size and time */
+ if((ret = H5VL_rados_stat(ioctx_g, dset->obj.oid, &md_len, &pmtime)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, NULL, "can't read metadata size from group: %s", strerror(-ret))
/* Check for metadata not found */
@@ -2820,7 +2998,7 @@ H5VL_rados_dataset_open(void *_item,
} /* end if */
/* Read internal metadata from dataset */
- if((ret = rados_read(ioctx_g, dset->obj.oid, (char *)(dinfo_buf + sizeof(uint64_t)), md_len, 0)) < 0)
+ if((ret = H5VL_rados_read(ioctx_g, dset->obj.oid, (char *)(dinfo_buf + sizeof(uint64_t)), md_len, 0)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, NULL, "can't read metadata from dataset: %s", strerror(-ret))
/* Decode info lengths */
diff --git a/src/H5VLrados_public.h b/src/H5VLrados_public.h
index 65ee9f4..e49339b 100644
--- a/src/H5VLrados_public.h
+++ b/src/H5VLrados_public.h
@@ -25,7 +25,11 @@
#define H5_HAVE_EFF 1 /* DSMINC */
/* External headers needed by this file */
+#ifdef HDF5_USE_MOBJECT
+#include <librados-mobject-store.h>
+#else
#include <rados/librados.h>
+#endif
/* Public headers needed by this file */
#include "H5public.h"