刪除私有雲
私有雲由一或多個 vSphere 叢集組成。刪除私有雲會一併刪除整個私有雲。私有雲的所有元件都會刪除,包括所有私有雲節點。
私有雲的元件包括:
- 節點
- 虛擬機器
- 管理 VLAN 和子網路
- 工作負載子網路
- 儲存在私有雲的所有使用者資料
- 所有外部存取規則
刪除私有雲的程序分為兩個階段:虛刪除和永久刪除。每個階段的流程如下:
- 虛刪除:私有雲會進入七天的虛刪除狀態。
在這個階段,會發生下列情況:
- 系統會立即停止計費。
- 與 NSX 區隔和工作負載的所有連線都會中斷。
- 私有雲的使用者介面和 API 存取權會遭到停用。
- 外部 IP 位址已停用。
- 私有雲的設定和資料會保留,VM 也會繼續執行。
- 您可以將私有雲還原至先前的狀態。
- 永久刪除:七天後,系統會永久刪除私有雲及其資源。如要永久刪除處於軟刪除狀態的私有雲,請與支援團隊聯絡。
事前準備
如要保留任何資料,請將資料備份至其他私有雲、Google Cloud 儲存空間、地端儲存空間或其他儲存空間。
gcloud 和 API 需求
如要使用 gcloud
指令列工具或 API 管理 VMware Engine 資源,建議按照下列說明設定工具。
gcloud
設定預設專案 ID:
gcloud config set project PROJECT_ID
設定預設地區和區域:
gcloud config set compute/region REGION
gcloud config set compute/zone ZONE
如要進一步瞭解 gcloud vmware
工具,請參閱 Cloud SDK 參考文件。
API
本文件集中的 API 範例會使用 cURL
指令列工具查詢 API。您必須在cURL
要求中提供有效的存取權杖。取得有效存取權杖的方法有很多,以下步驟使用 gcloud
工具產生存取權杖:
登入 Google Cloud:
gcloud auth login
產生存取權杖並匯出至 TOKEN:
export TOKEN=`gcloud auth print-access-token`
確認 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 通訊。如要使用這種方法,必須先安裝程式庫,並設定應用程式預設憑證。
下載並安裝 Python 程式庫:
pip install google-cloud-vmwareengine
在殼層中執行這些指令,設定 ADC 資訊:
gcloud auth application-default login
或者,使用服務帳戶金鑰檔案:
export GOOGLE_APPLICATION_CREDENTIALS="FILE_PATH"
如要進一步瞭解程式庫,請造訪參考頁面或查看 GitHub 上的程式碼範例。
刪除私有雲
如要立即使用工作負載網路 IP CIDR,請先關閉私有雲中的所有 VM,再開始刪除私有雲。
主控台
前往 Google Cloud 控制台的「Private clouds」頁面。
按一下「選取專案」,然後選取要刪除私有雲的機構、資料夾或專案。
選取要刪除的私有雲。
在摘要頁面中,按一下「Delete this Private Cloud」(刪除這個私有雲)。
在確認頁面中,系統會提示您驗證刪除動作的所有結果。請仔細閱讀這些資訊,並在確認接受結果後,再繼續刪除。準備好接受結果時,請選取所有核取方塊。
輸入刪除作業的等候時數 (1 到 8 小時)。在該期間內,您可以點選「取消」來取消刪除。
為確認您知道要刪除哪個私有雲,請輸入要刪除的私有雲名稱。
按一下「刪除」,將私有雲標示為待刪除。
刪除程序會在指定延遲時間 (以小時為單位) 過後開始執行,直到完成為止。
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
與使用 Google Cloud 控制台相比,使用 VMWare Engine 程式庫刪除私有雲的程序只有一個步驟。呼叫私有雲刪除方法時,請務必小心謹慎。
取消刪除私有雲
您可以在軟刪除期間取消刪除私有雲。 請按照下列步驟操作。
主控台
- 前往 Google Cloud 控制台的「Private clouds」頁面。
- 選取已標示為要刪除的私有雲。
- 在摘要頁面中,按一下「取消刪除」,即可取消刪除私有雲。
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