Skip to content

Commit ae67c20

Browse files
authored
Merge pull request ceph#63909 from yuvalif/wip-yuval-71638
rgw/logging: fix canonical names
2 parents a79e02a + 56c7537 commit ae67c20

File tree

7 files changed

+82
-86
lines changed

7 files changed

+82
-86
lines changed

src/rgw/rgw_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ struct req_info {
12551255
meta_map_t crypt_attribute_map;
12561256

12571257
std::string host;
1258-
const char *method;
1258+
const char *method = nullptr;
12591259
std::string script_uri;
12601260
std::string request_uri;
12611261
std::string request_uri_aws4;

src/rgw/rgw_op.h

Lines changed: 74 additions & 2 deletions
Large diffs are not rendered by default.

src/rgw/rgw_rest.h

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -129,39 +129,30 @@ class RGWGetObj_ObjStore : public RGWGetObj
129129
}
130130

131131
int get_params(optional_yield y) override;
132-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
133132
};
134133

135134
class RGWGetObjTags_ObjStore : public RGWGetObjTags {
136135
public:
137136
RGWGetObjTags_ObjStore() {};
138137
~RGWGetObjTags_ObjStore() {};
139-
140-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT_TAGGING", s->info.method); }
141138
};
142139

143140
class RGWPutObjTags_ObjStore: public RGWPutObjTags {
144141
public:
145142
RGWPutObjTags_ObjStore() {};
146143
~RGWPutObjTags_ObjStore() {};
147-
148-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT_TAGGING", s->info.method); }
149144
};
150145

151146
class RGWGetBucketTags_ObjStore : public RGWGetBucketTags {
152147
public:
153148
RGWGetBucketTags_ObjStore() = default;
154149
virtual ~RGWGetBucketTags_ObjStore() = default;
155-
156-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET_TAGGING", s->info.method); }
157150
};
158151

159152
class RGWPutBucketTags_ObjStore: public RGWPutBucketTags {
160153
public:
161154
RGWPutBucketTags_ObjStore() = default;
162155
virtual ~RGWPutBucketTags_ObjStore() = default;
163-
164-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET_TAGGING", s->info.method); }
165156
};
166157

167158
class RGWGetBucketReplication_ObjStore : public RGWGetBucketReplication {
@@ -186,56 +177,42 @@ class RGWListBuckets_ObjStore : public RGWListBuckets {
186177
public:
187178
RGWListBuckets_ObjStore() {}
188179
~RGWListBuckets_ObjStore() override {}
189-
190-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKETS", s->info.method); }
191180
};
192181

193182
class RGWGetUsage_ObjStore : public RGWGetUsage {
194183
public:
195184
RGWGetUsage_ObjStore() {}
196185
~RGWGetUsage_ObjStore() override {}
197-
198-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.USER_USAGE", s->info.method); }
199186
};
200187

201188
class RGWListBucket_ObjStore : public RGWListBucket {
202189
public:
203190
RGWListBucket_ObjStore() {}
204191
~RGWListBucket_ObjStore() override {}
205-
206-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET", s->info.method); }
207192
};
208193

209194
class RGWStatAccount_ObjStore : public RGWStatAccount {
210195
public:
211196
RGWStatAccount_ObjStore() {}
212197
~RGWStatAccount_ObjStore() override {}
213-
214-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.ACCOUNT_STATUS", s->info.method); }
215198
};
216199

217200
class RGWStatBucket_ObjStore : public RGWStatBucket {
218201
public:
219202
RGWStatBucket_ObjStore() {}
220203
~RGWStatBucket_ObjStore() override {}
221-
222-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET_STATUS", s->info.method); }
223204
};
224205

225206
class RGWCreateBucket_ObjStore : public RGWCreateBucket {
226207
public:
227208
RGWCreateBucket_ObjStore() {}
228209
~RGWCreateBucket_ObjStore() override {}
229-
230-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET", s->info.method); }
231210
};
232211

233212
class RGWDeleteBucket_ObjStore : public RGWDeleteBucket {
234213
public:
235214
RGWDeleteBucket_ObjStore() {}
236215
~RGWDeleteBucket_ObjStore() override {}
237-
238-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET", s->info.method); }
239216
};
240217

241218
class RGWPutObj_ObjStore : public RGWPutObj
@@ -247,11 +224,6 @@ class RGWPutObj_ObjStore : public RGWPutObj
247224
int verify_params() override;
248225
int get_params(optional_yield y) override;
249226
int get_data(bufferlist& bl) override;
250-
251-
virtual std::string canonical_name() const override {
252-
const bool multipart = !multipart_upload_id.empty();
253-
return fmt::format("REST.{}.{}", s->info.method, multipart ? "PART" : "OBJECT");
254-
}
255227
};
256228

