]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph_mgr.cc
bump version to 12.2.1-pve3
[ceph.git] / ceph / src / ceph_mgr.cc
CommitLineData
7c673cae
FG
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"
b5b8bbf5 23#include "common/pick_address.h"
7c673cae
FG
24#include "global/global_init.h"
25
26#include "mgr/MgrStandby.h"
27
31f18b77
FG
28static void usage()
29{
30 cout << "usage: ceph-mgr -i <ID> [flags]\n"
31 << std::endl;
32 generic_server_usage();
33}
7c673cae
FG
34
35/**
36 * A short main() which just instantiates a MgrStandby and
37 * hands over control to that.
38 */
39int main(int argc, const char **argv)
40{
41 vector<const char*> args;
42 argv_to_vec(argc, argv, args);
43 env_to_vec(args);
44
45 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_MGR,
46 CODE_ENVIRONMENT_DAEMON, 0,
47 "mgr_data");
48 // For consumption by KeyRing::from_ceph_context in MonClient
c07f9fc5 49 g_conf->set_val_or_die("keyring", "$mgr_data/keyring");
7c673cae
FG
50
51 // Handle --help
52 if ((args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
31f18b77 53 usage();
7c673cae
FG
54 }
55
b5b8bbf5
FG
56 pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
57
7c673cae
FG
58 global_init_daemonize(g_ceph_context);
59 global_init_chdir(g_ceph_context);
60 common_init_finish(g_ceph_context);
61
31f18b77 62 MgrStandby mgr(argc, argv);
7c673cae
FG
63 int rc = mgr.init();
64 if (rc != 0) {
65 std::cerr << "Error in initialization: " << cpp_strerror(rc) << std::endl;
66 return rc;
67 }
68
69 return mgr.main(args);
70}
71