/
options.cc
8701 lines (7018 loc) · 374 KB
/
options.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "acconfig.h"
#include "options.h"
#include "common/Formatter.h"
// Helpers for validators
#include "include/stringify.h"
#include "include/common_fwd.h"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <regex>
// Definitions for enums
#include "common/perf_counters.h"
// rbd feature validation
#include "librbd/Features.h"
using std::ostream;
using std::ostringstream;
using ceph::Formatter;
using ceph::parse_timespan;
namespace {
class printer : public boost::static_visitor<> {
ostream& out;
public:
explicit printer(ostream& os)
: out(os) {}
template<typename T>
void operator()(const T& v) const {
out << v;
}
void operator()(boost::blank blank) const {
return;
}
void operator()(bool v) const {
out << (v ? "true" : "false");
}
void operator()(double v) const {
out << std::fixed << v << std::defaultfloat;
}
void operator()(const Option::size_t& v) const {
out << v.value;
}
void operator()(const std::chrono::seconds v) const {
out << v.count();
}
};
}
ostream& operator<<(ostream& os, const Option::value_t& v) {
printer p{os};
v.apply_visitor(p);
return os;
}
void Option::dump_value(const char *field_name,
const Option::value_t &v, Formatter *f) const
{
if (boost::get<boost::blank>(&v)) {
// This should be nil but Formatter doesn't allow it.
f->dump_string(field_name, "");
return;
}
switch (type) {
case TYPE_INT:
f->dump_int(field_name, boost::get<int64_t>(v)); break;
case TYPE_UINT:
f->dump_unsigned(field_name, boost::get<uint64_t>(v)); break;
case TYPE_STR:
f->dump_string(field_name, boost::get<std::string>(v)); break;
case TYPE_FLOAT:
f->dump_float(field_name, boost::get<double>(v)); break;
case TYPE_BOOL:
f->dump_bool(field_name, boost::get<bool>(v)); break;
default:
f->dump_stream(field_name) << v; break;
}
}
int Option::pre_validate(std::string *new_value, std::string *err) const
{
if (validator) {
return validator(new_value, err);
} else {
return 0;
}
}
int Option::validate(const Option::value_t &new_value, std::string *err) const
{
// Generic validation: min
if (!boost::get<boost::blank>(&(min))) {
if (new_value < min) {
std::ostringstream oss;
oss << "Value '" << new_value << "' is below minimum " << min;
*err = oss.str();
return -EINVAL;
}
}
// Generic validation: max
if (!boost::get<boost::blank>(&(max))) {
if (new_value > max) {
std::ostringstream oss;
oss << "Value '" << new_value << "' exceeds maximum " << max;
*err = oss.str();
return -EINVAL;
}
}
// Generic validation: enum
if (!enum_allowed.empty() && type == Option::TYPE_STR) {
auto found = std::find(enum_allowed.begin(), enum_allowed.end(),
boost::get<std::string>(new_value));
if (found == enum_allowed.end()) {
std::ostringstream oss;
oss << "'" << new_value << "' is not one of the permitted "
"values: " << joinify(enum_allowed.begin(),
enum_allowed.end(),
std::string(", "));
*err = oss.str();
return -EINVAL;
}
}
return 0;
}
int Option::parse_value(
const std::string& raw_val,
value_t *out,
std::string *error_message,
std::string *normalized_value) const
{
std::string val = raw_val;
int r = pre_validate(&val, error_message);
if (r != 0) {
return r;
}
if (type == Option::TYPE_INT) {
int64_t f = strict_si_cast<int64_t>(val.c_str(), error_message);
if (!error_message->empty()) {
return -EINVAL;
}
*out = f;
} else if (type == Option::TYPE_UINT) {
uint64_t f = strict_si_cast<uint64_t>(val.c_str(), error_message);
if (!error_message->empty()) {
return -EINVAL;
}
*out = f;
} else if (type == Option::TYPE_STR) {
*out = val;
} else if (type == Option::TYPE_FLOAT) {
double f = strict_strtod(val.c_str(), error_message);
if (!error_message->empty()) {
return -EINVAL;
} else {
*out = f;
}
} else if (type == Option::TYPE_BOOL) {
bool b = strict_strtob(val.c_str(), error_message);
if (!error_message->empty()) {
return -EINVAL;
} else {
*out = b;
}
} else if (type == Option::TYPE_ADDR) {
entity_addr_t addr;
if (!addr.parse(val.c_str())){
return -EINVAL;
}
*out = addr;
} else if (type == Option::TYPE_ADDRVEC) {
entity_addrvec_t addr;
if (!addr.parse(val.c_str())){
return -EINVAL;
}
*out = addr;
} else if (type == Option::TYPE_UUID) {
uuid_d uuid;
if (!uuid.parse(val.c_str())) {
return -EINVAL;
}
*out = uuid;
} else if (type == Option::TYPE_SIZE) {
Option::size_t sz{strict_iecstrtoll(val.c_str(), error_message)};
if (!error_message->empty()) {
return -EINVAL;
}
*out = sz;
} else if (type == Option::TYPE_SECS) {
try {
*out = parse_timespan(val);
} catch (const std::invalid_argument& e) {
*error_message = e.what();
return -EINVAL;
}
} else {
ceph_abort();
}
r = validate(*out, error_message);
if (r != 0) {
return r;
}
if (normalized_value) {
*normalized_value = to_str(*out);
}
return 0;
}
void Option::dump(Formatter *f) const
{
f->dump_string("name", name);
f->dump_string("type", type_to_str(type));
f->dump_string("level", level_to_str(level));
f->dump_string("desc", desc);
f->dump_string("long_desc", long_desc);
dump_value("default", value, f);
dump_value("daemon_default", daemon_value, f);
f->open_array_section("tags");
for (const auto t : tags) {
f->dump_string("tag", t);
}
f->close_section();
f->open_array_section("services");
for (const auto s : services) {
f->dump_string("service", s);
}
f->close_section();
f->open_array_section("see_also");
for (const auto sa : see_also) {
f->dump_string("see_also", sa);
}
f->close_section();
if (type == TYPE_STR) {
f->open_array_section("enum_values");
for (const auto &ea : enum_allowed) {
f->dump_string("enum_value", ea);
}
f->close_section();
}
dump_value("min", min, f);
dump_value("max", max, f);
f->dump_bool("can_update_at_runtime", can_update_at_runtime());
f->open_array_section("flags");
if (has_flag(FLAG_RUNTIME)) {
f->dump_string("option", "runtime");
}
if (has_flag(FLAG_NO_MON_UPDATE)) {
f->dump_string("option", "no_mon_update");
}
if (has_flag(FLAG_STARTUP)) {
f->dump_string("option", "startup");
}
if (has_flag(FLAG_CLUSTER_CREATE)) {
f->dump_string("option", "cluster_create");
}
if (has_flag(FLAG_CREATE)) {
f->dump_string("option", "create");
}
f->close_section();
}
std::string Option::to_str(const Option::value_t& v)
{
return stringify(v);
}
void Option::print(ostream *out) const
{
*out << name << " - " << desc << "\n";
*out << " (" << type_to_str(type) << ", " << level_to_str(level) << ")\n";
if (!boost::get<boost::blank>(&daemon_value)) {
*out << " Default (non-daemon): " << stringify(value) << "\n";
*out << " Default (daemon): " << stringify(daemon_value) << "\n";
} else {
*out << " Default: " << stringify(value) << "\n";
}
if (!enum_allowed.empty()) {
*out << " Possible values: ";
for (auto& i : enum_allowed) {
*out << " " << stringify(i);
}
*out << "\n";
}
if (!boost::get<boost::blank>(&min)) {
*out << " Minimum: " << stringify(min) << "\n"
<< " Maximum: " << stringify(max) << "\n";
}
*out << " Can update at runtime: "
<< (can_update_at_runtime() ? "true" : "false") << "\n";
if (!services.empty()) {
*out << " Services: " << services << "\n";
}
if (!tags.empty()) {
*out << " Tags: " << tags << "\n";
}
if (!see_also.empty()) {
*out << " See also: " << see_also << "\n";
}
if (long_desc.size()) {
*out << "\n" << long_desc << "\n";
}
}
constexpr unsigned long long operator"" _min (unsigned long long min) {
return min * 60;
}
constexpr unsigned long long operator"" _hr (unsigned long long hr) {
return hr * 60 * 60;
}
constexpr unsigned long long operator"" _day (unsigned long long day) {
return day * 24 * 60 * 60;
}
constexpr unsigned long long operator"" _K (unsigned long long n) {
return n << 10;
}
constexpr unsigned long long operator"" _M (unsigned long long n) {
return n << 20;
}
constexpr unsigned long long operator"" _G (unsigned long long n) {
return n << 30;
}
constexpr unsigned long long operator"" _T (unsigned long long n) {
return n << 40;
}
std::vector<Option> get_global_options() {
return std::vector<Option>({
Option("host", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_description("local hostname")
.set_long_description("if blank, ceph assumes the short hostname (hostname -s)")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_service("common")
.add_tag("network"),
Option("fsid", Option::TYPE_UUID, Option::LEVEL_BASIC)
.set_description("cluster fsid (uuid)")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_flag(Option::FLAG_STARTUP)
.add_service("common")
.add_tag("service"),
Option("public_addr", Option::TYPE_ADDR, Option::LEVEL_BASIC)
.set_description("public-facing address to bind to")
.set_flag(Option::FLAG_STARTUP)
.add_service({"mon", "mds", "osd", "mgr"}),
Option("public_addrv", Option::TYPE_ADDRVEC, Option::LEVEL_BASIC)
.set_description("public-facing address to bind to")
.set_flag(Option::FLAG_STARTUP)
.add_service({"mon", "mds", "osd", "mgr"}),
Option("public_bind_addr", Option::TYPE_ADDR, Option::LEVEL_ADVANCED)
.set_default(entity_addr_t())
.set_flag(Option::FLAG_STARTUP)
.add_service("mon")
.set_description(""),
Option("cluster_addr", Option::TYPE_ADDR, Option::LEVEL_BASIC)
.set_description("cluster-facing address to bind to")
.add_service("osd")
.set_flag(Option::FLAG_STARTUP)
.add_tag("network"),
Option("public_network", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.add_service({"mon", "mds", "osd", "mgr"})
.set_flag(Option::FLAG_STARTUP)
.add_tag("network")
.set_description("Network(s) from which to choose a public address to bind to"),
Option("public_network_interface", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.add_service({"mon", "mds", "osd", "mgr"})
.add_tag("network")
.set_flag(Option::FLAG_STARTUP)
.set_description("Interface name(s) from which to choose an address from a public_network to bind to; public_network must also be specified.")
.add_see_also("public_network"),
Option("cluster_network", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.add_service("osd")
.set_flag(Option::FLAG_STARTUP)
.add_tag("network")
.set_description("Network(s) from which to choose a cluster address to bind to"),
Option("cluster_network_interface", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.add_service({"mon", "mds", "osd", "mgr"})
.set_flag(Option::FLAG_STARTUP)
.add_tag("network")
.set_description("Interface name(s) from which to choose an address from a cluster_network to bind to; cluster_network must also be specified.")
.add_see_also("cluster_network"),
Option("monmap", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("path to MonMap file")
.set_long_description("This option is normally used during mkfs, but can also "
"be used to identify which monitors to connect to.")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_service("mon")
.set_flag(Option::FLAG_CREATE),
Option("mon_host", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_description("list of hosts or addresses to search for a monitor")
.set_long_description("This is a comma, whitespace, or semicolon separated "
"list of IP addresses or hostnames. Hostnames are "
"resolved via DNS and all A or AAAA records are "
"included in the search list.")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_flag(Option::FLAG_STARTUP)
.add_service("common"),
Option("mon_dns_srv_name", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("ceph-mon")
.set_description("name of DNS SRV record to check for monitor addresses")
.set_flag(Option::FLAG_STARTUP)
.add_service("common")
.add_tag("network")
.add_see_also("mon_host"),
Option("container_image", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_description("container image (used by cephadm orchestrator)")
.set_flag(Option::FLAG_STARTUP)
.set_default("docker.io/ceph/daemon-base:latest-master-devel"),
Option("no_config_file", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_flag(Option::FLAG_STARTUP)
.add_service("common")
.add_tag("config")
.set_description("signal that we don't require a config file to be present")
.set_long_description("When specified, we won't be looking for a "
"configuration file, and will instead expect that "
"whatever options or values are required for us to "
"work will be passed as arguments."),
// lockdep
Option("lockdep", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_description("enable lockdep lock dependency analyzer")
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_flag(Option::FLAG_STARTUP)
.add_service("common"),
Option("lockdep_force_backtrace", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_description("always gather current backtrace at every lock")
.set_flag(Option::FLAG_STARTUP)
.add_service("common")
.add_see_also("lockdep"),
Option("run_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("/var/run/ceph")
.set_flag(Option::FLAG_STARTUP)
.set_description("path for the 'run' directory for storing pid and socket files")
.add_service("common")
.add_see_also("admin_socket"),
Option("admin_socket", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_daemon_default("$run_dir/$cluster-$name.asok")
.set_flag(Option::FLAG_STARTUP)
.set_description("path for the runtime control socket file, used by the 'ceph daemon' command")
.add_service("common"),
Option("admin_socket_mode", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("file mode to set for the admin socket file, e.g, '0755'")
.set_flag(Option::FLAG_STARTUP)
.add_service("common")
.add_see_also("admin_socket"),
// daemon
Option("daemonize", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_daemon_default(true)
.set_description("whether to daemonize (background) after startup")
.set_flag(Option::FLAG_STARTUP)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service")
.add_see_also({"pid_file", "chdir"}),
Option("setuser", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_description("uid or user name to switch to on startup")
.set_long_description("This is normally specified by the systemd unit file.")
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service")
.add_see_also("setgroup"),
Option("setgroup", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_description("gid or group name to switch to on startup")
.set_long_description("This is normally specified by the systemd unit file.")
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service")
.add_see_also("setuser"),
Option("setuser_match_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_description("if set, setuser/setgroup is condition on this path matching ownership")
.set_long_description("If setuser or setgroup are specified, and this option is non-empty, then the uid/gid of the daemon will only be changed if the file or directory specified by this option has a matching uid and/or gid. This exists primarily to allow switching to user ceph for OSDs to be conditional on whether the osd data contents have also been chowned after an upgrade. This is normally specified by the systemd unit file.")
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service")
.add_see_also({"setuser", "setgroup"}),
Option("pid_file", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_description("path to write a pid file (if any)")
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service"),
Option("chdir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("path to chdir(2) to after daemonizing")
.set_flag(Option::FLAG_STARTUP)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service")
.add_see_also("daemonize"),
Option("fatal_signal_handlers", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_flag(Option::FLAG_STARTUP)
.set_description("whether to register signal handlers for SIGABRT etc that dump a stack trace")
.set_long_description("This is normally true for daemons and values for libraries.")
.add_service({"mon", "mgr", "osd", "mds"})
.add_tag("service"),
Option("crash_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_default("/var/lib/ceph/crash")
.set_description("Directory where crash reports are archived"),
// restapi
Option("restapi_log_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("default set by python code"),
Option("restapi_base_url", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("default set by python code"),
Option("erasure_code_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_PKGLIBDIR"/erasure-code")
.set_flag(Option::FLAG_STARTUP)
.set_description("directory where erasure-code plugins can be found")
.add_service({"mon", "osd"}),
// logging
Option("log_file", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("")
.set_daemon_default("/var/log/ceph/$cluster-$name.log")
.set_description("path to log file")
.add_see_also({"log_to_file",
"log_to_stderr",
"err_to_stderr",
"log_to_syslog",
"err_to_syslog"}),
Option("log_max_new", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(1000)
.set_description("max unwritten log entries to allow before waiting to flush to the log")
.add_see_also("log_max_recent"),
Option("log_max_recent", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(500)
.set_daemon_default(10000)
.set_description("recent log entries to keep in memory to dump in the event of a crash")
.set_long_description("The purpose of this option is to log at a higher debug level only to the in-memory buffer, and write out the detailed log messages only if there is a crash. Only log entries below the lower log level will be written unconditionally to the log. For example, debug_osd=1/5 will write everything <= 1 to the log unconditionally but keep entries at levels 2-5 in memory. If there is a seg fault or assertion failure, all entries will be dumped to the log."),
Option("log_to_file", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(true)
.set_description("send log lines to a file")
.add_see_also("log_file"),
Option("log_to_stderr", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(true)
.set_daemon_default(false)
.set_description("send log lines to stderr"),
Option("err_to_stderr", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(false)
.set_daemon_default(true)
.set_description("send critical error log lines to stderr"),
Option("log_stderr_prefix", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_description("String to prefix log messages with when sent to stderr")
.set_long_description("This is useful in container environments when combined with mon_cluster_log_to_stderr. The mon log prefixes each line with the channel name (e.g., 'default', 'audit'), while log_stderr_prefix can be set to 'debug '.")
.add_see_also("mon_cluster_log_to_stderr"),
Option("log_to_syslog", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(false)
.set_description("send log lines to syslog facility"),
Option("err_to_syslog", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(false)
.set_description("send critical error log lines to syslog facility"),
Option("log_flush_on_exit", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_description("set a process exit handler to ensure the log is flushed on exit"),
Option("log_stop_at_utilization", Option::TYPE_FLOAT, Option::LEVEL_BASIC)
.set_default(.97)
.set_min_max(0.0, 1.0)
.set_description("stop writing to the log file when device utilization reaches this ratio")
.add_see_also("log_file"),
Option("log_to_graylog", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(false)
.set_description("send log lines to remote graylog server")
.add_see_also({"err_to_graylog",
"log_graylog_host",
"log_graylog_port"}),
Option("err_to_graylog", Option::TYPE_BOOL, Option::LEVEL_BASIC)
.set_default(false)
.set_description("send critical error log lines to remote graylog server")
.add_see_also({"log_to_graylog",
"log_graylog_host",
"log_graylog_port"}),
Option("log_graylog_host", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("127.0.0.1")
.set_description("address or hostname of graylog server to log to")
.add_see_also({"log_to_graylog",
"err_to_graylog",
"log_graylog_port"}),
Option("log_graylog_port", Option::TYPE_INT, Option::LEVEL_BASIC)
.set_default(12201)
.set_description("port number for the remote graylog server")
.add_see_also("log_graylog_host"),
Option("log_coarse_timestamps", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("timestamp log entries from coarse system clock "
"to improve performance")
.add_service("common")
.add_tag("performance")
.add_tag("service"),
// unmodified
Option("clog_to_monitors", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("default=true")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Make daemons send cluster log messages to monitors"),
Option("clog_to_syslog", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("false")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Make daemons send cluster log messages to syslog"),
Option("clog_to_syslog_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("info")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Syslog level for cluster log messages")
.add_see_also("clog_to_syslog"),
Option("clog_to_syslog_facility", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("default=daemon audit=local0")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Syslog facility for cluster log messages")
.add_see_also("clog_to_syslog"),
Option("clog_to_graylog", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("false")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Make daemons send cluster log to graylog"),
Option("clog_to_graylog_host", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("127.0.0.1")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Graylog host to cluster log messages")
.add_see_also("clog_to_graylog"),
Option("clog_to_graylog_port", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("12201")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Graylog port number for cluster log messages")
.add_see_also("clog_to_graylog"),
Option("mon_cluster_log_to_stderr", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.add_service("mon")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Make monitor send cluster log messages to stderr (prefixed by channel)")
.add_see_also("log_stderr_prefix"),
Option("mon_cluster_log_to_syslog", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("default=false")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Make monitor send cluster log messages to syslog"),
Option("mon_cluster_log_to_syslog_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("info")
.add_service("mon")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Syslog level for cluster log messages")
.add_see_also("mon_cluster_log_to_syslog"),
Option("mon_cluster_log_to_syslog_facility", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("daemon")
.add_service("mon")
.set_flag(Option::FLAG_RUNTIME)
.set_description("Syslog facility for cluster log messages")
.add_see_also("mon_cluster_log_to_syslog"),
Option("mon_cluster_log_to_file", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Make monitor send cluster log messages to file")
.add_see_also("mon_cluster_log_file"),
Option("mon_cluster_log_file", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("default=/var/log/ceph/$cluster.$channel.log cluster=/var/log/ceph/$cluster.log")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("File(s) to write cluster log to")
.set_long_description("This can either be a simple file name to receive all messages, or a list of key/value pairs where the key is the log channel and the value is the filename, which may include $cluster and $channel metavariables")
.add_see_also("mon_cluster_log_to_file"),
Option("mon_cluster_log_file_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("debug")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Lowest level to include is cluster log file")
.add_see_also("mon_cluster_log_file"),
Option("mon_cluster_log_to_graylog", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("false")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Make monitor send cluster log to graylog"),
Option("mon_cluster_log_to_graylog_host", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("127.0.0.1")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Graylog host for cluster log messages")
.add_see_also("mon_cluster_log_to_graylog"),
Option("mon_cluster_log_to_graylog_port", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("12201")
.set_flag(Option::FLAG_RUNTIME)
.add_service("mon")
.set_description("Graylog port for cluster log messages")
.add_see_also("mon_cluster_log_to_graylog"),
Option("enable_experimental_unrecoverable_data_corrupting_features", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_RUNTIME)
.set_default("")
.set_description("Enable named (or all with '*') experimental features that may be untested, dangerous, and/or cause permanent data loss"),
Option("plugin_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_PKGLIBDIR)
.set_flag(Option::FLAG_STARTUP)
.add_service({"mon", "osd"})
.set_description("Base directory for dynamically loaded plugins"),
// Compressor
Option("compressor_zlib_isal", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_description("Use Intel ISA-L accelerated zlib implementation if available"),
Option("compressor_zlib_level", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(5)
.set_description("Zlib compression level to use"),
Option("compressor_zlib_winsize", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(-15)
.set_min_max(-15,32)
.set_description("Zlib compression winsize to use"),
Option("compressor_zstd_level", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(1)
.set_description("Zstd compression level to use"),
Option("qat_compressor_enabled", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_description("Enable Intel QAT acceleration support for compression if available"),
Option("plugin_crypto_accelerator", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("crypto_isal")
.set_description("Crypto accelerator library to use"),
Option("openssl_engine_opts", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_flag(Option::FLAG_STARTUP)
.set_description("Use engine for specific openssl algorithm")
.set_long_description("Pass opts in this way: engine_id=engine1,dynamic_path=/some/path/engine1.so,default_algorithms=DIGESTS:engine_id=engine2,dynamic_path=/some/path/engine2.so,default_algorithms=CIPHERS,other_ctrl=other_value"),
Option("mempool_debug", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.set_description(""),
Option("thp", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_flag(Option::FLAG_STARTUP)
.set_description("enable transparent huge page (THP) support")
.set_long_description("Ceph is known to suffer from memory fragmentation due to THP use. This is indicated by RSS usage above configured memory targets. Enabling THP is currently discouraged until selective use of THP by Ceph is implemented."),
Option("key", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_description("Authentication key")
.set_long_description("A CephX authentication key, base64 encoded. It normally looks something like 'AQAtut9ZdMbNJBAAHz6yBAWyJyz2yYRyeMWDag=='.")
.set_flag(Option::FLAG_STARTUP)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_see_also("keyfile")
.add_see_also("keyring"),
Option("keyfile", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_description("Path to a file containing a key")
.set_long_description("The file should contain a CephX authentication key and optionally a trailing newline, but nothing else.")
.set_flag(Option::FLAG_STARTUP)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_see_also("key"),
Option("keyring", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(
"/etc/ceph/$cluster.$name.keyring,/etc/ceph/$cluster.keyring,"
"/etc/ceph/keyring,/etc/ceph/keyring.bin,"
#if defined(__FreeBSD)
"/usr/local/etc/ceph/$cluster.$name.keyring,"
"/usr/local/etc/ceph/$cluster.keyring,"
"/usr/local/etc/ceph/keyring,/usr/local/etc/ceph/keyring.bin,"
#endif
)
.set_description("Path to a keyring file.")
.set_long_description("A keyring file is an INI-style formatted file where the section names are client or daemon names (e.g., 'osd.0') and each section contains a 'key' property with CephX authentication key as the value.")
.set_flag(Option::FLAG_STARTUP)
.set_flag(Option::FLAG_NO_MON_UPDATE)
.add_see_also("key")
.add_see_also("keyfile"),
Option("heartbeat_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(5)
.set_flag(Option::FLAG_STARTUP)
.set_description("Frequency of internal heartbeat checks (seconds)"),
Option("heartbeat_file", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_flag(Option::FLAG_STARTUP)
.set_description("File to touch on successful internal heartbeat")
.set_long_description("If set, this file will be touched every time an internal heartbeat check succeeds.")
.add_see_also("heartbeat_interval"),
Option("heartbeat_inject_failure", Option::TYPE_INT, Option::LEVEL_DEV)
.set_default(0)
.set_description(""),
Option("perf", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("Enable internal performance metrics")
.set_long_description("If enabled, collect and expose internal health metrics"),
Option("ms_type", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_default("async+posix")
.set_description("Messenger implementation to use for network communication"),
Option("ms_public_type", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_flag(Option::FLAG_STARTUP)
.set_description("Messenger implementation to use for the public network")
.set_long_description("If not specified, use ms_type")
.add_see_also("ms_type"),
Option("ms_cluster_type", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_flag(Option::FLAG_STARTUP)
.set_description("Messenger implementation to use for the internal cluster network")
.set_long_description("If not specified, use ms_type")
.add_see_also("ms_type"),
Option("ms_mon_cluster_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("secure crc")
.set_flag(Option::FLAG_STARTUP)
.set_description("Connection modes (crc, secure) for intra-mon connections in order of preference")
.add_see_also("ms_mon_service_mode")
.add_see_also("ms_mon_client_mode")
.add_see_also("ms_service_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),
Option("ms_mon_service_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("secure crc")
.set_flag(Option::FLAG_STARTUP)
.set_description("Allowed connection modes (crc, secure) for connections to mons")
.add_see_also("ms_service_mode")
.add_see_also("ms_mon_cluster_mode")
.add_see_also("ms_mon_client_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),
Option("ms_mon_client_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("secure crc")
.set_flag(Option::FLAG_STARTUP)
.set_description("Connection modes (crc, secure) for connections from clients to monitors in order of preference")
.add_see_also("ms_mon_service_mode")
.add_see_also("ms_mon_cluster_mode")
.add_see_also("ms_service_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),
Option("ms_cluster_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("crc secure")
.set_flag(Option::FLAG_STARTUP)
.set_description("Connection modes (crc, secure) for intra-cluster connections in order of preference")
.add_see_also("ms_service_mode")
.add_see_also("ms_client_mode"),
Option("ms_service_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("crc secure")
.set_flag(Option::FLAG_STARTUP)
.set_description("Allowed connection modes (crc, secure) for connections to daemons")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),
Option("ms_client_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("crc secure")
.set_flag(Option::FLAG_STARTUP)
.set_description("Connection modes (crc, secure) for connections from clients in order of preference")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_service_mode"),
Option("ms_learn_addr_from_peer", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("Learn address from what IP our first peer thinks we connect from")
.set_long_description("Use the IP address our first peer (usually a monitor) sees that we are connecting from. This is useful if a client is behind some sort of NAT and we want to see it identified by its local (not NATed) address."),
Option("ms_tcp_nodelay", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("Disable Nagle's algorithm and send queued network traffic immediately"),
Option("ms_tcp_rcvbuf", Option::TYPE_SIZE, Option::LEVEL_ADVANCED)
.set_default(0)
.set_description("Size of TCP socket receive buffer"),
Option("ms_tcp_prefetch_max_size", Option::TYPE_SIZE, Option::LEVEL_ADVANCED)
.set_default(4_K)
.set_description("Maximum amount of data to prefetch out of the socket receive buffer"),
Option("ms_initial_backoff", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(.2)
.set_description("Initial backoff after a network error is detected (seconds)"),
Option("ms_max_backoff", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(15.0)
.set_description("Maximum backoff after a network error before retrying (seconds)")
.add_see_also("ms_initial_backoff"),
Option("ms_crc_data", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(true)
.set_description("Set and/or verify crc32c checksum on data payload sent over network"),
Option("ms_crc_header", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(true)
.set_description("Set and/or verify crc32c checksum on header payload sent over network"),
Option("ms_die_on_bad_msg", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Induce a daemon crash/exit when a bad network message is received"),
Option("ms_die_on_unhandled_msg", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Induce a daemon crash/exit when an unrecognized message is received"),
Option("ms_die_on_old_message", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Induce a daemon crash/exit when a old, undecodable message is received"),
Option("ms_die_on_skipped_message", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Induce a daemon crash/exit if sender skips a message sequence number"),
Option("ms_die_on_bug", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Induce a crash/exit on various bugs (for testing purposes)"),