257229
class RGWPostObj_ObjStore : public RGWPostObj
@@ -322,7 +294,6 @@ class RGWPostObj_ObjStore : public RGWPostObj
322294
~RGWPostObj_ObjStore() override {}
323295

324296
int verify_params() override;
325-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
326297
};
327298

328299

@@ -331,42 +302,32 @@ class RGWPutMetadataAccount_ObjStore : public RGWPutMetadataAccount
331302
public:
332303
RGWPutMetadataAccount_ObjStore() {}
333304
~RGWPutMetadataAccount_ObjStore() override {}
334-
335-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.ACCOUNT_METADATA", s->info.method); }
336305
};
337306

338307
class RGWPutMetadataBucket_ObjStore : public RGWPutMetadataBucket
339308
{
340309
public:
341310
RGWPutMetadataBucket_ObjStore() {}
342311
~RGWPutMetadataBucket_ObjStore() override {}
343-
344-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BUCKET_METADATA", s->info.method); }
345312
};
346313

347314
class RGWPutMetadataObject_ObjStore : public RGWPutMetadataObject
348315
{
349316
public:
350317
RGWPutMetadataObject_ObjStore() {}
351318
~RGWPutMetadataObject_ObjStore() override {}
352-
353-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT_METADATA", s->info.method); }
354319
};
355320

356321
class RGWRestoreObj_ObjStore : public RGWRestoreObj {
357322
public:
358323
RGWRestoreObj_ObjStore() {}
359324
~RGWRestoreObj_ObjStore() override {}
360-
361-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
362325
};
363326

364327
class RGWDeleteObj_ObjStore : public RGWDeleteObj {
365328
public:
366329
RGWDeleteObj_ObjStore() {}
367330
~RGWDeleteObj_ObjStore() override {}
368-
369-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
370331
};
371332

