プライベート クラウドを削除する

プライベート クラウドは、1 つ以上の vSphere クラスタで構成されます。1 つのプライベート クラウドを削除すると、プライベート クラウド全体が削除されます。プライベート クラウド ノードを含む、すべてのプライベート クラウド コンポーネントが削除されます。

プライベート クラウドのコンポーネントは次のとおりです。

  • ノード
  • 仮想マシン
  • 管理 VLAN とサブネット
  • ワークロードのサブネット
  • プライベート クラウドに保存されているすべてのユーザーデータ
  • すべての外部アクセスルール

プライベート クラウドの削除は、ソフト削除と完全削除の 2 つの段階で行われます。各ステージでは次の処理が行われます。

  1. 削除(復元可能): プライベート クラウドは 7 日間の削除(復元可能)状態になります。このステージでは、次のことが行われます。
    • 請求は直ちに停止されます。
    • NSX セグメントとワークロードへのすべての接続が切断されます。
    • プライベート クラウドの管理画面と API へのアクセスが無効になります。
    • 外部 IP アドレスが無効になっています。
    • プライベート クラウドの構成とデータは保持され、VM は引き続き実行されます。
    • プライベート クラウドを以前の状態に復元できます。
  2. 完全に削除する: 7 日が経過すると、プライベート クラウドとそのリソースは完全に削除されます。ソフト削除状態のプライベート クラウドを完全に削除する場合は、サポートにお問い合わせください。

始める前に

データを保持する場合は、データを別のプライベート クラウド、Google Cloud ストレージ、オンプレミス ストレージ、またはその他のストレージにバックアップします。

gcloud と API の要件

gcloud コマンドライン ツールまたは API を使用して VMware Engine リソースを管理するには、以下で説明するようにツールを構成することをおすすめします。

gcloud

  1. デフォルトのプロジェクト ID を設定します。

    gcloud config set project PROJECT_ID
    
  2. デフォルトのリージョンとゾーンを設定します。

    gcloud config set compute/region REGION
    
    gcloud config set compute/zone ZONE
    

gcloud vmware ツールの詳細については、Cloud SDK リファレンス ドキュメントをご確認ください

API

このドキュメント セットの API の例では、cURL コマンドライン ツールを使用して API がクエリされています。cURL リクエストには、有効なアクセス トークンが必要です。有効なアクセス トークンを取得するにはさまざまな方法があります。次の手順では、gcloud ツールを使用してアクセス トークンを生成します。

  1. Google Cloudにログインします。

    gcloud auth login
    
  2. アクセス トークンを生成して TOKEN にエクスポートします。

    export TOKEN=`gcloud auth print-access-token`
    
  3. TOKEN が正しく設定されていることを確認します。

    echo $TOKEN
    

API へのリクエストで認証トークンを使用します。次に例を示します。

curl -X GET -H "Authorization: Bearer \"$TOKEN\"" -H "Content-Type: application/json; charset=utf-8" https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations

Python

このドキュメントの Python コードサンプルは、VMware Engine ライブラリを使用して API と通信します。このアプローチを使用するには、ライブラリをインストールし、アプリケーションのデフォルト認証情報を構成する必要があります。

  1. Python ライブラリをダウンロードしてインストールします。

    pip install google-cloud-vmwareengine
    
  2. シェルで次のコマンドを実行して、ADC 情報を構成します。

    gcloud auth application-default login
    

    または、サービス アカウント キー ファイルを使用します。

    export GOOGLE_APPLICATION_CREDENTIALS="FILE_PATH"
    

ライブラリの詳細については、リファレンス ページまたは GitHub のコードサンプルをご覧ください。

プライベート クラウドを削除する

ワークロード ネットワーク IP CIDR をすぐに使用できるようにするには、プライベート クラウドの削除を開始する前に、プライベート クラウド内のすべての VM をシャットダウンします。

コンソール

  1. Google Cloud コンソールで、[プライベート クラウド] ページに移動します。

    [プライベート クラウド] に移動

  2. [プロジェクトを選択] をクリックし、プライベート クラウドを削除する組織、フォルダ、またはプロジェクトを選択します。

  3. 削除するプライベート クラウドを選択します。

  4. 概要ページで、[Delete this Private Cloud] をクリックします。

  5. 確認ページで、削除操作のすべての結果を確認するよう求められます。これらをよく読み、結果を受け入れる準備ができている場合にのみ、削除を続行します。結果を受け入れる準備ができたら、すべてのチェックボックスをオンにします。

  6. 削除を実行するまでの待機時間(1 ~ 8 時間)を入力します。この期間内であれば、[Cancel] をクリックして削除をキャンセルできます。

  7. 削除するプライベート クラウドを認識していることを確認するため、削除するプライベート クラウドの名前を入力します。

  8. [Delete] をクリックして、削除するプライベート クラウドにマークを付けます。

削除プロセスは、指定した遅延(時間数)の後に開始され、完了するまで実行されます。

gcloud

Google Cloud CLI を使用してプライベート クラウドを削除するには、gcloud vmware private-clouds delete コマンドを使用します。

  gcloud vmware private-clouds delete PRIVATE_CLOUD_ID \
     --location=ZONE [--delay-hours=HOURS]

