From: Soumya Koduri Date: Thu, 3 Oct 2024 18:14:11 +0000 (+0530) Subject: Merge pull request #59311 from soumyakoduri/wip-skoduri-cloud-restore X-Git-Tag: v20.0.0~916 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d53ffb11de9ab3ddae8a64ce6a6d51a745745340;p=ceph.git Merge pull request #59311 from soumyakoduri/wip-skoduri-cloud-restore rgw/cloudtier: initial MVP of the feature RestoreObject from cloud Reviewed-by: Daniel Gryniewicz Reviewed-by: Matt Benjamin --- d53ffb11de9ab3ddae8a64ce6a6d51a745745340 diff --cc src/rgw/driver/rados/rgw_rados.cc index 5dc0663ec76,693d464d731..b8db0bfa17d --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@@ -6641,10 -6858,30 +6859,29 @@@ int RGWRados::set_attrs(const DoutPrefi iter != state->attrset.end()) { storage_class = rgw_bl_str(iter->second); } - uint64_t epoch = ioctx.get_last_version(); int64_t poolid = ioctx.get_id(); + + // Retain Object category as CloudTiered while restore is in + // progress or failed + RGWObjCategory category = RGWObjCategory::Main; + auto r_iter = attrs.find(RGW_ATTR_RESTORE_STATUS); + if (r_iter != attrs.end()) { + rgw::sal::RGWRestoreStatus st = rgw::sal::RGWRestoreStatus::None; + auto iter = r_iter->second.cbegin(); + + try { + using ceph::decode; + decode(st, iter); + + if (st != rgw::sal::RGWRestoreStatus::CloudRestored) { + category = RGWObjCategory::CloudTiered; + } + } catch (buffer::error& err) { + } + } r = index_op.complete(dpp, poolid, epoch, state->size, state->accounted_size, mtime, etag, content_type, storage_class, owner, - RGWObjCategory::Main, nullptr, y, nullptr, false, log_op); + category, nullptr, y, nullptr, false, log_op); } else { int ret = index_op.cancel(dpp, nullptr, y, log_op); if (ret < 0) {