• Bare Metal Server

bms
  1. Help Center
  2. Bare Metal Server
  3. API Reference
  4. API
  5. BMS Lifecycle Management (Native OpenStack APIs)
  6. Creating a BMS (Native OpenStack API)

Creating a BMS (Native OpenStack API)

Function

This interface is used to create a BMS.

Constraints

  • This interface cannot be used to create BMSs in batches.
  • This interface cannot be used to create BMSs charged in yearly/monthly mode in batches.
  • When you create a BMS using an image that supports Cloud-Init or Cloudbase-Init, only parameter key_name can be configured. (Parameter adminPass is invalid.) The password of a Linux BMS can be injected only using parameter user_data. The password of a Windows BMS can be injected only using metadata admin_pass.
  • When you create a BMS using an image that does not support Cloud-Init or Cloudbase-Init, both parameters adminPass and key_name are invalid. You need to use the password or certificate of the image to log in to the BMS.
  • File injection is not supported.
  • BMS creation from a system volume is not supported.
  • Parameter port in the three network parameters (port, uuid, and fixed_ip) has the highest priority. If parameter fixed_ip is set, you must specify the UUID.
  • After a BMS is created, it is recommended that you attach the __type_baremetal tag to the BMS. This tag specifies that the created server is a BMS. Otherwise, the BMS may not be displayed in the BMS list on the management console.
  • A BMS can have a maximum of two VPCs, in which case the first VPC will be used by the primary NIC.

URI

POST /v2.1/{project_id}/servers

Table 1 lists the parameters.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

Request Message

  • Request parameters

    Parameter

    Type

    Mandatory

    Description

    server

    Dict

    Yes

    Specifies the BMS information. For details, see [1] server field data structure description.

    [1] server field data structure description

    Parameter

    Type

    Mandatory

    Description

    imageRef

    String

    Yes

    Specifies the ID of the image used by the BMS or the image resource uniform resource locator (URL).

    • Example image ID: 3b8d6fef-af77-42ab-b8b7-5a7f0f0af8f2
    • Example image URL: http://glance.openstack.example.com/images/3b8d6fef-af77-42ab-b8b7-5a7f0f0af8f2
    NOTE:
    • BMSs using certain flavors do not support all public images provided on the public cloud platform. To obtain the images supported by a BMS flavor, log in to the management console, view the images displayed on the Create ECS page, and obtain the image IDs on the Image Management Service page.
    • If the creation fails, modify the parameter settings.

    flavorRef

    String

    Yes

    Specifies the ID or URL of the flavor used by the BMS.

    name

    String

    Yes

    Specifies the BMS name. It contains 0 to 255 characters.

    metadata

    Dictionary data structure [2]

    No

    Specifies the BMS metadata. The maximum size for each metadata key and value pair is 255 bytes.

    user_data

    String

    No

    Specifies the user data to be injected during the BMS creation.

    Text, text files, and .gzip files can be injected. The content to be injected cannot be greater than 32 KB in size. The content to be injected must be encoded with base64.

    adminPass

    String

    No

    Specifies the initial login password of the BMS administrator account. This parameter is invalid for a Linux BMS. The administrator account of a Windows BMS is Administrator.

    Password complexity requirements:

    • The password contains 8 to 26 characters.
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?).
    • The password cannot contain the username or the username in reverse.
    • The Windows BMS password cannot contain the username, the username in reverse order, or more than two consecutive characters in the username.

    Note: If this parameter is not specified, a random password will be generated.

    Special characters: !@$%^-_=+[{}]:,./?

    security_groups

    List data structure [3]

    No

    Specifies the security group of a BMS. The default value is default. This parameter is valid when you specify parameter network. You are not allowed to specify multiple security groups.

    networks

    List data structure [4]

    Yes

    Specifies the BMS NICs. You can specify a maximum of four networks for a BMS, including two VXLAN networks and two GENEVE networks. The first network in the parameter must be a VXLAN network. The network is used as by the primary NIC of the BMS. If multiple groups of network parameters are specified, ensure that the parameters of each group belong to the same VPC.

    key_name

    String

    No

    Specifies the name of a key pair. This is an extended attribute.

    availability_zone

    String

    Yes

    Specifies information about the AZ to which the BMS belongs. You are not allowed to specify host information.

    [2] metadata field data structure description

    Parameter

    Type

    Mandatory

    Description

    User-defined field key and value pair

    String

    No

    Specifies the key and value pair of the metadata.

    The maximum size for each metadata key and value pair is 255 bytes.

    [3] security_groups field data structure description

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    Specifies the name of the security group to which the BMS belongs.

    [4] networks field data structure description

    Parameter

    Type

    Mandatory

    Description

    port

    String

    No

    Specifies the UUID of the network port.

    uuid

    String

    No

    Specifies the network UUID.

    fixed_ip

    String

    No

    Specifies the fixed IP address.

  • Example request
    {
        "server": {
            "imageRef": "1a6635d8-afea-4f2b-abb6-27a202bad319",
            "flavorRef": "physical.83.medium",
            "name": "bms_name01",
            "availability_zone": "az01",
            "networks": [
                {
                    "uuid": "8470310b-bfa2-4edf-8f64-d15196b2b2c9"
                }
            ]
        }
    }

Response Message

  • Response parameters

    Parameter

    Type

    Description

    server

    Dictionary data structure [1]

    Specifies the BMS information.

    [1] server field data structure description

    Parameter

    Type

    Description

    security_groups

    List data structure [2]

    Specifies information about the BMS security group.

    OS-DCF:diskConfig

    String

    Specifies the disk configuration mode.

    • MANUAL: The image space cannot be expanded.
    • AUTO: The system disk image space automatically expands to the same size as that provided by the flavor.

    id

    String

    Specifies the BMS ID.

    links

    List data structure [3]

    Specifies the shortcut links of the BMS.

    adminPass

    String

    Specifies the initial login password of the BMS administrator account.

    [2] security_groups field data structure description

    Parameter

    Type

    Description

    name

    String

    Specifies the name of the security group to which the BMS belongs.

    [3] links field data structure description

    Parameter

    Type

    Description

    rel

    String

    Specifies the shortcut link marker name.

    href

    String

    Specifies the corresponding shortcut link.

  • Example response
    {
        "server": {
            "security_groups": [
                {
                    "name": "default"
                }
            ],
            "OS-DCF:diskConfig": "MANUAL",
            "links": [
                {
                    "rel": "self",
                    "href": "https://openstack.example.com/v2/c685484a8cc2416b97260938705deb65/servers/9ab74d89-61e7-4259-8546-465fdebe4944"
                },
                {
                    "rel": "bookmark",
                    "href": "https://openstack.example.com/c685484a8cc2416b97260938705deb65/servers/9ab74d89-61e7-4259-8546-465fdebe4944"
                }
            ],
            "id": "9ab74d89-61e7-4259-8546-465fdebe4944",
            "adminPass": "RjdD3h8U2DBe"
        }
    }

Returned Values

See section Common Returned Values.