Merge PR #34044 into octopus

* refs/pull/34044/head:
	remove ceph_test_rados_watch_notify

Reviewed-by: Neha Ojha <nojha@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
Sage Weil 2020-03-19 13:47:29 -05:00
commit d75c7e79bf
4 changed files with 2 additions and 206 deletions

View File

@ -31,8 +31,7 @@ for f in \
api_c_read_operations \
list_parallel \
open_pools_parallel \
delete_pools_parallel \
watch_notify
delete_pools_parallel
do
if [ $parallel -eq 1 ]; then
r=`printf '%25s' $f`

View File

@ -6,9 +6,7 @@ set(libsystest_srcs
systest_settings.cc
st_rados_create_pool.cc
st_rados_delete_pool.cc
st_rados_list_objects.cc
st_rados_watch.cc
st_rados_notify.cc)
st_rados_list_objects.cc)
add_library(systest STATIC ${libsystest_srcs})
# test_rados_list_parallel
@ -41,25 +39,8 @@ add_executable(ceph_test_rados_delete_pools_parallel
target_link_libraries(ceph_test_rados_delete_pools_parallel librados systest global
pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
# test_rados_watch_notify
set(test_rados_watch_notify_srcs
rados_watch_notify.cc
st_rados_create_pool.cc
st_rados_delete_pool.cc
st_rados_delete_objs.cc
st_rados_watch.cc
st_rados_notify.cc
)
add_executable(ceph_test_rados_watch_notify
${test_rados_watch_notify_srcs}
)
target_link_libraries(ceph_test_rados_watch_notify
librados systest global
pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
install(TARGETS
ceph_test_rados_delete_pools_parallel
ceph_test_rados_list_parallel
ceph_test_rados_open_pools_parallel
ceph_test_rados_watch_notify
DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -1,81 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include "cross_process_sem.h"
#include "include/rados/librados.h"
#include "st_rados_notify.h"
#include "systest_runnable.h"
StRadosNotify::StRadosNotify(int argc, const char **argv,
CrossProcessSem *setup_sem,
CrossProcessSem *notify_sem,
CrossProcessSem *notified_sem,
int notify_retcode,
const std::string &pool_name,
const std::string &obj_name)
: SysTestRunnable(argc, argv),
m_setup_sem(setup_sem),
m_notify_sem(notify_sem),
m_notified_sem(notified_sem),
m_notify_retcode(notify_retcode),
m_pool_name(pool_name),
m_obj_name(obj_name)
{
}
StRadosNotify::~StRadosNotify()
{
}
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
int StRadosNotify::run()
{
rados_t cl;
RETURN1_IF_NONZERO(rados_create(&cl, NULL));
rados_conf_parse_argv(cl, m_argc, m_argv);
RETURN1_IF_NONZERO(rados_conf_read_file(cl, NULL));
rados_conf_parse_env(cl, NULL);
if (m_setup_sem) {
m_setup_sem->wait();
m_setup_sem->post();
}
rados_ioctx_t io_ctx;
RETURN1_IF_NONZERO(rados_connect(cl));
RETURN1_IF_NONZERO(rados_ioctx_create(cl, m_pool_name.c_str(), &io_ctx));
if (m_notify_sem) {
m_notify_sem->wait();
m_notify_sem->post();
}
printf("%s: notifying object %s\n", get_id_str(), m_obj_name.c_str());
RETURN1_IF_NOT_VAL(m_notify_retcode,
rados_notify(io_ctx, m_obj_name.c_str(), 0, NULL, 0));
if (m_notified_sem) {
m_notified_sem->post();
}
rados_ioctx_destroy(io_ctx);
rados_shutdown(cl);
return 0;
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic warning "-Wpragmas"

View File

@ -1,103 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include "cross_process_sem.h"
#include "include/rados/librados.h"
#include "st_rados_watch.h"
#include "systest_runnable.h"
void notify_cb(uint8_t opcode, uint64_t ver, void *arg)
{
int *notifies = reinterpret_cast<int*>(arg);
++(*notifies);
}
StRadosWatch::StRadosWatch(int argc, const char **argv,
CrossProcessSem *setup_sem,
CrossProcessSem *watch_sem,
CrossProcessSem *notify_sem,
int num_notifies,
int watch_retcode,
const std::string &pool_name,
const std::string &obj_name)
: SysTestRunnable(argc, argv),
m_setup_sem(setup_sem),
m_watch_sem(watch_sem),
m_notify_sem(notify_sem),
m_num_notifies(num_notifies),
m_watch_retcode(watch_retcode),
m_pool_name(pool_name),
m_obj_name(obj_name)
{
}
StRadosWatch::
~StRadosWatch()
{
}
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
int StRadosWatch::
run()
{
rados_t cl;
RETURN1_IF_NONZERO(rados_create(&cl, NULL));
rados_conf_parse_argv(cl, m_argc, m_argv);
RETURN1_IF_NONZERO(rados_conf_read_file(cl, NULL));
rados_conf_parse_env(cl, NULL);
if (m_setup_sem) {
m_setup_sem->wait();
m_setup_sem->post();
}
rados_ioctx_t io_ctx;
uint64_t handle;
int num_notifies = 0;
RETURN1_IF_NONZERO(rados_connect(cl));
RETURN1_IF_NONZERO(rados_ioctx_create(cl, m_pool_name.c_str(), &io_ctx));
printf("%s: watching object %s\n", get_id_str(), m_obj_name.c_str());
RETURN1_IF_NOT_VAL(m_watch_retcode,
rados_watch(io_ctx, m_obj_name.c_str(), 0, &handle,
reinterpret_cast<rados_watchcb_t>(notify_cb),
reinterpret_cast<void*>(&num_notifies))
);
if (m_watch_sem) {
m_watch_sem->post();
}
m_notify_sem->wait();
m_notify_sem->post();
int r = 0;
if (num_notifies < m_num_notifies) {
printf("Received fewer notifies than expected: %d < %d\n",
num_notifies, m_num_notifies);
r = 1;
}
if (m_watch_retcode == 0)
rados_unwatch(io_ctx, m_obj_name.c_str(), handle);
rados_ioctx_destroy(io_ctx);
rados_shutdown(cl);
return r;
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic warning "-Wpragmas"