cerr << " bucket unlink unlink bucket from specified user\n";
cerr << " bucket stats returns bucket statistics\n";
cerr << " bucket info show bucket information\n";
+ cerr << " object unlink unlink object from bucket index\n";
cerr << " pool add add an existing pool for data placement\n";
cerr << " pool rm remove an existing pool from data placement set\n";
cerr << " pools list list placement active set\n";
OPT_BUCKET_LINK,
OPT_BUCKET_UNLINK,
OPT_BUCKET_STATS,
+ OPT_OBJECT_UNLINK,
OPT_POLICY,
OPT_POOL_ADD,
OPT_POOL_RM,
strcmp(cmd, "key") == 0 ||
strcmp(cmd, "buckets") == 0 ||
strcmp(cmd, "bucket") == 0 ||
+ strcmp(cmd, "object") == 0 ||
strcmp(cmd, "pool") == 0 ||
strcmp(cmd, "pools") == 0 ||
strcmp(cmd, "log") == 0 ||
return OPT_BUCKET_UNLINK;
if (strcmp(cmd, "stats") == 0)
return OPT_BUCKET_STATS;
+ } else if (strcmp(prev_cmd, "object") == 0) {
+ if (strcmp(cmd, "unlink") == 0)
+ return OPT_OBJECT_UNLINK;
} else if (strcmp(prev_cmd, "log") == 0) {
if (strcmp(cmd, "list") == 0)
return OPT_LOG_LIST;
}
}
+ if (opt_cmd == OPT_OBJECT_UNLINK) {
+ int ret = rgwstore->remove_obj_from_index(bucket, object);
+ if (ret < 0) {
+ cerr << "ERROR: remove_obj_from_index() returned error: " << cpp_strerror(-ret) << std::endl;
+ return 1;
+ }
+ }
+
return 0;
}
return r;
}
+int RGWRados::remove_obj_from_index(rgw_bucket& bucket, const string& oid)
+{
+ librados::IoCtx io_ctx;
+
+ int r = open_bucket_ctx(bucket, io_ctx);
+ if (r < 0)
+ return r;
+
+ string dir_oid = dir_oid_prefix;
+ dir_oid.append(bucket.marker);
+
+ rgw_bucket_dir_entry entry;
+ entry.epoch = (uint64_t)-1; // ULLONG_MAX, needed to that objclass doesn't skip out request
+ entry.name = oid;
+
+ bufferlist updates;
+ updates.append(CEPH_RGW_REMOVE);
+ ::encode(entry, updates);
+
+ bufferlist out;
+
+ r = io_ctx.exec(dir_oid, "rgw", "dir_suggest_changes", updates, out);
+
+ return r;
+}
+
int RGWRados::check_disk_state(librados::IoCtx io_ctx,
rgw_bucket& bucket,
rgw_bucket_dir_entry& list_state,
/// clean up/process any temporary objects older than given date[/time]
int remove_temp_objects(string date, string time);
+ int remove_obj_from_index(rgw_bucket& bucket, const string& oid);
+
private:
int process_intent_log(rgw_bucket& bucket, string& oid,
time_t epoch, int flags, bool purge);
bucket unlink unlink bucket from specified user
bucket stats returns bucket statistics
bucket info show bucket information
+ object unlink unlink object from bucket index
pool add add an existing pool for data placement
pool rm remove an existing pool from data placement set
pools list list placement active set