372333
class RGWGetCrossDomainPolicy_ObjStore : public RGWGetCrossDomainPolicy {
@@ -385,25 +346,19 @@ class RGWCopyObj_ObjStore : public RGWCopyObj {
385346
public:
386347
RGWCopyObj_ObjStore() {}
387348
~RGWCopyObj_ObjStore() override {}
388-
389-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
390349
};
391350

392351
class RGWGetACLs_ObjStore : public RGWGetACLs {
393352
public:
394353
RGWGetACLs_ObjStore() {}
395354
~RGWGetACLs_ObjStore() override {}
396-
397-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.ACL", s->info.method); }
398355
};
399356

400357
class RGWPutACLs_ObjStore : public RGWPutACLs {
401358
public:
402359
RGWPutACLs_ObjStore() {}
403360
~RGWPutACLs_ObjStore() override {}
404-
405361
int get_params(optional_yield y) override;
406-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.ACL", s->info.method); }
407362
};
408363

409364
class RGWGetObjAttrs_ObjStore : public RGWGetObjAttrs {
@@ -421,8 +376,6 @@ class RGWGetLC_ObjStore : public RGWGetLC {
421376
public:
422377
RGWGetLC_ObjStore() {}
423378
~RGWGetLC_ObjStore() override {}
424-
425-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.LIFECYCLE", s->info.method); }
426379
};
427380

428381
class RGWPutLC_ObjStore : public RGWPutLC {
@@ -431,47 +384,36 @@ class RGWPutLC_ObjStore : public RGWPutLC {
431384
~RGWPutLC_ObjStore() override {}
432385

433386
int get_params(optional_yield y) override;
434-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.LIFECYCLE", s->info.method); }
435387
};
436388

437389
class RGWDeleteLC_ObjStore : public RGWDeleteLC {
438390
public:
439391
RGWDeleteLC_ObjStore() {}
440392
~RGWDeleteLC_ObjStore() override {}
441-
442-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.LIFECYCLE", s->info.method); }
443393
};
444394

445395
class RGWGetCORS_ObjStore : public RGWGetCORS {
446396
public:
447397
RGWGetCORS_ObjStore() {}
448398
~RGWGetCORS_ObjStore() override {}
449-
450-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.CORS", s->info.method); }
451399
};
452400

453401
class RGWPutCORS_ObjStore : public RGWPutCORS {
454402
public:
455403
RGWPutCORS_ObjStore() {}
456404
~RGWPutCORS_ObjStore() override {}
457-
458-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.CORS", s->info.method); }
459405
};
460406

461407
class RGWDeleteCORS_ObjStore : public RGWDeleteCORS {
462408
public:
463409
RGWDeleteCORS_ObjStore() {}
464410
~RGWDeleteCORS_ObjStore() override {}
465-
466-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.CORS", s->info.method); }
467411
};
468412

469413
class RGWOptionsCORS_ObjStore : public RGWOptionsCORS {
470414
public:
471415
RGWOptionsCORS_ObjStore() {}
472416
~RGWOptionsCORS_ObjStore() override {}
473-
474-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.CORS", s->info.method); }
475417
};
476418

477419
class RGWGetBucketEncryption_ObjStore : public RGWGetBucketEncryption {
@@ -496,59 +438,45 @@ class RGWInitMultipart_ObjStore : public RGWInitMultipart {
496438
public:
497439
RGWInitMultipart_ObjStore() {}
498440
~RGWInitMultipart_ObjStore() override {}
499-
500-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); }
501441
};
502442

503443
class RGWCompleteMultipart_ObjStore : public RGWCompleteMultipart {
504444
public:
505445
RGWCompleteMultipart_ObjStore() {}
506446
~RGWCompleteMultipart_ObjStore() override {}
507-
508-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOAD", s->info.method); }
509447
int get_params(optional_yield y) override;
510448
};
511449

512450
class RGWAbortMultipart_ObjStore : public RGWAbortMultipart {
513451
public:
514452
RGWAbortMultipart_ObjStore() {}
515453
~RGWAbortMultipart_ObjStore() override {}
516-
517-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOAD", s->info.method); }
518454
};
519455

520456
class RGWListMultipart_ObjStore : public RGWListMultipart {
521457
public:
522458
RGWListMultipart_ObjStore() {}
523459
~RGWListMultipart_ObjStore() override {}
524-
525-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOAD", s->info.method); }
526460
int get_params(optional_yield y) override;
527461
};
528462

529463
class RGWListBucketMultiparts_ObjStore : public RGWListBucketMultiparts {
530464
public:
531465
RGWListBucketMultiparts_ObjStore() {}
532466
~RGWListBucketMultiparts_ObjStore() override {}
533-
534-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); }
535467
int get_params(optional_yield y) override;
536468
};
537469

538470
class RGWBulkDelete_ObjStore : public RGWBulkDelete {
539471
public:
540472
RGWBulkDelete_ObjStore() {}
541473
~RGWBulkDelete_ObjStore() override {}
542-
543-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BULK_DELETE", s->info.method); }
544474
};
545475

546476
class RGWBulkUploadOp_ObjStore : public RGWBulkUploadOp {
547477
public:
548478
RGWBulkUploadOp_ObjStore() = default;
549479
~RGWBulkUploadOp_ObjStore() = default;
550-
551-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.BULK_UPLOAD", s->info.method); }
552480
};
553481

554482
class RGWDeleteMultiObj_ObjStore : public RGWDeleteMultiObj {
@@ -557,7 +485,6 @@ class RGWDeleteMultiObj_ObjStore : public RGWDeleteMultiObj {
557485
~RGWDeleteMultiObj_ObjStore() override {}
558486

559487
int get_params(optional_yield y) override;
560-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.DELETE_MULTI_OBJECT", s->info.method); }
561488
};
562489

563490
class RGWInfo_ObjStore : public RGWInfo {
@@ -583,28 +510,24 @@ class RGWPutObjRetention_ObjStore : public RGWPutObjRetention {
583510
public:
584511
RGWPutObjRetention_ObjStore() = default;
585512
~RGWPutObjRetention_ObjStore() override = default;
586-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.RETENTION", s->info.method); }
587513
};
588514

589515
class RGWGetObjRetention_ObjStore : public RGWGetObjRetention {
590516
public:
591517
RGWGetObjRetention_ObjStore() = default;
592518
~RGWGetObjRetention_ObjStore() = default;
593-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.RETENTION", s->info.method); }
594519
};
595520

596521
class RGWPutObjLegalHold_ObjStore : public RGWPutObjLegalHold {
597522
public:
598523
RGWPutObjLegalHold_ObjStore() = default;
599524
~RGWPutObjLegalHold_ObjStore() override = default;
600525
int get_params(optional_yield y) override;
601-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.LEGAL_HOLD", s->info.method); }
602526
};
603527

604528
class RGWGetObjLegalHold_ObjStore : public RGWGetObjLegalHold {
605529
public:
606530
RGWGetObjLegalHold_ObjStore() = default;
607-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.LEGAL_HOLD", s->info.method); }
608531
~RGWGetObjLegalHold_ObjStore() = default;
609532
};
610533

src/rgw/rgw_rest_bucket_logging.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class RGWGetBucketLoggingOp : public RGWOp {
124124
rgw_flush_formatter_and_reset(s, s->formatter);
125125
}
126126
const char* name() const override { return "get_bucket_logging"; }
127+
std::string canonical_name() const override { return fmt::format("REST.{}.LOGGING", s->info.method); }
127128
RGWOpType get_type() override { return RGW_OP_GET_BUCKET_LOGGING; }
128129
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
129130
};
@@ -215,6 +216,7 @@ class RGWPutBucketLoggingOp : public RGWDefaultResponseOp {
215216
}
216217

217218
const char* name() const override { return "put_bucket_logging"; }
219+
std::string canonical_name() const override { return fmt::format("REST.{}.LOGGING", s->info.method); }
218220
RGWOpType get_type() override { return RGW_OP_PUT_BUCKET_LOGGING; }
219221
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
220222

@@ -373,6 +375,7 @@ class RGWPostBucketLoggingOp : public RGWDefaultResponseOp {
373375
}
374376

375377
const char* name() const override { return "post_bucket_logging"; }
378+
std::string canonical_name() const override { return fmt::format("REST.{}.LOGGING", s->info.method); }
376379
RGWOpType get_type() override { return RGW_OP_POST_BUCKET_LOGGING; }
377380
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
378381

src/rgw/rgw_rest_pubsub.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ class RGWPSCreateNotifOp : public RGWDefaultResponseOp {
11891189
}
11901190

11911191
const char* name() const override { return "pubsub_notification_create_s3"; }
1192+
std::string canonical_name() const override { return fmt::format("REST.{}.NOTIFICATION", s->info.method); }
11921193
RGWOpType get_type() override { return RGW_OP_PUBSUB_NOTIF_CREATE; }
11931194
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
11941195

@@ -1444,6 +1445,7 @@ class RGWPSDeleteNotifOp : public RGWDefaultResponseOp {
14441445
}
14451446

14461447
const char* name() const override { return "pubsub_notification_delete_s3"; }
1448+
std::string canonical_name() const override { return fmt::format("REST.{}.NOTIFICATION", s->info.method); }
14471449
RGWOpType get_type() override { return RGW_OP_PUBSUB_NOTIF_DELETE; }
14481450
uint32_t op_mask() override { return RGW_OP_TYPE_DELETE; }
14491451

@@ -1548,6 +1550,7 @@ class RGWPSListNotifsOp : public RGWOp {
15481550
}
15491551

15501552
const char* name() const override { return "pubsub_notifications_get_s3"; }
1553+
std::string canonical_name() const override { return fmt::format("REST.{}.NOTIFICATION", s->info.method); }
15511554
RGWOpType get_type() override { return RGW_OP_PUBSUB_NOTIF_LIST; }
15521555
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
15531556

0 commit comments

Comments
 (0)