mirror of
https://github.com/ceph/ceph
synced 2025-03-07 00:40:00 +00:00
rados, test: Restrict usage of --prefix in cleanup
As a precaution to using cleanup for mass deletion of other objects, only allow --prefix which begins with "benchmark_data." Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
parent
4e0b0d9a7e
commit
79669c4b06
@ -418,6 +418,11 @@ test_cleanup() {
|
||||
die "Different objects found after cleanup"
|
||||
fi
|
||||
|
||||
set +e
|
||||
run_expect_fail $RADOS_TOOL -p $p cleanup --prefix illegal_prefix
|
||||
run_expect_succ $RADOS_TOOL -p $p cleanup --prefix benchmark_data_otherhost
|
||||
set -e
|
||||
|
||||
$RADOS_TOOL rmpool $p $p --yes-i-really-really-mean-it
|
||||
}
|
||||
|
||||
|
@ -1089,6 +1089,11 @@ int ObjBencher::clean_up(const std::string& orig_prefix, int concurrentios, cons
|
||||
const std::string run_name_meta = (run_name.empty() ? BENCH_LASTRUN_METADATA : run_name);
|
||||
const std::string prefix = (orig_prefix.empty() ? generate_object_prefix_nopid() : orig_prefix);
|
||||
|
||||
if (prefix.substr(0, BENCH_PREFIX.length()) != BENCH_PREFIX) {
|
||||
cerr << "Specified --prefix invalid, it must begin with \"" << BENCH_PREFIX << "\"" << std::endl;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
std::list<Object> unfiltered_objects;
|
||||
std::set<std::string> meta_namespaces, all_namespaces;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user