/** glfs_sysrq.c * * Simple test application to run all glfs_syqrq() debugging calls. * * Usage: ./glfs_sysrq */ #include #include #include int main(int argc, char *argv[]) { /* cmdline arguments */ char *host = NULL; char *volume = NULL; char *logfile = NULL; /* other variables */ glfs_t *fs = NULL; int ret = 0; if (argc != 4) { fprintf(stderr, "Usage: %s \n", argv[0]); return -1; } host = argv[1]; volume = argv[2]; logfile = argv[3]; fs = glfs_new(volume); if (!fs) { return -1; } ret = glfs_set_logging(fs, logfile, 7); if (ret < 0) { return -1; } ret = glfs_set_volfile_server(fs, "tcp", host, 24007); if (ret < 0) { return -1; } ret = glfs_init(fs); if (ret < 0) { return -1; } /* checking of the results is easier in the script running this test */ glfs_sysrq(fs, GLFS_SYSRQ_HELP); glfs_sysrq(fs, GLFS_SYSRQ_STATEDUMP); glfs_fini(fs); return 0; } *cli_volume_type[] = {"Distribute", "Stripe", "Replicate", "Distributed-Stripe", "Distributed-Replicate", }; char *cli_volume_status[] = {"Created", "Started", "Stopped" }; int32_t gf_cli3_1_get_volume (call_frame_t *frame, xlator_t *this, void *data); rpc_clnt_prog_t cli_handshake_prog = { .progname = "cli handshake", .prognum = GLUSTER_HNDSK_PROGRAM, .progver = GLUSTER_HNDSK_VERSION, }; rpc_clnt_prog_t cli_pmap_prog = { .progname = "cli portmap", .prognum = GLUSTER_PMAP_PROGRAM, .progver = GLUSTER_PMAP_VERSION, }; int gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { gf1_cli_probe_rsp rsp = {0,}; int ret = 0; if (-1 == req->rpc_status) { goto out; } ret = gf_xdr_to_cli_probe_rsp (*iov, &rsp); if (ret < 0) { gf_log ("", GF_LOG_ERROR, "error"); //rsp.op_ret = -1; //rsp.op_errno = EINVAL; goto out; } gf_log ("cli", GF_LOG_NORMAL, "Received resp to probe"); if (!rsp.op_ret) { switch (rsp.op_errno) { case GF_PROBE_SUCCESS: cli_out ("Probe successful"); break; case GF_PROBE_LOCALHOST: cli_out ("Probe on localhost not needed"); break; case GF_PROBE_FRIEND: cli_out ("Probe on host %s port %d already" " in peer list", rsp.hostname, rsp.port); break; default: cli_out ("Probe returned with unknown errno %d", rsp.op_errno); break; } } if (rsp.op_ret) { switch (rsp.op_errno) { case GF_PROBE_ANOTHER_CLUSTER: cli_out ("%s is already part of " "another cluster", rsp.hostname); break; case GF_PROBE_VOLUME_CONFLICT: cli_out ("Atleast one volume on %s conflicts " "with existing volumes in the " "cluster", rsp.hostname); break; case GF_PROBE_UNKNOWN_PEER: