Acquire etcd leases, prevent starting two OSDs with the same number

This commit is contained in:
Vitaliy Filippov
2020-04-25 01:35:52 +03:00
parent d398ddfd3b
commit caa01c6aaf
3 changed files with 302 additions and 123 deletions
+10 -3
View File
@@ -2,8 +2,15 @@
#include <signal.h>
void handle_sigint(int sig)
static osd_t *osd = NULL;
static void handle_sigint(int sig)
{
if (osd)
{
osd->force_stop();
return;
}
exit(0);
}
@@ -25,11 +32,11 @@ int main(int narg, char *args[])
}
}
signal(SIGINT, handle_sigint);
signal(SIGTERM, handle_sigint);
ring_loop_t *ringloop = new ring_loop_t(512);
// FIXME: Create Blockstore from on-disk superblock config and check it against the OSD cluster config
// FIXME: Prevent two OSD starting with same number
blockstore_t *bs = new blockstore_t(config, ringloop);
osd_t *osd = new osd_t(config, bs, ringloop);
osd = new osd_t(config, bs, ringloop);
while (1)
{
ringloop->loop();