Help Center/ Bare Metal Server/ API Reference/ Examples/ Example 2: Querying Details About BMSs
Updated on 2024-05-17 GMT+08:00

Example 2: Querying Details About BMSs

Scenarios

You can specify criteria to query details about desired BMSs.

Involved APIs

The following API is involved:

Querying Details About BMSs

Query Details About BMSs By Specifying a Flavor

  • API

    URI format: GET /v1/{project_id}/baremetalservers/detail

    For details, see Querying Details About BMSs.

  • Example request

    GET https://{BMS Endpoint}/v1/5233f5df59f9491ba7c14d8b5d535f6b/baremetalservers/detail?flavor=physical.comtest04.large

  • Example response
    {
        "count": 1,
        "servers": [
            {
                "fault": null,
                "id": "cb52b43d-8ba7-4b4d-84c4-7ef332715073",
                "name": "kd1ne4xl-c00420527-nodel-nonstop",
                "addresses": {
                    "fdbf76aa-697a-4f49-8835-36c0e6903e28": [
                        {
                            "version": "4",
                            "addr": "172.16.0.178",
                            "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:8a:3a:50",
                            "OS-EXT-IPS:type": "fixed",
                            "OS-EXT-IPS:port_id": "0c111191-9785-49e6-8b42-66ef2802bd8f"
                        },
                        {
                            "version": "4",
                            "addr": "124.71.38.23",
                            "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:8a:3a:50",
                            "OS-EXT-IPS:type": "floating",
                            "OS-EXT-IPS:port_id": "0c111191-9785-49e6-8b42-66ef2802bd8f"
                        }
                    ]
                },
                "flavor": {
                    "disk": "192010",
                    "vcpus": "128",
                    "ram": "524288",
                    "id": "physical.comtest04.large",
                    "name": "physical.comtest04.large"
                },
                "accessIPv4": "",
                "accessIPv6": "",
                "status": "SHUTOFF",
                "progress": null,
                "hostId": "f57b3421b5cdc214fabf127984ef779b7433acc1d6379214ed834219",
                "updated": "2020-11-07T09:28:40Z",
                "created": "2020-09-21T09:07:28Z",
                "metadata": {
                    "metering.order_id": "CS20110717284WW42",
                    "metering.image_id": "c13c91f7-038a-443e-ad76-608e255b4d85",
                    "metering.imagetype": "shared",
                    "metering.resourcespeccode": "physical.comtest04.large.linux",
                    "image_name": "euler2u8-cbg-sdi3-20200330v3",
                    "op_svc_userid": "48b5cec3f26e4bedab54cb996b124079",
                    "__bms_support_evs": "false",
                    "EcmResStatus": "",
                    "metering.product_id": "00301-103881-0--0",
                    "metering.resourcetype": "__type_baremetal",
                    "vpc_id": "fdbf76aa-697a-4f49-8835-36c0e6903e28",
                    "os_type": "Linux",
                    "os_bit": "64",
                    "chargingMode": "1"
                },
                "tags": [
                    "__type_baremetal"
                ],
                "description": "kd1ne4xl-c00420527-nodel-nonstop",
                "locked": false,
                "config_drive": "",
                "tenant_id": "5233f5df59f9491ba7c14d8b5d535f6b",
                "user_id": "fc3a5ac3fe244ca6bb079c8069f9143f",
                "key_name": null,
                "os-extended-volumes:volumes_attached": [
                    {
                        "device": "/dev/sda",
                        "bootIndex": "0",
                        "id": "405ae92b-2d59-4d61-8eb0-79946e391c33",
                        "delete_on_termination": "false"
                    }
                ],
                "OS-EXT-STS:task_state": null,
                "OS-EXT-STS:power_state": 4,
                "OS-EXT-STS:vm_state": "stopped",
                "OS-EXT-SRV-ATTR:host": "f57b3421b5cdc214fabf127984ef779b7433acc1d6379214ed834219",
                "OS-EXT-SRV-ATTR:instance_name": "instance-00567827",
                "OS-EXT-SRV-ATTR:hypervisor_hostname": "bea2f2c61b2def48c3ad001446ffada47bbd2b1cbf75d4950c9609a0",
                "OS-DCF:diskConfig": "MANUAL",
                "OS-EXT-AZ:availability_zone": "cn-south-1e",
                "os:scheduler_hints": {
                    "dec_baremetal": [
                        "share"
                    ]
                },
                "OS-EXT-SRV-ATTR:root_device_name": "/dev/vda",
                "OS-EXT-SRV-ATTR:ramdisk_id": "",
                "enterprise_project_id": "0",
                "OS-EXT-SRV-ATTR:user_data": "$USER_DATA",
                "OS-SRV-USG:launched_at": "2020-09-21T09:14:01.000000",
                "OS-EXT-SRV-ATTR:kernel_id": "",
                "OS-EXT-SRV-ATTR:launch_index": 0,
                "host_status": "UP",
                "OS-EXT-SRV-ATTR:reservation_id": "r-18mfg3us",
                "OS-EXT-SRV-ATTR:hostname": "kd1ne4xl-c00420527-nodel-nonstop",
                "OS-SRV-USG:terminated_at": null,
                "sys_tags": [
                    {
                        "key": "_sys_enterprise_project_id",
                        "value": "0"
                    }
                ],
                "security_groups": [
                    {
                        "id": "2beb2b46-2a55-4b83-b362-20698eeda10b",
                        "name": "d310-l00415626-cce-control-8xsdf"
                    }
                ],
                "image": {
                    "id": "c13c91f7-038a-443e-ad76-608e255b4d85"
                },
                "hypervisor": null
            }
        ]
    }

