次の方法で共有


CancelClusterGroupOperation 関数 (clusapi.h)

クライアントが、グループに対して保留中の MoveClusterGroup または MoveClusterGroupEx 操作を取り消すことができます。 その後、グループは永続的な状態に戻されます。

構文

DWORD CancelClusterGroupOperation(
  [in] HGROUP hGroup,
  [in] DWORD  dwCancelFlags_RESERVED
);

パラメーター

[in] hGroup

クラスター グループへのハンドル。

[in] dwCancelFlags_RESERVED

このパラメーターは将来使用するために予約されており、0 に設定する必要があります。

戻り値

CancelClusterGroupOperation は、グループの移動操作が正常に取り消 された場合に ERROR_SUCCESSを返します。

移動操作の取り消しが進行中の場合、CancelClusterGroupOperation はERROR_IO_PENDINGを返します。

CancelClusterGroupOperation は、指定されたグループに対する移動グループ操作の取り消しを発行するエラーが発生した場合に、別の 0 以外のエラー コードを返します。

注釈

CancelClusterGroupOperation は、ERROR_IO_PENDINGを返し、まだ進行中の MoveClusterGroup または MoveClusterGroupEx 呼び出しを介して発行されたクラスター グループに対する保留中の移動操作を取り消そうとします。 この呼び出しでは、保留中の移動操作を取り消し、グループを永続的な状態にします。

#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