Skip to content

Commit c5561ce

Browse files
JulianKunkelglennklockwood
authored andcommitted
Merge pull request #467 from mchaarawi/mschaara/dfs_cleanup
aiori-dfs: cleanup old and unsupported DAOS code
1 parent 798b954 commit c5561ce

File tree

1 file changed

+11
-44
lines changed

1 file changed

+11
-44
lines changed

src/aiori-DFS.c

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options,
8989
*init_backend_options = (aiori_mod_opt_t *) o;
9090

9191
option_help h [] = {
92-
{0, "dfs.pool", "Pool label or uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
92+
{0, "dfs.pool", "Pool label", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool},
9393
{0, "dfs.group", "DAOS system name", OPTION_OPTIONAL_ARGUMENT, 's', &o->group},
94-
{0, "dfs.cont", "Container label or uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
94+
{0, "dfs.cont", "Container label", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont},
9595
{0, "dfs.chunk_size", "File chunk size in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size},
9696
{0, "dfs.oclass", "File object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass},
9797
{0, "dfs.dir_oclass", "Directory object class", OPTION_OPTIONAL_ARGUMENT, 's',
@@ -172,7 +172,7 @@ do { \
172172
} \
173173
} while (0)
174174

175-
#define INFO(level, format, ...) \
175+
#define DINFO(level, format, ...) \
176176
do { \
177177
if (verbose >= level) \
178178
printf("[%d] "format"\n", rank, ##__VA_ARGS__); \
@@ -462,7 +462,6 @@ DFS_Init(aiori_mod_opt_t * options)
462462
{
463463
DFS_options_t *o = (DFS_options_t *)options;
464464
bool pool_connect, cont_create, cont_open, dfs_mounted;
465-
uuid_t co_uuid;
466465
int rc;
467466

468467
dfs_init_count++;
@@ -513,45 +512,23 @@ DFS_Init(aiori_mod_opt_t * options)
513512
daos_pool_info_t pool_info;
514513
daos_cont_info_t co_info;
515514

516-
INFO(VERBOSE_1, "DFS Pool = %s", o->pool);
517-
INFO(VERBOSE_1, "DFS Container = %s", o->cont);
515+
DINFO(VERBOSE_1, "DFS Pool = %s", o->pool);
516+
DINFO(VERBOSE_1, "DFS Container = %s", o->cont);
518517

519-
#if CHECK_DAOS_API_VERSION(1, 4)
520518
rc = daos_pool_connect(o->pool, o->group, DAOS_PC_RW, &poh, &pool_info, NULL);
521519
DCHECK(rc, "Failed to connect to pool %s", o->pool);
522520
pool_connect = true;
523521

524522
rc = daos_cont_open(poh, o->cont, DAOS_COO_RW, &coh, &co_info, NULL);
525-
#else
526-
uuid_t pool_uuid;
527-
528-
rc = uuid_parse(o->pool, pool_uuid);
529-
DCHECK(rc, "Failed to parse 'Pool uuid': %s", o->pool);
530-
rc = uuid_parse(o->cont, co_uuid);
531-
DCHECK(rc, "Failed to parse 'Cont uuid': %s", o->cont);
532-
533-
rc = daos_pool_connect(pool_uuid, o->group, DAOS_PC_RW, &poh, &pool_info, NULL);
534-
DCHECK(rc, "Failed to connect to pool %s", o->pool);
535-
pool_connect = true;
536-
537-
rc = daos_cont_open(poh, co_uuid, DAOS_COO_RW, &coh, &co_info, NULL);
538-
#endif
539523
/* If NOEXIST we create it */
540524
if (rc == -DER_NONEXIST) {
541-
INFO(VERBOSE_1, "Creating DFS Container ...\n");
542-
#if CHECK_DAOS_API_VERSION(1, 4)
543-
if (uuid_parse(o->cont, co_uuid) != 0)
544-
/** user passes in label */
545-
rc = dfs_cont_create_with_label(poh, o->cont, NULL, &co_uuid, &coh, NULL);
546-
else
547-
/** user passes in uuid */
548-
#endif
549-
rc = dfs_cont_create(poh, co_uuid, NULL, &coh, NULL);
525+
DINFO(VERBOSE_1, "Creating DFS Container ...\n");
526+
rc = dfs_cont_create_with_label(poh, o->cont, NULL, NULL, &coh, NULL);
550527
if (rc)
551528
DCHECK(rc, "Failed to create container");
552529
cont_create = true;
553530
} else if (rc) {
554-
DCHECK(rc, "Failed to create container");
531+
DCHECK(rc, "Failed to open container %s", o->cont);
555532
}
556533
cont_open = true;
557534

@@ -579,11 +556,7 @@ DFS_Init(aiori_mod_opt_t * options)
579556
if (cont_open)
580557
daos_cont_close(coh, NULL);
581558
if (cont_create && rank == 0) {
582-
#if CHECK_DAOS_API_VERSION(1, 4)
583559
daos_cont_destroy(poh, o->cont, 1, NULL);
584-
#else
585-
daos_cont_destroy(poh, co_uuid, 1, NULL);
586-
#endif
587560
}
588561
if (pool_connect)
589562
daos_pool_disconnect(poh, NULL);
@@ -633,14 +606,8 @@ DFS_Finalize(aiori_mod_opt_t *options)
633606

634607
if (o->destroy) {
635608
if (rank == 0) {
636-
INFO(VERBOSE_1, "Destroying DFS Container: %s", o->cont);
637-
#if CHECK_DAOS_API_VERSION(1, 4)
609+
DINFO(VERBOSE_1, "Destroying DFS Container: %s", o->cont);
638610
daos_cont_destroy(poh, o->cont, 1, NULL);
639-
#else
640-
uuid_t uuid;
641-
uuid_parse(o->cont, uuid);
642-
rc = daos_cont_destroy(poh, uuid, 1, NULL);
643-
#endif
644611
DCHECK(rc, "Failed to destroy container %s", o->cont);
645612
}
646613

@@ -652,15 +619,15 @@ DFS_Finalize(aiori_mod_opt_t *options)
652619
}
653620

654621
if (rank == 0)
655-
INFO(VERBOSE_1, "Disconnecting from DAOS POOL");
622+
DINFO(VERBOSE_1, "Disconnecting from DAOS POOL");
656623

657624
rc = daos_pool_disconnect(poh, NULL);
658625
DCHECK(rc, "Failed to disconnect from pool");
659626

660627
MPI_CHECK(MPI_Barrier(testComm), "barrier error");
661628

662629
if (rank == 0)
663-
INFO(VERBOSE_1, "Finalizing DAOS..");
630+
DINFO(VERBOSE_1, "Finalizing DAOS..");
664631

665632
rc = daos_fini();
666633
DCHECK(rc, "Failed to finalize DAOS");

0 commit comments

Comments
 (0)