Project

General

Profile

Fix #20627

Clean config special cases out of common_preinit

Added by John Spray about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/14/2017
Due date:
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Release:
Needs Doc:
No
Component(RADOS):

Description

Post-https://github.com/ceph/ceph/pull/16211, we should use set_daemon_default for this:

  // Set some defaults based on code type
  switch (code_env) {
  case CODE_ENVIRONMENT_DAEMON:
    conf->set_val_or_die("daemonize", "true");
    conf->set_val_or_die("log_to_stderr", "false");
    conf->set_val_or_die("err_to_stderr", "true");

    // different default keyring locations for osd and mds.  this is
    // for backward compatibility.  moving forward, we want all keyrings
    // in these locations.  the mon already forces $mon_data/keyring.
    if (conf->name.is_mds())
      conf->set_val("keyring", "$mds_data/keyring", false);
    else if (conf->name.is_osd())
      conf->set_val("keyring", "$osd_data/keyring", false);
    break;

  case CODE_ENVIRONMENT_UTILITY_NODOUT:
  case CODE_ENVIRONMENT_LIBRARY:
    conf->set_val_or_die("log_to_stderr", "false");
    conf->set_val_or_die("err_to_stderr", "false");
    conf->set_val_or_die("log_flush_on_exit", "false");
    break;

  default:
    break;
  }

  if (flags & CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS) {
    // do nothing special!  we used to do no default log, pid_file,
    // admin_socket, but changed our minds.  let's make ceph-fuse
    // and radosgw use the same defaults as ceph-{osd,mon,mds,...}
  } else if (code_env != CODE_ENVIRONMENT_DAEMON) {
    // no default log, pid_file, admin_socket
    conf->set_val_or_die("pid_file", "");
    conf->set_val_or_die("admin_socket", "");
    conf->set_val_or_die("log_file", "");
    // use less memory for logs
    conf->set_val_or_die("log_max_recent", "500");
  }

Depends on updating CepContext+md_config_t constructor to take code_environment_t, so that they can decide on whether something's a daemon the same way common_preinit currently does.

Also available in: Atom PDF