Skip to content

Commit

Permalink
DAOS-15420 pool: Clean up ds_pool_svc_<op> patch 1
Browse files Browse the repository at this point in the history
Convert ds_pool_svc_check_evict, ds_pool_svc_query_target, and
ds_pool_svc_get_prop to the dsc_pool_svc_call framework.

The req_time variable in dsc_pool_svc_call is part of the operation
identifier, and should therefore retain its value across retries.

Features: pool
Signed-off-by: Li Wei <wei.g.li@intel.com>
Required-githooks: true
  • Loading branch information
liw committed Apr 16, 2024
1 parent c555ef0 commit d919d44
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 296 deletions.
15 changes: 7 additions & 8 deletions src/include/daos_srv/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ int ds_pool_svc_stop(uuid_t pool_uuid);
int ds_pool_svc_rf_to_nreplicas(int svc_rf);
int ds_pool_svc_rf_from_nreplicas(int nreplicas);

int ds_pool_svc_get_prop(uuid_t pool_uuid, d_rank_list_t *ranks,
daos_prop_t *prop);
int dsc_pool_svc_get_prop(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
daos_prop_t *prop);
int ds_pool_svc_set_prop(uuid_t pool_uuid, d_rank_list_t *ranks,
daos_prop_t *prop);
int ds_pool_svc_update_acl(uuid_t pool_uuid, d_rank_list_t *ranks,
Expand All @@ -302,8 +302,8 @@ int ds_pool_svc_delete_acl(uuid_t pool_uuid, d_rank_list_t *ranks,
int dsc_pool_svc_query(uuid_t pool_uuid, d_rank_list_t *ps_ranks, uint64_t deadline,
d_rank_list_t **ranks, daos_pool_info_t *pool_info,
uint32_t *pool_layout_ver, uint32_t *upgrade_layout_ver);
int ds_pool_svc_query_target(uuid_t pool_uuid, d_rank_list_t *ps_ranks, d_rank_t rank,
uint32_t tgt_idx, daos_target_info_t *ti);
int dsc_pool_svc_query_target(uuid_t pool_uuid, d_rank_list_t *ps_ranks, uint64_t deadline,
d_rank_t rank, uint32_t tgt_idx, daos_target_info_t *ti);

int ds_pool_prop_fetch(struct ds_pool *pool, unsigned int bit,
daos_prop_t **prop_out);
Expand Down Expand Up @@ -366,10 +366,9 @@ int ds_pool_svc_list_cont(uuid_t uuid, d_rank_list_t *ranks,
struct daos_pool_cont_info **containers,
uint64_t *ncontainers);

int ds_pool_svc_check_evict(uuid_t pool_uuid, d_rank_list_t *ranks,
uuid_t *handles, size_t n_handles,
uint32_t destroy, uint32_t force,
char *machine, uint32_t *count);
int dsc_pool_svc_check_evict(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
uuid_t *handles, size_t n_handles, uint32_t destroy, uint32_t force,
char *machine, uint32_t *count);

int ds_pool_target_status_check(struct ds_pool *pool, uint32_t id,
uint8_t matched_status, struct pool_target **p_tgt);
Expand Down
12 changes: 12 additions & 0 deletions src/mgmt/srv_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
#include "rpc.h"
#include "srv_layout.h"

/*
* Use a fixed timeout that matches what the control plane uses for the
* moment.
*
* TODO: Pass the deadline from dmg (or daos_server).
*/
static inline uint64_t
mgmt_ps_call_deadline(void)
{
return daos_getmtime_coarse() + 5 * 60 * 1000;
}

/** srv.c */
void ds_mgmt_hdlr_svc_rip(crt_rpc_t *rpc);
void ds_mgmt_params_set_hdlr(crt_rpc_t *rpc);
Expand Down
28 changes: 9 additions & 19 deletions src/mgmt/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ ds_mgmt_evict_pool(uuid_t pool_uuid, d_rank_list_t *svc_ranks, uuid_t *handles,
D_DEBUG(DB_MGMT, "evict pool "DF_UUID"\n", DP_UUID(pool_uuid));

/* Evict active pool connections if they exist*/
rc = ds_pool_svc_check_evict(pool_uuid, svc_ranks, handles, n_handles,
destroy, force_destroy, machine, count);
rc = dsc_pool_svc_check_evict(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), handles,
n_handles, destroy, force_destroy, machine, count);
if (rc != 0) {
D_ERROR("Failed to evict pool handles" DF_UUID " rc: " DF_RC "\n",
DP_UUID(pool_uuid), DP_RC(rc));
Expand Down Expand Up @@ -407,25 +407,15 @@ ds_mgmt_pool_query(uuid_t pool_uuid, d_rank_list_t *svc_ranks, d_rank_list_t **r
daos_pool_info_t *pool_info, uint32_t *pool_layout_ver,
uint32_t *upgrade_layout_ver)
{
uint64_t deadline;

if (pool_info == NULL) {
D_ERROR("pool_info was NULL\n");
return -DER_INVAL;
}

D_DEBUG(DB_MGMT, "Querying pool "DF_UUID"\n", DP_UUID(pool_uuid));

/*
* Use a fixed timeout that matches what the control plane uses for the
* moment.
*
* TODO: Pass the deadline from dmg (or daos_server).
*/
deadline = daos_getmtime_coarse() + 5 * 60 * 1000;

return dsc_pool_svc_query(pool_uuid, svc_ranks, deadline, ranks, pool_info, pool_layout_ver,
upgrade_layout_ver);
return dsc_pool_svc_query(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), ranks, pool_info,
pool_layout_ver, upgrade_layout_ver);
}

/**
Expand Down Expand Up @@ -462,10 +452,10 @@ ds_mgmt_pool_query_targets(uuid_t pool_uuid, d_rank_list_t *svc_ranks, d_rank_t
for (i = 0; i < tgts->rl_nr; i++) {
D_DEBUG(DB_MGMT, "Querying pool "DF_UUID" rank %u tgt %u\n", DP_UUID(pool_uuid),
rank, tgts->rl_ranks[i]);
rc = ds_pool_svc_query_target(pool_uuid, svc_ranks, rank, tgts->rl_ranks[i],
&out_infos[i]);
rc = dsc_pool_svc_query_target(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), rank,
tgts->rl_ranks[i], &out_infos[i]);
if (rc != 0) {
D_ERROR(DF_UUID": ds_pool_svc_query_target() failed rank %u tgt %u\n",
D_ERROR(DF_UUID": dsc_pool_svc_query_target() failed rank %u tgt %u\n",
DP_UUID(pool_uuid), rank, tgts->rl_ranks[i]);
goto out;
}
Expand Down Expand Up @@ -498,7 +488,7 @@ get_access_props(uuid_t pool_uuid, d_rank_list_t *ranks, daos_prop_t **prop)
for (i = 0; i < ACCESS_PROPS_LEN; i++)
new_prop->dpp_entries[i].dpe_type = ACCESS_PROPS[i];

rc = ds_pool_svc_get_prop(pool_uuid, ranks, new_prop);
rc = dsc_pool_svc_get_prop(pool_uuid, ranks, mgmt_ps_call_deadline(), new_prop);
if (rc != 0) {
daos_prop_free(new_prop);
return rc;
Expand Down Expand Up @@ -644,7 +634,7 @@ ds_mgmt_pool_get_prop(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
D_DEBUG(DB_MGMT, "Getting properties for pool "DF_UUID"\n",
DP_UUID(pool_uuid));

rc = ds_pool_svc_get_prop(pool_uuid, svc_ranks, prop);
rc = dsc_pool_svc_get_prop(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), prop);

out:
return rc;
Expand Down
Loading

0 comments on commit d919d44

Please sign in to comment.