Skip to content

Commit

Permalink
DAOS-15420 pool: Clean up ds_pool_svc_<op>
Browse files Browse the repository at this point in the history
Convert

  ds_pool_svc_check_evict
  ds_pool_svc_query_target
  ds_pool_svc_get_prop
  ds_pool_svc_set_prop
  ds_pool_svc_target_update_state
  ds_pool_svc_update_acl
  ds_pool_svc_delete_acl
  ds_pool_svc_upgrade
  ds_pool_extend

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 May 7, 2024
1 parent 5655ac9 commit 429f293
Show file tree
Hide file tree
Showing 6 changed files with 715 additions and 857 deletions.
41 changes: 20 additions & 21 deletions src/include/daos_srv/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ int ds_pool_chk_post(uuid_t uuid);
int ds_pool_start_with_svc(uuid_t uuid);
int ds_pool_start(uuid_t uuid);
void ds_pool_stop(uuid_t uuid);
int ds_pool_extend(uuid_t pool_uuid, int ntargets, const d_rank_list_t *rank_list, int ndomains,
const uint32_t *domains, d_rank_list_t *svc_ranks);
int ds_pool_target_update_state(uuid_t pool_uuid, d_rank_list_t *ranks,
struct pool_target_addr_list *target_list,
pool_comp_state_t state);
int dsc_pool_svc_extend(uuid_t pool_uuid, d_rank_list_t *svc_ranks, uint64_t deadline, int ntargets,
const d_rank_list_t *rank_list, int ndomains, const uint32_t *domains);
int dsc_pool_svc_update_target_state(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
struct pool_target_addr_list *target_list,
pool_comp_state_t state);

int
ds_pool_svc_dist_create(const uuid_t pool_uuid, int ntargets, const char *group,
Expand All @@ -290,25 +290,25 @@ 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 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,
struct daos_acl *acl);
int ds_pool_svc_delete_acl(uuid_t pool_uuid, d_rank_list_t *ranks,
enum daos_acl_principal_type principal_type,
const char *principal_name);
int dsc_pool_svc_get_prop(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
daos_prop_t *prop);
int dsc_pool_svc_set_prop(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
daos_prop_t *prop);
int dsc_pool_svc_update_acl(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
struct daos_acl *acl);
int dsc_pool_svc_delete_acl(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline,
enum daos_acl_principal_type principal_type,
const char *principal_name);

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);
int ds_pool_svc_upgrade(uuid_t pool_uuid, d_rank_list_t *ranks);
int dsc_pool_svc_upgrade(uuid_t pool_uuid, d_rank_list_t *ranks, uint64_t deadline);
int ds_pool_failed_add(uuid_t uuid, int rc);
void ds_pool_failed_remove(uuid_t uuid);
int ds_pool_failed_lookup(uuid_t uuid);
Expand Down Expand Up @@ -367,10 +367,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
44 changes: 18 additions & 26 deletions src/mgmt/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ ds_mgmt_pool_extend(uuid_t pool_uuid, d_rank_list_t *svc_ranks, d_rank_list_t *r
/* TODO: Need to make pool service aware of new rank UUIDs */

ntargets = unique_add_ranks->rl_nr;
rc = ds_pool_extend(pool_uuid, ntargets, unique_add_ranks, domains_nr, domains, svc_ranks);
rc = dsc_pool_svc_extend(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), ntargets,
unique_add_ranks, domains_nr, domains);
out:
d_rank_list_free(unique_add_ranks);
return rc;
Expand All @@ -322,8 +323,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 @@ -364,7 +365,8 @@ ds_mgmt_pool_target_update_state(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
}
}

rc = ds_pool_target_update_state(pool_uuid, svc_ranks, target_addrs, state);
rc = dsc_pool_svc_update_target_state(pool_uuid, svc_ranks, mgmt_ps_call_deadline(),
target_addrs, state);

return rc;
}
Expand Down Expand Up @@ -407,25 +409,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 +454,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 +490,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 @@ -536,7 +528,7 @@ ds_mgmt_pool_overwrite_acl(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
prop->dpp_entries[0].dpe_type = DAOS_PROP_PO_ACL;
prop->dpp_entries[0].dpe_val_ptr = daos_acl_dup(acl);

rc = ds_pool_svc_set_prop(pool_uuid, svc_ranks, prop);
rc = dsc_pool_svc_set_prop(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), prop);
if (rc != 0)
goto out_prop;

Expand All @@ -559,7 +551,7 @@ ds_mgmt_pool_update_acl(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
D_DEBUG(DB_MGMT, "Updating ACL for pool "DF_UUID"\n",
DP_UUID(pool_uuid));

rc = ds_pool_svc_update_acl(pool_uuid, svc_ranks, acl);
rc = dsc_pool_svc_update_acl(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), acl);
if (rc != 0)
goto out;

Expand All @@ -586,7 +578,7 @@ ds_mgmt_pool_delete_acl(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
if (rc != 0)
goto out;

rc = ds_pool_svc_delete_acl(pool_uuid, svc_ranks, type, name);
rc = dsc_pool_svc_delete_acl(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), type, name);
if (rc != 0)
goto out_name;

Expand Down Expand Up @@ -615,7 +607,7 @@ ds_mgmt_pool_set_prop(uuid_t pool_uuid, d_rank_list_t *svc_ranks,
D_DEBUG(DB_MGMT, "Setting properties for pool "DF_UUID"\n",
DP_UUID(pool_uuid));

rc = ds_pool_svc_set_prop(pool_uuid, svc_ranks, prop);
rc = dsc_pool_svc_set_prop(pool_uuid, svc_ranks, mgmt_ps_call_deadline(), prop);

out:
return rc;
Expand All @@ -626,7 +618,7 @@ int ds_mgmt_pool_upgrade(uuid_t pool_uuid, d_rank_list_t *svc_ranks)
D_DEBUG(DB_MGMT, "Upgrading pool "DF_UUID"\n",
DP_UUID(pool_uuid));

return ds_pool_svc_upgrade(pool_uuid, svc_ranks);
return dsc_pool_svc_upgrade(pool_uuid, svc_ranks, mgmt_ps_call_deadline());
}

int
Expand All @@ -644,7 +636,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 429f293

Please sign in to comment.