Querying Details About BMSs (Native OpenStack API)

Function

This API is used to query details about BMSs.

Constraints

  • The query result returned by this interface includes both ECS and BMS details. You need to filter out the BMS details using the flavor used to create the BMSs or the tags added to the BMSs during BMS creation.

  • If the image is used as the search criteria, other search criteria and pagination criteria are not supported. If both the image and other search criteria are used, the BMS details are filtered out by image. If the image is not used as the search criteria, this interface has no restrictions.

URI

GET /v2.1/{project_id}/servers/detail{?changes-since={changes-since}&image={image}&flavor={flavor}&name={name}&status={status}&limit={limit}&marker={marker}&tags={tags}&not-tags={not-tags}&reservation_id={reservation_id}&sort_key={sort_key}&sort_dir={sort_dir}}

Table 1 lists the parameters.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For how to obtain the project ID, see Obtaining Required Information.

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    changes-since

    No

    String

    Specifies the timestamp of the last BMS status update. The parameter is in ISO 8601 time format, for example, 2013-06-09T06:42:18Z.

    image

    No

    String

    Specifies the image ID.

    Note

    If the image is used as the search criteria, other search criteria and pagination criteria are not supported. If both the image and other search criteria are used, the BMS details are filtered out by image. If the image is not used as the search criteria, this interface has no restrictions.

    flavor

    No

    String

    Specifies the flavor ID.

    You can obtain the flavor ID from the BMS console or using the Querying BMS Flavors (Native OpenStack API) API.

    name

    No

    String

    Specifies the BMS name. This parameter supports fuzzy matching.

    For example, the regular expression ?name=bob will return both bob and bobb. To obtain only bob, you can use a regular expression matching the basic database syntax, such as MySQL or PostgreSQL (official website: https://www.postgresql.org/docs/9.2/static/functions-matching.html).

    status

    No

    String

    Specifies the BMS status.

    Value range:

    • ACTIVE: Running, Stopping, Deleting

    • BUILD: Creating

    • ERROR: Faulty

    • HARD_REBOOT: Forcibly Restarting

    • REBOOT: Restarting

    limit

    No

    Integer

    Specifies the number of BMSs displayed on each page.

    marker

    No

    String

    Specifies the BMS ID to which the marker corresponds. The query will start from the next ID.

    tags

    No

    String

    Queries the BMSs with specified tags.

    Added in micro version 2.26.

    not-tags

    No

    String

    Queries the BMSs with tags not containing the specified value. The value is a list of tag keys.

    Note

    If the tags added before the function upgrade are in the format of "Key.Value", query tags using "Key".

    For example, an existing tag is a.b. After the tag function upgrade, query the tag using "not-tags=a".

    Added in micro version 2.26.

    reservation_id

    No

    String

    Specifies the reserved ID, which can be used to query BMSs created in a batch.

    Added in micro version 2.26.

    sort_key

    No

    String

    Specifies the BMS sorting attribute, which can be the BMS UUID (uuid), BMS status (vm_state), BMS name (display_name), BMS task status (task_state), power status (power_state), creation time (created_at), last time when the BMS is updated (updated_at), and AZ (availability_zone). You can specify multiple sort_key and sort_dir pairs.

    The default sorting is the reverse order by created_at.

    sort_dir

    No

    String

    Specifies the sorting direction.

    • asc: The query results are displayed in ascending order.

    • desc (default value): The query results are displayed in descending order.

  • Example request

    • With no optional parameter

      https://{ECS Endpoint}/v2.1/bbf1946d374b44a0a2a95533562ba954/servers/detail
      
    • With an optional parameter

      https://{ECS Endpoint}/v2.1/bbf1946d374b44a0a2a95533562ba954/servers/detail?tags=__type_baremetal
      
    • With multiple optional parameters

      https://{ECS Endpoint}/v2.1/bbf1946d374b44a0a2a95533562ba954/servers/detail?tags=__type_baremetal&name=bms-test01
      

Response

  • Response parameters

    Parameter

    Type

    Description

    servers

    Array of objects

    Specifies details about the BMS. For details, see Table 2.

    Table 2 server field data structure description

    Parameter

    Type

    Description

    name

    String

    Specifies the BMS name.

    id

    String

    Specifies the unique ID of the BMS.

    status

    String

    Specifies the BMS status.

    Value range:

    • ACTIVE: The BMS is running, stopped, or being deleted.

    • BUILD: The BMS is being created.

    • ERROR: The BMS is faulty.

    • HARD_REBOOT: The BMS is being forcibly restarted.

    • REBOOT: The BMS is being restarted.

    • SHUTOFF: The BMS is stopped, being started, being deleted, or being rebuilt.

    created

    String

    Specifies when the BMS was created.

    The timestamp format is YYYY-MM-DDTHH:MM:SSZ (ISO 8601), for example, 2019-05-22T03:30:52Z.

    updated

    String

    Specifies the last time when the BMS was updated.

    The timestamp format is YYYY-MM-DDTHH:MM:SSZ (ISO 8601), for example, 2019-05-22T04:30:52Z.

    flavor

    Object

    Specifies the BMS flavor. For details, see Table 5.

    image

    Object

    Specifies the BMS image. For details, see Table 6.

    tenant_id

    String

    Specifies the ID of the tenant owning the BMS. The value is in UUID format.

    This parameter equals to project_id.

    key_name

    String

    Specifies the SSH key name.

    user_id

    String

    Specifies the user ID of the BMS.

    metadata

    Map<String,String>

    Specifies the BMS metadata.

    It is a user-defined metadata key-value pair. Each key or value contains a maximum of 255 characters.

    hostId

    String

    Specifies the host ID of the BMS.

    addresses

    Map<String,Array of address objects>

    Specifies the network address of the BMS. Specifies the VPC used by the BMS.

    • key: indicates the ID of the VPC used by the BMS.

    • value indicates the VPC details.

    security_groups

    Array of objects

    Specifies the security groups of the BMS. For details, see Table 9.

    links

    Array of objects

    Specifies shortcut links of the BMS. For details, see Table 7.

    OS-DCF:diskConfig

    String

    Specifies the disk configuration method. This is an extended attribute. The value can be:

    • MANUAL: The BMS is created using the partitioning scheme and file system in the image. If the target flavor has a large disk, the API does not partition the remaining disk space.

    • AUTO: The BMS is created using a single partition with the same size as the disk of the target flavor. The API automatically adjusts the file system to adapt to the entire partition.

    OS-EXT-AZ:availability_zone

    String

    Specifies the name of the AZ where the BMS is deployed. This is an extended attribute.

    OS-EXT-SRV-ATTR:host

    String

    Specifies the hostname of the BMS. This is an extended attribute.

    OS-EXT-SRV-ATTR:hypervisor_hostname

    String

    Specifies the hostname of the hypervisor. This is an extended attribute provided by the Nova virt driver.

    OS-EXT-SRV-ATTR:instance_name

    String

    Specifies the BMS alias. This is an extended attribute.

    OS-EXT-STS:power_state

    Integer

    Specifies the BMS power status. This is an extended attribute.

    Value range:

    • 0: pending

    • 1: running

    • 2: paused

    • 3: shutdown

    • 4: crashed

    OS-EXT-STS:task_state

    String

    Specifies the BMS task status. This is an extended attribute.

    Value range:

    • rebooting: The BMS is being restarted.

    • reboot_started: The BMS is normally restarted.

    • reboot_started_hard: The BMS is forcibly restarted.

    • powering-off: The BMS is being powered off.

    • powering-on: The BMS is being powered on.

    • rebuilding: The BMS is being rebuilt.

    • scheduling: The BMS is being scheduled.

    • deleting: The BMS is being deleted.

    OS-EXT-STS:vm_state

    String

    Specifies the BMS status. This is an extended attribute.

    Value range:

    • active: The BMS is running.

    • shutoff: The BMS is stopped.

    • reboot: The BMS is restarted.

    OS-SRV-USG:launched_at

    String

    Specifies the time when the BMS was started. This is an extended attribute.

    The timestamp format complies with ISO 8601, for example, 2019-05-22T03:23:59.000000.

    OS-SRV-USG:terminated_at

    String

    Specifies the time when the BMS was deleted. This is an extended attribute.

    The timestamp format complies with ISO 8601, for example, 2019-05-22T04:23:59.000000.

    os-extended-volumes:volumes_attached

    Array of objects

    Specifies the attached EVS disks of the BMS. For details, see Table 10.

    accessIPv4

    String

    This is a reserved attribute.

    accessIPv6

    String

    This is a reserved attribute.

    fault

    Object

    Specifies the fault cause. If the BMS is faulty, this field will be returned. For details, see Table 11.

    config_drive

    String

    This is a reserved attribute.

    progress

    Integer

    This is a reserved attribute.

    description

    String

    Specifies description about the BMS.

    This is a new parameter in micro version 2.19.

    host_status

    String

    Specifies the status of theBMS host.

    • UP: The host is normal.

    • UNKNOWN: The host status is unknown.

    • DOWN: the host is abnormal.

    • MAINTENANCE: The host is being maintained.

    • Empty string: There is no BMS host information.

    This is a new parameter in micro version 2.16.

    OS-EXT-SRV-ATTR:hostname

    String

    Specifies the hostname of the BMS.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:reservation_id

    String

    Specifies the reserved BMS IDs when BMSs are created in a batch.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:launch_index

    Integer

    Specifies the startup sequence of the BMSs created in a batch.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:kernel_id

    String

    Specifies the UUID of the kernel image when an AMI image is used. In other cases, leave this parameter blank.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:ramdisk_id

    String

    Specifies the UUID of a RAM disk image when the AMI image is used. In other cases, leave this parameter blank.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:root_device_name

    String

    Specifies the device name of the BMS system disk, for example, /dev/sda.

    This is a new parameter in micro version 2.3.

    OS-EXT-SRV-ATTR:user_data

    String

    Specifies the user_data specified during BMS creation. The value is encoded using Base64 or an empty string.

    locked

    Boolean

    Specifies whether the BMS is locked.

    • true: The BMS is locked.

    • false: The BMS is not locked.

    This is a new parameter in micro version 2.9.

    tags

    Array of strings

    Specifies tags of the BMS.

    This is a new parameter in micro version 2.26. If you are not using this micro version, the response will not contain the tags parameter.

    A tag must meet the following requirements:

    • The key and value of a tag are connected using an equal sign (=), for example, key=value.

    • If the value is empty, only the key is returned.

    sys_tags

    Array of objects

    Specifies system tags of the BMS. For details, see Table 3.

    enterprise_project_id

    String

    Specifies the enterprise project ID.

    os:scheduler_hints

    Object

    Specifies scheduling information of the BMS. For details, see Table 4.

    Table 3 sys_tags field data structure description

    Parameter

    Type

    Description

    key

    String

    Specifies the system tag key.

    value

    String

    Specifies the system tag value.

    Table 4 os:scheduler_hints field data structure description

    Parameter

    Type

    Description

    group

    Array of strings

    Specifies the BMS group ID in UUID format.

    Table 5 flavor field data structure description

    Parameter

    Type

    Description

    id

    String

    Specifies the BMS type ID.

    This field is not supported in microversions later than 2.47.

    links

    Array of objects

    Specifies shortcut links of the BMS type.

    For details, see Table 7.

    This field is not supported in microversions later than 2.47.

    vcpus

    Integer

    Specifies the number of CPU cores in the BMS flavor.

    This field is supported in microversions later than 2.47.

    ram

    Integer

    Specifies the memory size (MB) in the BMS flavor.

    This field is supported in microversions later than 2.47.

    disk

    Integer

    Specifies the system disk size in the BMS flavor. The value 0 indicates that the disk size is not limited.

    This field is supported in microversions later than 2.47.

    ephemeral

    Integer

    This is a reserved attribute.

    This field is supported in microversions later than 2.47.

    swap

    Integer

    This is a reserved attribute.

    This field is supported in microversions later than 2.47.

    original_name

    String

    This is a reserved attribute.

    This field is supported in microversions later than 2.47.

    extra_specs

    Object

    Extended flavor field.

    This field is supported in microversions later than 2.47.

    Table 6 image field data structure description

    Parameter

    Type

    Description

    id

    String

    Specifies the image ID of the BMS.

    links

    Array of objects

    Specifies shortcut links of the BMS image. For details, see Table 7.

    Table 7 links field data structure description

    Parameter

    Type

    Description

    rel

    String

    Specifies the shortcut link marker name. The value can be:

    • self: resource link that contains the version number. It is used when immediate tracing is required.

    • bookmark: resource link that can be stored for a long time.

    href

    String

    Specifies the corresponding shortcut link.

    Table 8 address field data structure description

    Parameter

    Type

    Description

    addr

    String

    Specifies the IP address.

    version

    Integer

    Specifies the type of the IP address. The value can be 4 or 6.

    • 4: The type of the IP address is IPv4.

    • 6: The type of the IP address is IPv6.

    OS-EXT-IPS-MAC:mac_addr

    String

    Specifies the MAC address. This is an extended attribute.

    OS-EXT-IPS:type

    String

    Specifies the IP address type. This is an extended attribute.

    • fixed: indicates the private IP address.

    • floating: indicates the EIP.

    Table 9 security_groups field data structure description

    Parameter

    Type

    Description

    name

    String

    • If no security group is specified during BMS creation, the default value is used.

    • If a security group is specified when you create the BMS, the value of this parameter is the security group name.

    Table 10 os-extended-volumes:volumes_attached field data structure description

    Parameter

    Type

    Description

    id

    String

    Specifies the EVS disk ID.

    delete_on_termination

    Boolean

    Specifies whether to delete the disk when deleting the BMS.

    • true: Yes

    • false: No

    Added in micro version 2.3.

    Table 11 fault field data structure description

    Parameter

    Type

    Description

    message

    String

    Specifies the fault information.

    code

    Integer

    Specifies the fault code.

    details

    String

    Specifies the fault details.

    created

    String

    Specifies the time when the fault occurred. The time is in ISO 8601 format.

  • Example response

    {
        "servers": [
    {
                "tenant_id": "c685484a8cc2416b97260938705deb64",
                "addresses": {
                    "08a7715f-7de6-4ff9-a343-95ba4209f24a": [
    {
                            "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:0e:c4:77",
                            "OS-EXT-IPS:type": "fixed",
                            "addr": "192.168.0.107",
                            "version": 4
                        }
                    ]
                },
                "metadata": {
                    "op_svc_userid": "1311c433dd9b408886f57d695c229cbe"
                },
                "OS-EXT-STS:task_state": null,
                "OS-DCF:diskConfig": "MANUAL",
                "OS-EXT-AZ:availability_zone": "az-dc-1",
                "links": [
    {
                        "rel": "self",
                        "href": "https://openstack.example.com/v2.1/c685484a8cc2416b97260938705deb65/servers/95bf2490-5428-432c-ad9b-5e3406f869dd"
                    },
    {
                        "rel": "bookmark",
                        "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/servers/95bf2490-5428-432c-ad9b-5e3406f869dd"
                        }
                ],
                "OS-EXT-STS:power_state": 1,
                "id": "95bf2490-5428-432c-ad9b-5e3406f869dd",
                "os-extended-volumes:volumes_attached": [
    {
                        "id": "dfa375b5-9856-44ad-a937-a4802b6434c3"
                    },
    {
                        "id": "bb9f1b27-843b-4561-b62e-ca18eeaec417"
                    },
    {
                        "id": "86e801c3-acc6-465d-890c-d43ba493f553"
                    },
    {
                        "id": "0994d3ac-3c6a-495c-a439-c597a4f08fa6"
                        }
                ],
                "OS-EXT-SRV-ATTR:host": "bms.az1",
                "image": {
                    "links": [
    {
                            "rel": "bookmark",
                            "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/images/1a6635d8-afea-4f2b-abb6-27a202bad319"
                        }
                    ],
                    "id": "1a6635d8-afea-4f2b-abb6-27a202bad319"
                },
                "OS-SRV-USG:terminated_at": null,
                "accessIPv4": "",
                "accessIPv6": "",
                "created": "2017-05-24T06:14:05Z",
                "hostId": "e9c3ee0fcc58ab6085cf30df70b5544eab958858fb50d925f023e53e",
                "OS-EXT-SRV-ATTR:hypervisor_hostname": "nova004@2",
                "key_name": "KeyPair-JX",
                "flavor": {
                    "links": [
    {
                            "rel": "bookmark",
                            "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/flavors/physical.83.medium"
                        }
                    ],
                    "id": "physical.83.medium"
                },
                "security_groups": [
    {
                        "name": "0011b620-4982-42e4-ad12-47c95ca495c4"
                        }
                ],
                "config_drive": "",
                "OS-EXT-STS:vm_state": "active",
                "OS-EXT-SRV-ATTR:instance_name": "instance-0000ebd3",
                "user_id": "1311c433dd9b408886f57d695c229cbe",
                "name": "bms",
                "progress": 0,
                "OS-SRV-USG:launched_at": "2017-05-25T03:40:25.066078",
                "updated": "2017-05-25T03:40:25Z",
                "status": "ACTIVE"
                        }
        ]
    }
    

Returned Values

Normal values

Returned Values

Description

200

The request has been successfully processed.

For details about other returned values, see Status Codes.

Error Codes

See Error Codes.