1
1

If it's not the HNP, release the cluster object first and return.

This commit was SVN r18247.
Этот коммит содержится в:
Shiqing Fan 2008-04-23 13:21:32 +00:00
родитель 750ce0152c
Коммит eb5f5d77cc
2 изменённых файлов: 45 добавлений и 43 удалений

Просмотреть файл

@ -26,12 +26,12 @@
#include "orte/mca/plm/base/base.h" #include "orte/mca/plm/base/base.h"
#include "orte/mca/plm/base/plm_private.h" #include "orte/mca/plm/base/plm_private.h"
#include "plm_ccp.h" #include "plm_ccp.h"
/* Import the Windows CCP API. */ /* Import the Windows CCP API. */
#import "ccpapi.tlb" named_guids no_namespace raw_interfaces_only \ #import "ccpapi.tlb" named_guids no_namespace raw_interfaces_only \
rename("SetEnvironmentVariable","SetEnvVar") \ rename("SetEnvironmentVariable","SetEnvVar") \
rename("GetJob", "GetSingleJob") \ rename("GetJob", "GetSingleJob") \
rename("AddJob", "AddSingleJob") rename("AddJob", "AddSingleJob")
/* /*
@ -133,26 +133,27 @@ static int plm_ccp_close(void)
static orte_plm_base_module_t *plm_ccp_init(int *priority) static orte_plm_base_module_t *plm_ccp_init(int *priority)
{ {
int rc; int rc;
ICluster* pCluster = NULL; ICluster* pCluster = NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
/* CCP is not thread safe. Use the apartment model. */ /* CCP is not thread safe. Use the apartment model. */
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
/* Try to create the Cluster object. */ /* Try to create the Cluster object. */
hr = CoCreateInstance( __uuidof(Cluster), hr = CoCreateInstance( __uuidof(Cluster),
NULL, NULL,
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
__uuidof(ICluster), __uuidof(ICluster),
reinterpret_cast<void **> (&pCluster) ); reinterpret_cast<void **> (&pCluster) );
if (FAILED(hr)) { if (FAILED(hr)) {
/* We are not Windows clusters, don't select us.*/ /* We are not Windows clusters, don't select us.*/
return NULL; return NULL;
} }
/* if we are NOT an HNP, then don't select us */ /* if we are NOT an HNP, then don't select us */
if (!orte_process_info.hnp) { if (!orte_process_info.hnp) {
pCluster->Release();
return NULL; return NULL;
} }

Просмотреть файл

@ -21,12 +21,12 @@
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "ras_ccp.h" #include "ras_ccp.h"
/* Import the Windows CCP API. */ /* Import the Windows CCP API. */
#import "ccpapi.tlb" named_guids no_namespace raw_interfaces_only \ #import "ccpapi.tlb" named_guids no_namespace raw_interfaces_only \
rename("SetEnvironmentVariable","SetEnvVar") \ rename("SetEnvironmentVariable","SetEnvVar") \
rename("GetJob", "GetSingleJob") \ rename("GetJob", "GetSingleJob") \
rename("AddJob", "AddSingleJob") rename("AddJob", "AddSingleJob")
/* /*
@ -90,26 +90,27 @@ static int ras_ccp_open(void)
static orte_ras_base_module_t *ras_ccp_init(int* priority) static orte_ras_base_module_t *ras_ccp_init(int* priority)
{ {
int rc; int rc;
ICluster* pCluster = NULL; ICluster* pCluster = NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
/* CCP is not thread safe. Use the apartment model. */ /* CCP is not thread safe. Use the apartment model. */
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
/* Try to create the Cluster object. */ /* Try to create the Cluster object. */
hr = CoCreateInstance( __uuidof(Cluster), hr = CoCreateInstance( __uuidof(Cluster),
NULL, NULL,
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
__uuidof(ICluster), __uuidof(ICluster),
reinterpret_cast<void **> (&pCluster) ); reinterpret_cast<void **> (&pCluster) );
if (FAILED(hr)) { if (FAILED(hr)) {
/* We are not Windows clusters, don't select us.*/ /* We are not Windows clusters, don't select us.*/
return NULL; return NULL;
} }
/* if we are NOT an HNP, then don't select us */ /* if we are NOT an HNP, then don't select us */
if (!orte_process_info.hnp) { if (!orte_process_info.hnp) {
pCluster->Release();
return NULL; return NULL;
} }