cancelClusterGroupOperation 函式 (clusapi.h)
可讓用戶端取消群組擱置的 MoveClusterGroup 或 MoveClusterGroupEx 作業。 然後,群組會傳回至其永續性狀態。
語法
DWORD CancelClusterGroupOperation(
[in] HGROUP hGroup,
[in] DWORD dwCancelFlags_RESERVED
);
參數
[in] hGroup
叢集群組的句柄。
[in] dwCancelFlags_RESERVED
此參數保留供日後使用,且必須設定為零。
傳回值
如果已成功取消群組上的移動作業,CancelClusterGroupOperation 會傳回ERROR_SUCCESS。
CancelClusterGroupOperation 會 傳回ERROR_IO_PENDING ,如果目前正在進行移動作業的取消。
CancelClusterGroupOperation 如果在指定群組上發出移動群組作業的取消失敗,則會傳回不同的非零錯誤碼。
備註
CancelClusterGroupOperation 會嘗試取消透過 MoveClusterGroup 或 MoveClusterGroupEx 呼叫發出之叢集群組上的擱置移動作業,該呼叫會 傳回ERROR_IO_PENDING 且仍在進行中。 呼叫會嘗試取消暫止移動作業,並將群組帶入其持續性狀態。
範例
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <ClusAPI.h>
#define DemoResDllTypeName L"dummy"
#define DemoGroupName L"DemoGroup"
int __cdecl main( void )
{
HCLUSTER hCluster= NULL;
HGROUP hGroup = NULL;
DWORD error = 0;
hCluster = OpenCluster( NULL );
if ( hCluster == NULL )
{
error = GetLastError();
wprintf( L"Failed to open cluster: 0x%x\n", error );
goto Cleanup;
}
hGroup = OpenClusterGroup( hCluster, DemoGroupName );
if ( hGroup == NULL )
{
error = GetLastError();
wprintf( L"Failed to open cluster group " DemoGroupName L": 0x%x\n", error );
goto Cleanup;
}
// Cancel Move Group example
error = MoveClusterGroupEx( hGroup,
NULL,
CLUSAPI_GROUP_MOVE_RETURN_TO_SOURCE_NODE_ON_ERROR | CLUSAPI_GROUP_MOVE_IGNORE_RESOURCE_STATUS,
NULL,
0);
if ( error == ERROR_IO_PENDING )
{
wprintf( L"Group move pending" DemoGroupName L": 0x%x\n", error );
error = ERROR_SUCCESS;
// Issuing cancel to the move operation
error = CancelClusterGroupOperation(hGroup, 0);
if ( error == ERROR_IO_PENDING || error == ERROR_SUCCESS )
{
// the cancel was registered successfully
wprintf( L"Cancel issued for move operation for the group " DemoGroupName L"\n" );
}
else
{
wprintf( L"Failed to Cancel move operation for the group " DemoGroupName L": 0x%x\n" );
}
}
else if ( error != ERROR_SUCCESS)
{
wprintf( L"Failed to move group" DemoGroupName L": 0x%x\n", error );
}
else
{
wprintf( L"Group move completed" DemoGroupName L": 0x%x\n");
}
Cleanup:
if ( hGroup != NULL )
{
CloseClusterGroup( hGroup );
hGroup = NULL;
}
if ( hCluster != NULL )
{
CloseCluster( hCluster );
hCluster = NULL;
}
return (int)error;
}
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 | 都不支援 |
最低支援的伺服器 | Windows Server 2012 |
目標平台 | Windows |
標頭 | clusapi.h |
程式庫 | ClusAPI.lib |
Dll | ClusAPI.dll |