Skip to content
Snippets Groups Projects
Commit 29800400 authored by Danny Auble's avatar Danny Auble
Browse files

made it so when making new partitions it will try to create them multiple...

made it so when making new partitions it will try to create them multiple times if it fails in the api.
parent 9c81c490
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,8 @@ static void _pre_allocate(bgl_record_t *bgl_record); ...@@ -52,6 +52,8 @@ static void _pre_allocate(bgl_record_t *bgl_record);
static int _post_allocate(bgl_record_t *bgl_record); static int _post_allocate(bgl_record_t *bgl_record);
static int _post_bgl_init_read(void *object, void *arg); static int _post_bgl_init_read(void *object, void *arg);
#define MAX_ADD_RETRY 5
#if 0 #if 0
/* Vestigial /* Vestigial
* print out a list * print out a list
...@@ -135,16 +137,27 @@ static void _pre_allocate(bgl_record_t *bgl_record) ...@@ -135,16 +137,27 @@ static void _pre_allocate(bgl_record_t *bgl_record)
*/ */
static int _post_allocate(bgl_record_t *bgl_record) static int _post_allocate(bgl_record_t *bgl_record)
{ {
int rc; int rc, i;
pm_partition_id_t part_id; pm_partition_id_t part_id;
struct passwd *pw_ent = NULL; struct passwd *pw_ent = NULL;
/* Add partition record to the DB */ /* Add partition record to the DB */
debug("adding partition\n"); debug("adding partition\n");
if ((rc = rm_add_partition(bgl_record->bgl_part)) != STATUS_OK) { for(i=0;i<MAX_ADD_RETRY; i++) {
error("rm_add_partition(): %s", bgl_err_str(rc)); if ((rc = rm_add_partition(bgl_record->bgl_part)) != STATUS_OK) {
rc = SLURM_ERROR; error("rm_add_partition(): %s", bgl_err_str(rc));
goto cleanup; rc = SLURM_ERROR;
} else {
rc = SLURM_SUCCESS;
break;
}
sleep(3);
}
if(rc == SLURM_ERROR) {
if ((rc = rm_free_partition(bgl_record->bgl_part))
!= STATUS_OK)
error("rm_free_partition(): %s", bgl_err_str(rc));
fatal("couldn't add last partition.");
} }
debug("done adding\n"); debug("done adding\n");
...@@ -174,7 +187,6 @@ static int _post_allocate(bgl_record_t *bgl_record) ...@@ -174,7 +187,6 @@ static int _post_allocate(bgl_record_t *bgl_record)
last_bgl_update = time(NULL); last_bgl_update = time(NULL);
} }
cleanup:
/* We are done with the partition */ /* We are done with the partition */
if ((rc = rm_free_partition(bgl_record->bgl_part)) != STATUS_OK) if ((rc = rm_free_partition(bgl_record->bgl_part)) != STATUS_OK)
error("rm_free_partition(): %s", bgl_err_str(rc)); error("rm_free_partition(): %s", bgl_err_str(rc));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment