// NOTE: please keep the checks in alphabetical order !!!
if (strcmp(cmd, "bi") == 0 ||
strcmp(cmd, "bilog") == 0 ||
- strcmp(cmd, "bucket") == 0 ||
strcmp(cmd, "buckets") == 0 ||
strcmp(cmd, "caps") == 0 ||
strcmp(cmd, "data") == 0 ||
return 0;
}
+ /*
+ * can do both radosgw-admin bucket reshard, and radosgw-admin reshard bucket
+ */
if (strcmp(cmd, "reshard") == 0 &&
!(prev_cmd && strcmp(prev_cmd, "bucket") == 0)) {
*need_more = true;
return 0;
}
+ if (strcmp(cmd, "bucket") == 0 &&
+ !(prev_cmd && strcmp(prev_cmd, "reshard") == 0)) {
+ *need_more = true;
+ return 0;
+ }
if (strcmp(cmd, "policy") == 0)
return OPT_POLICY;
if (strcmp(cmd, "delete") == 0)
return OPT_ROLE_POLICY_DELETE;
} else if (strcmp(prev_cmd, "reshard") == 0) {
+ if (strcmp(cmd, "bucket") == 0)
+ return OPT_BUCKET_RESHARD;
if (strcmp(cmd, "add") == 0)
return OPT_RESHARD_ADD;
if (strcmp(cmd, "list") == 0)
}
if (opt_cmd == OPT_RESHARD_EXECUTE) {
- RGWReshard reshard(store);
+ RGWReshard reshard(store, true, &cout);
int ret = reshard.process_all_logshards();
if (ret < 0) {
if (out) {
(*out) << "*** NOTICE: operation will not remove old bucket index objects ***" << std::endl;
(*out) << "*** these will need to be removed manually ***" << std::endl;
+ (*out) << "tenant: " << bucket_info.bucket.tenant << std::endl;
+ (*out) << "bucket name: " << bucket_info.bucket.name << std::endl;
(*out) << "old bucket instance id: " << bucket_info.bucket.bucket_id << std::endl;
(*out) << "new bucket instance id: " << new_bucket_info.bucket.bucket_id << std::endl;
}
}
-RGWReshard::RGWReshard(RGWRados* _store): store(_store), instance_lock(bucket_instance_lock_name)
+RGWReshard::RGWReshard(RGWRados* _store, bool _verbose, ostream *_out,
+ Formatter *_formatter) : store(_store), instance_lock(bucket_instance_lock_name),
+ verbose(_verbose), out(_out), formatter(_formatter)
{
num_logshards = store->ctx()->_conf->rgw_reshard_num_logs;
}
RGWBucketAdminOpState bucket_op;
RGWBucketReshard reshard_op(store, bucket_info, attrs);
ret = reshard_op.do_reshard(entry.new_num_shards, new_bucket_info,
- max_entries, false, nullptr, nullptr);
+ max_entries, verbose, out, formatter);
if (ret < 0) {
return ret;
}
rados::cls::lock::Lock instance_lock;
int num_logshards;
+ bool verbose;
+ ostream *out;
+ Formatter *formatter;
+
void get_logshard_oid(int shard_num, string *shard);
protected:
class ReshardWorker : public Thread {
void get_bucket_logshard_oid(const string& tenant, const string& bucket_name, string *oid);
public:
- RGWReshard(RGWRados* _store);
+ RGWReshard(RGWRados* _store, bool _verbose = false, ostream *_out = nullptr, Formatter *_formatter = nullptr);
int add(cls_rgw_reshard_entry& entry);
int get(cls_rgw_reshard_entry& entry);
int remove(cls_rgw_reshard_entry& entry);