diff options
author | J. Eric Ivancich <ivancich@redhat.com> | 2024-02-09 18:27:00 +0100 |
---|---|---|
committer | J. Eric Ivancich <ivancich@redhat.com> | 2024-02-09 18:47:15 +0100 |
commit | 575362d826f8f58832a2bb865b9dc73c474f4fe1 (patch) | |
tree | b235add293fb4bb9a34e46cf44d8d7f5e43d76d9 /src/rgw/rgw_admin.cc | |
parent | rgw: add new `object manifest` sub-command (diff) | |
download | ceph-575362d826f8f58832a2bb865b9dc73c474f4fe1.tar.xz ceph-575362d826f8f58832a2bb865b9dc73c474f4fe1.zip |
rgw: if head object does not have data, still include in `object manifest`
In order to enable users who might like to use `radosgw-admin object
manifest ...` to get a complete list of raw objects that comprise the
RGW object, we'll include the head object when it includes not
data. It will be indicated with an "index" of -1.
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
Diffstat (limited to 'src/rgw/rgw_admin.cc')
-rw-r--r-- | src/rgw/rgw_admin.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 081204c24f4..5fecee0dc02 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -8411,9 +8411,30 @@ next: RGWRados* rados = store->getRados(); + rgw_obj head_obj = obj->get_obj(); + rgw_raw_obj raw_head_obj; + store->get_raw_obj(m.get_head_placement_rule(), head_obj, &raw_head_obj); + formatter->open_array_section("objects"); unsigned index = 0; for (auto p = m.obj_begin(dpp()); p != m.obj_end(dpp()); ++p, ++index) { + rgw_raw_obj raw_obj = p.get_location().get_raw_obj(rados); + + if (index == 0 && raw_obj != raw_head_obj) { + // we have a head object without data, so let's include it + formatter->open_object_section("object"); // name not displayed since in array + + formatter->dump_int("index", -1); + formatter->dump_unsigned("offset", 0); + formatter->dump_unsigned("size", 0); + + formatter->open_object_section("raw_obj"); + raw_head_obj.dump(formatter.get()); + formatter->close_section(); // raw_obj + + formatter->close_section(); // object + } + formatter->open_object_section("object"); // name not displayed since in array formatter->dump_unsigned("index", index); @@ -8423,7 +8444,7 @@ next: formatter->dump_unsigned("size", p.get_stripe_size()); formatter->open_object_section("raw_obj"); - p.get_location().get_raw_obj(rados).dump(formatter.get()); + raw_obj.dump(formatter.get()); formatter->close_section(); // raw_obj formatter->close_section(); // object |