次のように置き換えます。

+   `PRIVATE_CLOUD_ID`: the private cloud ID for
    this request
+   `ZONE`: the zone for this private cloud
+   `HOURS`: the numbers of hours to delay this
    request. By default, this is set to 3 hours, but you can set this
    from 0 to 8 hours. Setting this value to 0 means the deletion
    request will start immediately.

API

VMware Engine API を使用してプライベート クラウドを削除するには、DELETE リクエストを行います。

curl -X DELETE -H "Authorization: Bearer TOKEN"  -H "Content-Type: application/json; charset=utf-8" https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/privateClouds?privateCloudId=PRIVATE_CLOUD_ID&mps;delayHours=HOUR

次のように置き換えます。

+   `TOKEN`: the authorization token for this
    request.
+   `PROJECT_ID`: the project for this request
+   `ZONE`: the zone for the private cloud
+   `PRIVATE_CLOUD_ID`: the private cloud ID for
    the private cloud
+   `HOUR`: the number of hours to delay this
    request; the default is 3. You can set an hour between 0 to 8.
    Setting this value to 0 starts the deletion request immediately.

Python

VMWare Engine ライブラリによるプライベート クラウドの削除は、Google Cloud コンソールを使用する場合とは異なり、1 ステップのプロセスです。プライベート クラウドの削除メソッドを呼び出すときは十分に注意してください。

from google.api_core import operation
from google.cloud import vmwareengine_v1


def delete_private_cloud_by_full_name(cloud_name: str) -> operation.Operation:
    """
    Deletes VMware Private Cloud.

    Args:
        cloud_name: identifier of the Private Cloud you want to delete.
            Expected format:
            projects/{project_name}/locations/{zone}/privateClouds/{cloud}

    Returns:
        An Operation object related to started private cloud deletion operation.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    request = vmwareengine_v1.DeletePrivateCloudRequest()
    request.force = True
    request.delay_hours = 3
    request.name = cloud_name
    return client.delete_private_cloud(request)


def delete_private_cloud(
    project_id: str, zone: str, cloud_name: str
) -> operation.Operation:
    """
    Deletes VMWare Private Cloud.

    Args:
        project_id: name of the project hosting the private cloud.
        zone: zone in which the private cloud is located in.
        cloud_name: name of the private cloud to be deleted.

    Returns:
        An Operation object related to started private cloud deletion operation.
    """
    return delete_private_cloud_by_full_name(
        f"projects/{project_id}/locations/{zone}/privateClouds/{cloud_name}"
    )

プライベート クラウドの削除をキャンセルする

プライベート クラウドの削除は、削除(復元可能)期間内であればキャンセルできます。次の操作を行います。

コンソール

  1. Google Cloud コンソールで、[プライベート クラウド] ページに移動します。

[プライベート クラウド] に移動

  1. 削除対象としてマークしたプライベート クラウドを選択します。
  2. 概要ページで [Cancel deletion] をクリックして、プライベート クラウドの削除をキャンセルします。

gcloud

Google Cloud CLI を使用してプライベート クラウドの削除をキャンセルするには、gcloud vmware private-clouds undelete コマンドを使用します。

  gcloud vmware private-clouds undelete PRIVATE_CLOUD_ID \
     --location=ZONE

次のように置き換えます。

+   `PRIVATE_CLOUD_ID`: the private cloud ID for
    this request
+   `ZONE`: the zone for this private cloud

API

VMware Engine API を使用してプライベート クラウドの削除をキャンセルするには、POST リクエストを実行します。

curl -X POST -H "Authorization: Bearer TOKEN"  -H "Content-Type: application/json; charset=utf-8" https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/privateClouds?privateCloudId=PRIVATE_CLOUD_ID:undelete

次のように置き換えます。

+   `TOKEN`: the authorization token for this
    request.
+   `PROJECT_ID`: the project ID for this request
            +   `ZONE`: the zone for the private
                cloud
+   `PRIVATE_CLOUD_ID`: the private cloud ID for
    this request

Python

from google.api_core import operation
from google.cloud import vmwareengine_v1


def cancel_private_cloud_deletion_by_full_name(cloud_name: str) -> operation.Operation:
    """
    Cancels in progress deletion of VMware Private Cloud.

    Args:
        cloud_name: identifier of the Private Cloud you want to cancel deletion for.
            Expected format:
            projects/{project_name}/locations/{zone}/privateClouds/{cloud}

    Returns:
        An Operation object related to canceling private cloud deletion operation.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    request = vmwareengine_v1.UndeletePrivateCloudRequest()
    request.name = cloud_name
    return client.undelete_private_cloud(request)


def cancel_private_cloud_deletion(
    project_id: str, zone: str, cloud_name: str
) -> operation.Operation:
    """
    Cancels in progress deletion of VMWare Private Cloud.

    Args:
        project_id: name of the project hosting the private cloud.
        zone: zone in which the private cloud is located in.
        cloud_name: name of the private cloud to cancel deletion for.

    Returns:
        An Operation object related to canceling private cloud deletion operation.
    """
    return cancel_private_cloud_deletion_by_full_name(
        f"projects/{project_id}/locations/{zone}/privateClouds/{cloud_name}"
    )