cout << " --context context in which the script runs. one of: preRequest, postRequest\n";
cout << " --package name of the lua package that should be added/removed to/from the allowlist\n";
cout << " --allow-compilation package is allowed to compile C code as part of its installation\n";
+ cout << "\nradoslist options:\n";
+ cout << " --rgw-obj-fs the field separator that will separate the rados\n";
+ cout << " object name from the rgw object name;\n";
+ cout << " additionally rados objects for incomplete\n";
+ cout << " multipart uploads will not be output\n";
cout << "\n";
generic_client_usage();
}
SimpleCmd cmd(all_cmds, cmd_aliases);
+ std::optional<std::string> rgw_obj_fs; // radoslist field separator
+
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
if (ceph_argparse_double_dash(args, i)) {
break;
script_package = val;
} else if (ceph_argparse_binary_flag(args, i, &allow_compilation, NULL, "--allow-compilation", (char*)NULL)) {
// do nothing
+ } else if (ceph_argparse_witharg(args, i, &val, "--rgw-obj-fs", (char*)NULL)) {
+ rgw_obj_fs = val;
} else if (strncmp(*i, "-", 1) == 0) {
cerr << "ERROR: invalid flag " << *i << std::endl;
return EINVAL;
if (opt_cmd == OPT::BUCKET_RADOS_LIST) {
RGWRadosList lister(store,
max_concurrent_ios, orphan_stale_secs, tenant);
+ if (rgw_obj_fs) {
+ lister.set_field_separator(*rgw_obj_fs);
+ }
+
if (bucket_name.empty()) {
ret = lister.run(dpp());
} else {
int RGWRadosList::handle_stat_result(RGWRados::Object::Stat::Result& result,
+ std::string& bucket_name,
+ rgw_obj_key& obj_key,
std::set<string>& obj_oids)
{
obj_oids.clear();
return 0;
}
+ bucket_name = bucket.name;
+ obj_key = result.obj.key;
+
if (!result.manifest) {
/* a very very old object, or part of a multipart upload during upload */
obj_oids.insert(oid);
RGWObjectCtx& obj_ctx,
std::deque<RGWRados::Object::Stat>& ops)
{
- std::set<string> obj_oids;
+ std::string bucket_name;
+ rgw_obj_key obj_key;
+ std::set<std::string> obj_oids;
RGWRados::Object::Stat& front_op = ops.front();
int ret = front_op.wait();
goto done;
}
- ret = handle_stat_result(front_op.result, obj_oids);
+ ret = handle_stat_result(front_op.result, bucket_name, obj_key, obj_oids);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: handle_stat_result() returned error: " <<
cpp_strerror(-ret) << dendl;
// output results
for (const auto& o : obj_oids) {
- std::cout << o << std::endl;
+ if (include_rgw_obj_name) {
+ std::cout << o <<
+ field_separator << bucket_name <<
+ field_separator << obj_key <<
+ std::endl;
+ } else {
+ std::cout << o << std::endl;
+ }
}
done:
{
RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx();
RGWObjectCtx obj_ctx(store);
+ RGWBucketInfo bucket_info;
int ret;
add_bucket_entire(start_bucket_name);
}
} // while (! bucket_process_map.empty())
+ if (include_rgw_obj_name) {
+ goto done;
+ }
+
// now handle incomplete multipart uploads by going back to the
// initial bucket
- RGWBucketInfo bucket_info;
ret = store->getRados()->get_bucket_info(store->svc(),
tenant_name,
start_bucket_name,
return ret;
}
+done:
+
return 0;
} // RGWRadosList::run(string)
*
*/
-#ifndef CEPH_RGW_ORPHAN_H
-#define CEPH_RGW_ORPHAN_H
+#pragma once
#include "common/config.h"
#include "common/Formatter.h"
uint64_t stale_secs;
std::string tenant_name;
+ bool include_rgw_obj_name;
+ std::string field_separator;
+
int handle_stat_result(RGWRados::Object::Stat::Result& result,
+ std::string& bucket_name,
+ rgw_obj_key& obj_key,
std::set<string>& obj_oids);
int pop_and_handle_stat_op(RGWObjectCtx& obj_ctx,
std::deque<RGWRados::Object::Stat>& ops);
store(_store),
max_concurrent_ios(_max_ios),
stale_secs(_stale_secs),
- tenant_name(_tenant_name)
+ tenant_name(_tenant_name),
+ include_rgw_obj_name(false)
{}
int process_bucket(const DoutPrefixProvider *dpp,
int run(const DoutPrefixProvider *dpp, const std::string& bucket_id);
int run(const DoutPrefixProvider *dpp);
-}; // class RGWRadosList
-#endif
+ // if there's a non-empty field separator, that means we'll display
+ // bucket and object names
+ void set_field_separator(const std::string& fs) {
+ field_separator = fs;
+ include_rgw_obj_name = !field_separator.empty();
+ }
+}; // class RGWRadosList
--package name of the lua package that should be added/removed to/from the allowlist
--allow-compilation package is allowed to compile C code as part of its installation
+ radoslist options:
+ --rgw-obj-fs the field separator that will separate the rados
+ object name from the rgw object name;
+ additionally rados objects for incomplete
+ multipart uploads will not be output
+
--conf/-c FILE read configuration from the given configuration file
--id ID set ID portion of my name
--name/-n TYPE.ID set name