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 |
Library | ClusAPI.lib |
DLL | ClusAPI.dll |