Virtual machine ref_code API

Virtual machine ref_code is the metadata attribute to get the details of the virtual machine from hypervisor. This feature is supported for the IBM® i and AIX® operating systems.

Note: ref_code update for IBM i operating system is only supported for virtual machines on a NovaLink host.

Rest API for ref_code metadata

Table 1. Options for ref_code metadata API
Method URI Description

POST

v2.1/<tenant id>/servers/<server id>/metadata

Updates the virtual machine ref_code attribute.

GET

v2.1/<tenant id>/servers/<server id>/metadata

Fetches updated metadata attribute of the virtual machine.

Update metadata

This operation updates the metadata attribute of the virtual machine.

Request URI

POST https://<powervc ip>/powervc/openstack/compute/v2.1/<tenant id>/servers/<server id>/metadata
Response codes
  • Normal response code: OK (200)
  • Error response code: Bad Request (400®), Forbidden (403), Not Found(404), Server Error (500)
Request parameters
Table 2. Parameters in the request for updating ref_code metadata
Name Style Type Description

powervc:vm_refcode_required

body

Boolean

Update the ref_code parameter with true or false.

Request body
{
"metadata": {
    "powervc:vm_refcode_required": "true"
}
}
Table 3. Parameters in the response for updating ref_code metadata
Name Style Type Description

powervc:vm_refcode_required

body

Boolean

Updates the ref_code parameter with true or false.

orginal_host

body

string

Returns hostname of the virtual machine deployed.

Response body
{
    "metadata": {
        "powervc:vm_refcode_required": "true",
        "original_host": "9109RMD_1031CAT",
    }
}

Get ref_code metadata for a virtual machine

This operation fetches updated metadata attribute of the virtual machine.

Request URI

GET: https://<powervc ip>/powervc/openstack/compute/v2.1/<tenant id>/servers/<server id>/metadata
Response codes
  • Normal response code: OK (200)
  • Error response code: Bad Request (400), Forbidden (403), Not Found(404), Server Error (500)
Response body
Table 4. Parameters in response to fetch ref_code metadata
Name Style Type Description

powervc:vm_refcode

body

Hexadecimal

Updates Hexadecimal value.

powervc:vm_led_code

body

string

Shows state of the virtual machine.

powervc:vm_refcode_query_ts

body

string

Timestamp for the ref_code
powervc:vm_refcode_required

body

Boolean

Updated ref_code parameter with true or false.

{
    "metadata": {
        "powervc:vm_refcode": "000e",
        "powervc:vm_led_code": "Surr_rebooting__________________",
        "powervc:vm_refcode_query_ts": "20201014052153955450",
        "powervc:vm_refcode_required": "true",
    }
}