Created
February 12, 2014 11:57
-
-
Save wido/8954223 to your computer and use it in GitHub Desktop.
Testing Ceph RADOS timeout options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <rados/librados.h> | |
int set_rados_option(rados_t cluster, const char *option, const char *value) { | |
printf("Set the %s option to: %s\n", option, value); | |
return rados_conf_set(cluster, option, value); | |
} | |
int main(int argc, char *argv[]) { | |
rados_t cluster; | |
rados_ioctx_t io; | |
int r; | |
const char *id = "admin"; | |
const char *key = "AQC1gV1RCGYeMhAAIoZd1ubeGTWFHOGjmq6CAg=="; | |
const char *mon = "localhost"; | |
const char *pool_name = "data"; | |
const char *client_timeout = "5"; | |
rados_create(&cluster, id); | |
printf("%s\n", "Created the RADOS cluster"); | |
set_rados_option(cluster, "key", key); | |
set_rados_option(cluster, "mon_host", mon); | |
set_rados_option(cluster, "client_mount_timeout", client_timeout); | |
r = rados_connect(cluster); | |
if (r < 0) { | |
printf("%s: %d\n", "Failed to connect to the Ceph cluster", r); | |
} else { | |
printf("%s\n", "Connected to the RADOS cluster"); | |
} | |
r = rados_ioctx_create(cluster, pool_name, io); | |
if (r < 0) { | |
printf("%s: %d\n", "Failed to connect to the Ceph cluster", r); | |
} else { | |
printf("%s\n", "Connected to the RADOS cluster"); | |
} | |
rados_shutdown(cluster); | |
printf("%s\n", "Shut down the RADOS cluster"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment