summaryrefslogtreecommitdiffstats
path: root/src/ceph_mgr.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/ceph_mgr.cc
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ceph_mgr.cc')
-rw-r--r--src/ceph_mgr.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/ceph_mgr.cc b/src/ceph_mgr.cc
new file mode 100644
index 00000000..514cb4e3
--- /dev/null
+++ b/src/ceph_mgr.cc
@@ -0,0 +1,79 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2015 Red Hat Inc
+ *
+ * Author: John Spray <john.spray@redhat.com>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include <Python.h>
+
+#include <pthread.h>
+
+#include "include/types.h"
+#include "include/compat.h"
+#include "common/config.h"
+#include "common/ceph_argparse.h"
+#include "common/errno.h"
+#include "common/pick_address.h"
+#include "global/global_init.h"
+
+#include "mgr/MgrStandby.h"
+
+static void usage()
+{
+ cout << "usage: ceph-mgr -i <ID> [flags]\n"
+ << std::endl;
+ generic_server_usage();
+}
+
+/**
+ * A short main() which just instantiates a MgrStandby and
+ * hands over control to that.
+ */
+int main(int argc, const char **argv)
+{
+ ceph_pthread_setname(pthread_self(), "ceph-mgr");
+
+ vector<const char*> args;
+ argv_to_vec(argc, argv, args);
+ if (args.empty()) {
+ cerr << argv[0] << ": -h or --help for usage" << std::endl;
+ exit(1);
+ }
+ if (ceph_argparse_need_usage(args)) {
+ usage();
+ exit(0);
+ }
+
+ map<string,string> defaults = {
+ { "keyring", "$mgr_data/keyring" }
+ };
+ auto cct = global_init(&defaults, args, CEPH_ENTITY_TYPE_MGR,
+ CODE_ENVIRONMENT_DAEMON, 0,
+ "mgr_data");
+
+ pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
+
+ global_init_daemonize(g_ceph_context);
+ global_init_chdir(g_ceph_context);
+ common_init_finish(g_ceph_context);
+
+ MgrStandby mgr(argc, argv);
+ int rc = mgr.init();
+ if (rc != 0) {
+ std::cerr << "Error in initialization: " << cpp_strerror(rc) << std::endl;
+ return rc;
+ }
+
+ return mgr.main(args);
+}
+