11/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22/*
33 * Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
4- * Copyright (c) 2014-2017 Research Organization for Information Science
4+ * Copyright (c) 2014-2018 Research Organization for Information Science
55 * and Technology (RIST). All rights reserved.
66 * Copyright (c) 2014-2015 Mellanox Technologies, Inc.
77 * All rights reserved.
@@ -220,6 +220,7 @@ int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
220220 pmix_status_t rc ;
221221 pmix_proc_t p ;
222222 opal_pmix1_jobid_trkr_t * job , * jptr ;
223+ opal_value_t * hack ;
223224
224225 if (NULL != proc ) {
225226 /* look thru our list of jobids and find the
@@ -232,10 +233,15 @@ int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
232233 }
233234 }
234235 if (NULL == job ) {
235- job = OBJ_NEW (opal_pmix1_jobid_trkr_t );
236- (void )opal_snprintf_jobid (job -> nspace , PMIX_MAX_NSLEN , proc -> jobid );
237- job -> jobid = proc -> jobid ;
238- opal_list_append (& mca_pmix_ext1x_component .jobids , & job -> super );
236+ /* if we don't know about the job, then neither will the internal
237+ * storage routine in PMIx. In this older version of PMIx, there
238+ * is no way to insert an nspace into the client, and so we cannot
239+ * get around the problem there. Instead, we need to hold such
240+ * values locally in the component. Sadly, we cannot just use
241+ * the input val param as it might not be dynamic, so copy it here */
242+ opal_dss .copy ((void * * )& hack , val , OPAL_VALUE );
243+ opal_list_append (& mca_pmix_ext1x_component .values , & hack -> super );
244+ return OPAL_SUCCESS ;
239245 }
240246 (void )strncpy (p .nspace , job -> nspace , PMIX_MAX_NSLEN );
241247 p .rank = proc -> vpid ;
@@ -447,6 +453,15 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
447453 }
448454 }
449455 if (NULL == job ) {
456+ /* see if we have this key on our local value list */
457+ OPAL_LIST_FOREACH (ival , & mca_pmix_ext1x_component .values , opal_value_t ) {
458+ if (0 == strcmp (key , ival -> key )) {
459+ /* got it */
460+ opal_dss .copy ((void * * )val , ival , OPAL_VALUE );
461+ return OPAL_SUCCESS ;
462+ }
463+ }
464+ /* otherwise, we can't find it */
450465 return OPAL_ERR_NOT_FOUND ;
451466 }
452467 (void )strncpy (p .nspace , job -> nspace , PMIX_MAX_NSLEN );
@@ -497,6 +512,9 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
497512 ret = OPAL_SUCCESS ;
498513 } else {
499514 * val = OBJ_NEW (opal_value_t );
515+ if (NULL != key ) {
516+ (* val )-> key = strdup (key );
517+ }
500518 ret = pmix1_value_unload (* val , kv );
501519 PMIX_VALUE_FREE (kv , 1 );
502520 }
@@ -693,7 +711,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
693711 PMIX_INFO_CREATE (pinfo , ninfo );
694712 n = 0 ;
695713 OPAL_LIST_FOREACH (iptr , info , opal_value_t ) {
696- (void )strncpy (pinfo [n ++ ].key , iptr -> key , PMIX_MAX_KEYLEN );
714+ (void )strncpy (pinfo [n ].key , iptr -> key , PMIX_MAX_KEYLEN );
697715 pmix1_value_load (& pinfo [n ].value , iptr );
698716 ++ n ;
699717 }
@@ -863,7 +881,7 @@ int pmix1_unpublish(char **keys, opal_list_t *info)
863881 PMIX_INFO_CREATE (pinfo , ninfo );
864882 n = 0 ;
865883 OPAL_LIST_FOREACH (iptr , info , opal_value_t ) {
866- (void )strncpy (pinfo [n ++ ].key , iptr -> key , PMIX_MAX_KEYLEN );
884+ (void )strncpy (pinfo [n ].key , iptr -> key , PMIX_MAX_KEYLEN );
867885 pmix1_value_load (& pinfo [n ].value , iptr );
868886 ++ n ;
869887 }
0 commit comments