]> git.proxmox.com Git - ceph.git/blob - ceph/src/ceph_mgr.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / ceph_mgr.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2015 Red Hat Inc
7 *
8 * Author: John Spray <john.spray@redhat.com>
9 *
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
14 *
15 */
16
17 #include <Python.h>
18
19 #include "include/types.h"
20 #include "common/config.h"
21 #include "common/ceph_argparse.h"
22 #include "common/errno.h"
23 #include "global/global_init.h"
24
25 #include "mgr/MgrStandby.h"
26
27
28 /**
29 * A short main() which just instantiates a MgrStandby and
30 * hands over control to that.
31 */
32 int main(int argc, const char **argv)
33 {
34 vector<const char*> args;
35 argv_to_vec(argc, argv, args);
36 env_to_vec(args);
37
38 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_MGR,
39 CODE_ENVIRONMENT_DAEMON, 0,
40 "mgr_data");
41 // For consumption by KeyRing::from_ceph_context in MonClient
42 g_conf->set_val("keyring", "$mgr_data/keyring", false);
43
44 // Handle --help
45 if ((args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
46 MgrStandby mgr;
47 mgr.usage();
48 return 0;
49 }
50
51 global_init_daemonize(g_ceph_context);
52 global_init_chdir(g_ceph_context);
53 common_init_finish(g_ceph_context);
54
55 MgrStandby mgr;
56 int rc = mgr.init();
57 if (rc != 0) {
58 std::cerr << "Error in initialization: " << cpp_strerror(rc) << std::endl;
59 return rc;
60 }
61
62 return mgr.main(args);
63 }
64