| 40 | extern int syn_filer_flags; |
| 41 | |
| 42 | int main(int argc, const char **argv, char *envp[]) |
| 43 | { |
| 44 | //cerr << "ceph-syn starting" << std::endl; |
| 45 | auto args = argv_to_vec(argc, argv); |
| 46 | |
| 47 | auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, |
| 48 | CODE_ENVIRONMENT_UTILITY, 0); |
| 49 | common_init_finish(g_ceph_context); |
| 50 | |
| 51 | parse_syn_options(args); // for SyntheticClient |
| 52 | |
| 53 | pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC); |
| 54 | |
| 55 | // get monmap |
| 56 | ceph::async::io_context_pool poolctx(1); |
| 57 | MonClient mc(g_ceph_context, poolctx); |
| 58 | if (mc.build_initial_monmap() < 0) |
| 59 | return -1; |
| 60 | |
| 61 | list<Client*> clients; |
| 62 | list<SyntheticClient*> synclients; |
| 63 | vector<Messenger*> messengers{static_cast<unsigned>(num_client), nullptr}; |
| 64 | vector<MonClient*> mclients{static_cast<unsigned>(num_client), nullptr}; |
| 65 | |
| 66 | cout << "ceph-syn: starting " << num_client << " syn client(s)" << std::endl; |
| 67 | for (int i=0; i<num_client; i++) { |
| 68 | messengers[i] = Messenger::create_client_messenger(g_ceph_context, |
| 69 | "synclient"); |
| 70 | mclients[i] = new MonClient(g_ceph_context, poolctx); |
| 71 | mclients[i]->build_initial_monmap(); |
| 72 | auto client = new StandaloneClient(messengers[i], mclients[i], poolctx); |
| 73 | client->set_filer_flags(syn_filer_flags); |
| 74 | SyntheticClient *syn = new SyntheticClient(client); |
| 75 | clients.push_back(client); |
| 76 | synclients.push_back(syn); |
| 77 | messengers[i]->start(); |
| 78 | } |
| 79 | |
| 80 | for (list<SyntheticClient*>::iterator p = synclients.begin(); |
| 81 | p != synclients.end(); |
| 82 | ++p) |
| 83 | (*p)->start_thread(); |
| 84 | |
| 85 | poolctx.stop(); |
| 86 | |
| 87 | //cout << "waiting for client(s) to finish" << std::endl; |
| 88 | while (!clients.empty()) { |
| 89 | Client *client = clients.front(); |
| 90 | SyntheticClient *syn = synclients.front(); |
| 91 | clients.pop_front(); |
| 92 | synclients.pop_front(); |
| 93 | syn->join_thread(); |
| 94 | delete syn; |
| 95 | delete client; |
| 96 | } |
| 97 | |
| 98 | for (int i = 0; i < num_client; ++i) { |
| 99 | // wait for messenger to finish |
nothing calls this directly
no test coverage detected