본문 바로가기

Management

[Automation] How to unregister the specific resource from the deployment

#prerequisites

아래 문서를 통해 vRealize Automation API Server에 Login을 했다는 가정하에 진행합니다.

How to login vRealize Automation API Server (tistory.com)

 

How to login vRealize Automation API Server

# Prerequisites 먼저, vRealize Automation에 연결 가능한 PC 또는 서버에 Postman을 설치해야 합니다. https://www.postman.com/downloads/ Download Postman | Get Started for Free Try Postman for free! Joi..

haewon83.tistory.com

 

#Environment

vRealize Automation에 Onboarding을 통해 배포된 하나의 Deployment에 2개의 virtual machine이 위치한 상황

아래 화면을 보면 test3과 test4 virtual machine이 "Deployment-95c92006-8118-40c7-a667-920ec6033eee"에 속해 있음

 

1. resourceLink 값 확인

Unregister 하고자 하는 Resource의 resourceLink 값을 확인해야 합니다. 아래 화면은 test4 virtual machine을 선택했을 때 확인되는 resourceLink 값입니다.

 

2. resourceLink 값 검증

Postman에서 GET Method로 resourceLink 값 조회 시 test4 virtual machine에 대한 값이 맞는지 확인합니다.

GET https://vra01.contoso.com/deployment/api/resources/f02fbcf6-f3df-3ed6-ab94-d33ac5ec53d7
{
    "id": "f02fbcf6-f3df-3ed6-ab94-d33ac5ec53d7",
    "name": "test4",
    "type": "Cloud.vSphere.Machine",
    "properties": {
        "resourceId": "f02fbcf6-f3df-3ed6-ab94-d33ac5ec53d7",
        "moref": "VirtualMachine:vm-51",
        "storage": {
            "disks": [
                {
                    "vm": "VirtualMachine:vm-51",
                    "name": "Hard disk 1",
                    "type": "HDD",
                    "shares": "1000",
                    "vcUuid": "cc10c77b-ccb3-4705-95c3-46b7cf41f928",
                    "bootOrder": 1,
                    "encrypted": false,
                    "limitIops": "-1",
                    "capacityGb": 90,
                    "persistent": false,
                    "independent": "false",
                    "sharesLevel": "normal",
                    "endpointType": "vsphere",
                    "resourceLink": "/resources/disks/7bbb1fb6-fbb0-3841-9b8c-3e3bd4c1b4b4",
                    "controllerKey": "1000",
                    "existingResource": "false",
                    "provisioningType": "thin",
                    "controllerUnitNumber": "0"
                },
                {
                    "vm": "VirtualMachine:vm-51",
                    "name": "CD/DVD drive 1",
                    "type": "CDROM",
                    "vcUuid": "cc10c77b-ccb3-4705-95c3-46b7cf41f928",
                    "encrypted": false,
                    "capacityGb": 0,
                    "persistent": false,
                    "endpointType": "vsphere",
                    "resourceLink": "/resources/disks/1d7a7652-414a-3107-b3fc-29b1213997fe",
                    "controllerKey": "15000",
                    "existingResource": "false",
                    "controllerUnitNumber": "0"
                }
            ]
        },
        "networks": [
            {
                "id": "/resources/network-interfaces/0e0dc9c1-ae4f-36af-98f8-4c895276c0a6",
                "name": "Network adapter 1",
                "network": "/provisioning/resources/compute-networks/cf9e75f9-0be4-4cfb-9b5f-402cc7d6276f",
                "assignment": "dynamic",
                "deviceIndex": 0,
                "mac_address": "00:50:56:84:a7:a3",
                "resourceName": "Network adapter 1"
            }
        ],
        "powerState": "OFF",
        "zone": "192.168.1.11",
        "environmentName": "On premise",
        "providerId": "50041ef6-18c8-c08a-9cf9-1c047411d8b6",
        "hasSnapshots": "false",
        "osType": "WINDOWS",
        "instanceUUID": "50041ef6-18c8-c08a-9cf9-1c047411d8b6",
        "computeHostType": "HostSystem",
        "id": "/resources/compute/f02fbcf6-f3df-3ed6-ab94-d33ac5ec53d7",
        "memoryGB": "4",
        "cpuCount": 2,
        "totalMemoryMB": 4096,
        "componentType": "Cloud.vSphere.Machine",
        "endpointType": "vsphere",
        "endpointId": "9a28b632-520c-4dd9-944b-053e92b9a510",
        "externalId": "50041ef6-18c8-c08a-9cf9-1c047411d8b6",
        "resourceName": "test4",
        "datacenter": "Datacenter:datacenter-3",
        "coreCount": "2",
        "tags": [],
        "primaryMAC": "00:50:56:84:a7:a3",
        "computeHostRef": "HostSystem:host-12",
        "softwareName": "Microsoft Windows Server 2019 (64-bit)",
        "name": "test4",
        "accounts": [
            "vCenter"
        ],
        "region": "Datacenter",
        "vmFolderPath": "[AppDatastore] test4",
        "account": "vCenter",
        "vcUuid": "cc10c77b-ccb3-4705-95c3-46b7cf41f928"
    },
    "createdAt": "2022-09-30T09:46:48.042991Z",
    "syncStatus": "SUCCESS",
    "origin": "ONBOARDED",
    "deploymentId": "6b5a5817-88f7-41f8-be5f-8298594c27da",
    "projectId": "6035a21b-eef5-4f60-9537-c8d39f0fe1fc",
    "orgId": "058a459c-2b9f-415a-8b0c-afb9a4a22d0b"
}

 

3. resourceLink 값을 이용하여 resource unregister

Postman에서 POST Method로 resourceLink 값을 이용하여 특정 resource를 deployment에서 unregister 합니다.

Body에 다음 내용을 입력하여 POST Method를 실행합니다.

URL
POST https://vra01.contoso.com/relocation/api/wo/unregister-machine
 
BODY
{
"resourceLink": "/resources/compute/f02fbcf6-f3df-3ed6-ab94-d33ac5ec53d7"
}

 

4. Onboard 진행

Onboarding을 다시 진행하면, deployment에서 unregister된 virtual machine을 확인할 수 있습니다.

 

기존 deployment와 다른 deployment로 배포하기 위해서 "Create plan deployment"를 선택하여 배포를 진행하면, 다음과 같이 test3과 test4 virtual machine이 서로 다른 deployment에 속해있는 것을 확인할 수 있습니다.