Query Details About BMSs By Specifying an Enterprise Project ID

  • API

    URI format: GET /v1/{project_id}/baremetalservers/detail

    For details, see Querying Details About BMSs.

  • Example request

    GET https://{BMS Endpoint}/v1/5233f5df59f9491ba7c14d8b5d535f6b/baremetalservers/detail?enterprise_project_id=98135c62-f0c1-4003-9c9f-7f5523d7f3a2

  • Example response
    {
        "count": 1,
        "servers": [
            {
                "fault": null,
                "id": "cb52b43d-8ba7-4b4d-84c4-7ef332715073",
                "name": "kd1ne4xl-c00420527-nodel-nonstop",
                "addresses": {
                    "fdbf76aa-697a-4f49-8835-36c0e6903e28": [
                        {
                            "version": "4",
                            "addr": "172.16.0.178",
                            "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:8a:3a:50",
                            "OS-EXT-IPS:type": "fixed",
                            "OS-EXT-IPS:port_id": "0c111191-9785-49e6-8b42-66ef2802bd8f"
                        },
                        {
                            "version": "4",
                            "addr": "124.71.38.23",
                            "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:8a:3a:50",
                            "OS-EXT-IPS:type": "floating",
                            "OS-EXT-IPS:port_id": "0c111191-9785-49e6-8b42-66ef2802bd8f"
                        }
                    ]
                },
                "flavor": {
                    "disk": "192010",
                    "vcpus": "128",
                    "ram": "524288",
                    "id": "physical.comtest04.large",
                    "name": "physical.comtest04.large"
                },
                "accessIPv4": "",
                "accessIPv6": "",
                "status": "SHUTOFF",
                "progress": null,
                "hostId": "f57b3421b5cdc214fabf127984ef779b7433acc1d6379214ed834219",
                "updated": "2020-11-07T09:28:40Z",
                "created": "2020-09-21T09:07:28Z",
                "metadata": {
                    "metering.order_id": "CS20110717284WW42",
                    "metering.image_id": "c13c91f7-038a-443e-ad76-608e255b4d85",
                    "metering.imagetype": "shared",
                    "metering.resourcespeccode": "physical.comtest04.large.linux",
                    "image_name": "euler2u8-cbg-sdi3-20200330v3",
                    "op_svc_userid": "48b5cec3f26e4bedab54cb996b124079",
                    "__bms_support_evs": "false",
                    "EcmResStatus": "",
                    "metering.product_id": "00301-103881-0--0",
                    "metering.resourcetype": "__type_baremetal",
                    "vpc_id": "fdbf76aa-697a-4f49-8835-36c0e6903e28",
                    "os_type": "Linux",
                    "os_bit": "64",
                    "chargingMode": "1"
                },
                "tags": [
                    "__type_baremetal"
                ],
                "description": "kd1ne4xl-c00420527-nodel-nonstop",
                "locked": false,
                "config_drive": "",
                "tenant_id": "5233f5df59f9491ba7c14d8b5d535f6b",
                "user_id": "fc3a5ac3fe244ca6bb079c8069f9143f",
                "key_name": null,
                "os-extended-volumes:volumes_attached": [
                    {
                        "device": "/dev/sda",
                        "bootIndex": "0",
                        "id": "405ae92b-2d59-4d61-8eb0-79946e391c33",
                        "delete_on_termination": "false"
                    }
                ],
                "OS-EXT-STS:task_state": null,
                "OS-EXT-STS:power_state": 4,
                "OS-EXT-STS:vm_state": "stopped",
                "OS-EXT-SRV-ATTR:host": "f57b3421b5cdc214fabf127984ef779b7433acc1d6379214ed834219",
                "OS-EXT-SRV-ATTR:instance_name": "instance-00567827",
                "OS-EXT-SRV-ATTR:hypervisor_hostname": "bea2f2c61b2def48c3ad001446ffada47bbd2b1cbf75d4950c9609a0",
                "OS-DCF:diskConfig": "MANUAL",
                "OS-EXT-AZ:availability_zone": "cn-south-1e",
                "os:scheduler_hints": {
                    "dec_baremetal": [
                        "share"
                    ]
                },
                "OS-EXT-SRV-ATTR:root_device_name": "/dev/vda",
                "OS-EXT-SRV-ATTR:ramdisk_id": "",
                "enterprise_project_id": "98135c62-f0c1-4003-9c9f-7f5523d7f3a2",
                "OS-EXT-SRV-ATTR:user_data": "$USER_DATA",
                "OS-SRV-USG:launched_at": "2020-09-21T09:14:01.000000",
                "OS-EXT-SRV-ATTR:kernel_id": "",
                "OS-EXT-SRV-ATTR:launch_index": 0,
                "host_status": "UP",
                "OS-EXT-SRV-ATTR:reservation_id": "r-18mfg3us",
                "OS-EXT-SRV-ATTR:hostname": "kd1ne4xl-c00420527-nodel-nonstop",
                "OS-SRV-USG:terminated_at": null,
                "sys_tags": [
                    {
                        "key": "_sys_enterprise_project_id",
                        "value": "0"
                    }
                ],
                "security_groups": [
                    {
                        "id": "2beb2b46-2a55-4b83-b362-20698eeda10b",
                        "name": "d310-l00415626-cce-control-8xsdf"
                    }
                ],
                "image": {
                    "id": "c13c91f7-038a-443e-ad76-608e255b4d85"
                },
                "hypervisor": null
            }
        ]
    }