Create Server

Overview

This API creates additional baremetal servers.

Classification

  • Create

API Operation Object

Synchronous / Asynchronous

  • Asynchronous

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/servers

HTTP Request Header

Accept: application/json
Content-Type: application/json
X-Auth-Token: <token>

HTTP Request Body

Format

{
  "server": "<server>"
}

Request Parameter

Input Parameters
name style format description required/optional default value action for invalid parameter response code for invalid parameter
name plain String Name of your baremetal server as a string. Please refer OS specific limitations name raw to know the limitation for each OS. required - Terminate 400, 404
networks plain Network Array If it is specified greater than two, default gateway is first network. required - Terminate 400, 413
adminPass plain String Password for the administrator. Please refer OS specific limitations adminPass raw to know the required administrator name for each OS. If you don’t set this parameter, it is set randomly. optional - Terminate 400
imageRef plain String The image reference for the desired image for your baremetal server. Specify as an UUID or full URL. optional - Terminate 404
flavorRef plain String The flavor reference for the desired flavor for your baremetal server. Specify as an UUID or full URL. Parameters of id or links -> href in List Flavors page can be used as flavorRef parameter. required - Terminate 404
key_name plain String SSH Keypair name you created on KeyPairs API optional - Terminate 400
availability_zone plain String The availability zone name in which to launch the server. If omit this parameter, target availability_zone is random. optional - Terminate 400, 404
user_data plain String Configuration information or scripts to use upon launch. Must be Base64 encoded. Maximum size is 65535 bytes. Please refer OS specific limitations user_data raw to know the limitation for each OS. optional - Terminate 400
raid_arrays plain RaidArray Raid Arrays information. Please refer OS specific limitations raid_arrays raw to know the limitation for each OS. optional - Terminate 400, 403, 413
lvm_volume_groups plain LVM VolumeGroup LVM information. must be sure to specify if you have to true lvm parameters Raid Arrays. Please refer OS specific limitations lvm_volume_groups raw to know the limitation for each OS. optional - Terminate 400, 404, 413
filesystems plain datatype_filesystems Partition filesystem / mount point information. Please refer OS specific limitations filesystems raw to know the limitation for each OS. optional - Terminate 400
metadata plain Metadata Metadata key and value pairs. The maximum size of the metadata key and value is 255 bytes each. optional - Terminate 400, 413
personality plain Personality File path and contents (text only) to inject into your baremetal server at launch. This parameter is not supported in ESXi. optional - Terminate 400, 413

Network relationship

This section shows Baremetal Server‘s behavior about network configurations. (In case of data plane.)
Baremetal Service works in close cooperation with Logical Network Service.
The cooperation consists of two-phase.
Phase 1
Baremetal Service receives “networks” parameter when called POST /{tenant_id}/Servers (Create Server) and “networks” consists of “network” elements (Refer to Network).
After “network” element is parsed, Baremetal Service configures network settings depending on the values of sub elements.
  • If “uuid” is set, new PORT which belongs to target Logical Network UUID is created and “network” is mapped to target Logical Network
  • If “port” is set, “network” is mapped to target Logical Network which “port” (PORT UUID) belongs to.
Phase 2
Each Logical Network has Subnet Resource and Baremetal Service get this information.
Followings are how Baremetal Service configures Baremetal Server’s network configurations.
Network Configuration Type Description
DHCP Refer to “enable_dhcp” value.
IP Address
  1. If fixed_ip is set in Baremetal Server API, then the value is injected.
  2. If fixed_ip is nil but enabled_dhcp is true, then your baremetal server refer to DHCP information.
  3. If fixed_ip is nil and enabled_dhcp is false, then actions are different between each OS (e.g., manual mode is set to Ubuntu OS)
Network Address / Subnet Mask Refer to “cidr” value.
Default GW Refer to “gateway_ip”. If the value is nil, then no default GW is set to your baremetal server.
DNS Refer to “dns_nameservers”. If the value is nil, then DNS configuration is blank.
NTP Refer to “ntp_servers”. If the value is nil, then NTP configuration is blank.
Static Routes Refer to “host_routes”. If the value is nil, then no routes are added to routing table. (Not implemented)

OS specific limitations

Parameter Limitation
name
  • General
    • Can use only these characters. a-z A-Z 0-9 and ‘-‘ (cannot use hyphens at the beginning and end)
  • manual, iso
    • Allows 1-255 characters length
  • template(Linux, ESXi)
    • Allows 1-63 characters length
  • template(Windows)
    • Allows 1-15 characters length
adminPass
  • template(RHEL, CentOS, ESXi)
    • Required administrator name is “root”
    • Can use only these characters 0-9 a-z A-Z . - _ @ / * + , ! # $ % & ( ) ~ |
    • Allows 8-127 characters length
  • template(Ubuntu)
    • Required administrator name is “ubuntu”
    • Can use only these characters 0-9 a-z A-Z . - _ @ / * + , ! # $ % & ( ) ~ |
    • Allows 8-127 characters length
  • template(CoreOS)
    • Required administrator name is “core”
    • Can use only these characters 0-9 a-z A-Z . - _ @ / * + , ! # $ % & ( ) ~ |
    • Allows 8-127 characters length
  • template(Windows)
    • Required administrator name is “administrator”
    • Can use only these characters 0-9 a-z A-Z . - _ @ / * + , ! # $ % & ( ) ~ |
    • Allows 8-127 characters length
  • manual, iso
    • Cannot specify this parameter
key_name
user_data
  • template(RHEL, CentOS, Ubuntu, CoreOS)
    • Can specify this parameter
  • manual, iso, template(ESXi, Windows)
    • Not supported
raid_arrays
  • template(RHEL, CentOS, Ubuntu)
    • Can specify ‘partitions’ parameter
    • partition > maximum partitions number is 20 on each raid array
    • partition > partition_label can use only these characters a-z A-Z 0-9 - and allows 1-32 characters length
    • partition > lvm flag is allowed(when lvm_volume_groups specified)
    • partition > size must be a positive integer
  • template(Windows)
    • Can specify ‘partitions’ parameter
    • partition > maximum partitions number is 20 on each raid array
    • partition > minimum partition size of ‘C:’ is 100GB
    • partition > partition_label can use only these characters a-z A-Z 0-9 - and allows 1-32 characters length
    • partition > lvm flag is disallowed
    • partition > size must be a positive integer
  • manual, iso, template(CoreOS, ESXi)
    • ‘partitions’ parameter is not supported
lvm_volume_groups
  • template(RHEL, CentOS, Ubuntu)
    • Can specify this parameter
    • logical_volumes > vg_label and logical_volumes > lv_label can use only these characters a-z A-Z 0-9 + _ . - and allows 1-32 characters length
  • manual, iso template(ESXi, CoreOS, Windows)
    • Not supported
filesystems
  • template(RHEL, CentOS)
    • Depends on the label of LVM VolumeGroup or RaidArray.
    • fs_type allows ext4, ext3, xfs and swap
    • mount_point allows /, /var, /usr, /home
  • template(Ubuntu)
    • Depends on the label of LVM VolumeGroup or RaidArray.
    • fs_type allows ext4, ext3, xfs, jfs and swap
    • mount_point allows /, /home, /tmp, /usr, /var, /srv, /opt, /usr/local
  • manual, iso, template(ESXi, CoreOS, Windows)
    • Not supported

About of Disk Partitioning

For customize disk partitioning, you can specify raid_arrays / lvm_volume_groups / filesystems parameters.

Default settings
OS Default settings
RHEL
CentOS
Ubuntu
Most of primary_storage area used as ‘/’.
Filesystem is xfs(RHEL, CentOS) or ext4(Ubuntu).
Installer automatically creates GPT area, uEFI partition, and boot partition in small size to head of primary_storage.
In default, LVM does not used.

+----------+-----------+----------+----------------------------------------------+---------+
| GPT area | /boot/efi |  /boot   |                       /                      |   swap  |
|          |  [fat32]  |  [ext4]  |        [ext4(ubuntu) or xfs(CentOS/RHEL)]    |  [swap] |
|  (<1MB)  |  (512MB)  |  (512MB) |               (all remaining area)           |  (16GB) |
+----------+-----------+----------+----------------------------------------------+---------+
Windows
Most of primary_storage area used as ‘C:’.
Filesystem is NTFS.
Installer automatically creates Windows RE Tools partition, ESP partition and MSR partition in small size to head of primary_storage.
About these partitions, see Microsoft®Web site.( https://msdn.microsoft.com/en-us/library/Hh824839.aspx )
Pagefile is created on ‘C:’ and set fixed size. The size is 16GB.
+--------------+---------+---------+------------------------------------------------------+
|  Windows RE  |   ESP   |   MSR   |                   Windows(C:)       +----------------|
|    Tools     |         |         |                     [NTFS]          |  pagefile.sys  |
| (300MB-1GB)  | (500MB) | (128MB) |              (all remaining area)   |     (16GB)     |
+--------------+---------+---------+-------------------------------------+----------------+
ESXi
CoreOS
Cannot specify partitioning.
Installer automatically creates partitions / filesystems in primary_storage.
Partition / filesystem structure same as these OSes are installed by official installer.
Manual
ISO
All of primary_storage area used by one empty partition.
Cannot create filesystem.
You can separate manually partition / filesystem in ISO image installer.

+-----------------------------------------------------------------------------------------+
|                                    empty partition                                      |
|                                      (all area)                                         |
+-----------------------------------------------------------------------------------------+
Manual partitioning examples
RHEL, CentOS, Ubuntu(without LVM)

If you want to customize partition without LVM, specify ‘raid_arrays’ and ‘filesystems’ parameters.

{
    "server": {
        "raid_arrays": [
            {
                "primary_storage": true,
                "partitions": [
                    {
                        "size": "40G",
                        "partition_label": "root"
                    },
                    {
                        "size": "auto",
                        "partition_label": "home"
                    },
                    {
                        "size": "4G",
                        "partition_label": "swap"
                    }
                ]
            }
        ],
        "filesystems": [
            {
                "label": "root",
                "mount_point": "/",
                "fs_type": "ext4"
            },
            {
                "label": "home",
                "mount_point": "/home",
                "fs_type": "ext4"
            },
            {
                "label": "swap",
                "fs_type": "swap"
            }
        ]
    }
}
+-----------+-----------+---------+------------+---------------------------------+--------+
| GPT area  | /boot/efi | /boot   |      /     |                /home            |  swap  |
|           |  [fat32]  | [ext4]  |   [ext4]   |                [ext4]           | [swap] |
|  (<1MB)   |  (512MB)  | (512MB) |   (40GB)   |         (all remaining area)    | (4GB)  |
+-----------+-----------+---------+------------+---------------------------------+--------+
RHEL, CentOS, Ubuntu(Use LVM)

If you want to customize partition with LVM, specify ‘raid_arrays’, ‘lvm_volume_groups’, and ‘filesystems’ parameters.

{
    "server": {
        "raid_arrays": [
            {
                "primary_storage": true,
                "partitions": [
                    {
                        "lvm": true,
                        "size": "40G",
                        "partition_label": "PV1"
                    },
                    {
                        "lvm": true,
                        "size": "40G",
                        "partition_label": "PV2"
                    },
                    {
                        "lvm": true,
                        "size": "auto",
                        "partition_label": "PV3"
                    }
                ]
            }
        ],
        "vg_label": [
            {
                "vg_label": "VG1",
                "physical_volume_partition_labels": [
                    "PV1"
                ],
                "logical_volumes": [
                    {
                        "lv_label": "lv_root",
                        "size": "auto"
                    }
                ]
            }
        ]
        "filesystems": [
            {
                "label": "lv_root",
                "mount_point": "/",
                "fs_type": "ext4"
            },
            {
                "label": "lv_home",
                "mount_point": "/home",
                "fs_type": "ext4"
            },
            {
                "label": "lv_var",
                "mount_point": "/var",
                "fs_type": "ext4"
            }
        ]
    }
}
Physical volumes
+-----------+-----------+---------+-----------------------------------------------------+
|           |           |         |                          PV                         |
|           |           |         |                 (all remaining area)                |
+-----------+-----------+---------+-----------------------------------------------------+
                                   \____________________________________________________/
                                                             VG
                                    ____________________________________________________
Logical volumes and filesystems    /                                                    \
+-----------+-----------+---------+-----------------------------------------------------+
| GPT area  | /boot/efi | /boot   |                          /                          |
|           |  [fat32]  | [ext4]  |                       [ext4]                        |
|  (<1MB)   |  (512MB)  | (512MB) |                 (all remaining area)                |
+-----------+-----------+---------+-----------------------------------------------------+
Windows

In windows, You can specify ‘raid_arrays’ parameter only. First partition of ‘partitions’ used as Windows operating system partition. Second or after partitions, used as data partition. Driveletter order same as specified in ‘partitions’ parameter. (ex. 1st->C, 2nd->D, 3rd->E)

{
    "server": {
        "raid_arrays": [
            {
                "primary_storage": true,
                "partitions": [
                    {
                        "size": "100G",
                        "partition_label": "windows"
                    },
                    {
                        "size": "auto",
                        "partition_label": "data"
                    }
                ]
            }
        ]
    }
}
+-------------+---------+---------+-----------------------------+---------------------------+
| Windows RE  |   ESP   |   MSR   |  Windows(C:) +--------------|            (D:)           |
|   Tools     |         |         |    [NTFS]    | pagefile.sys |           [NTFS]          |
| (300MB-1GB) | (500MB) | (128MB) |   (100GB)    |    (16GB)    |    (all remaining area)   |
+-------------+---------+---------+-----------------------------+---------------------------+

Using user_data introduction

What is user_data ?
Baremetal Service can execute various scripts which user want to run when the servers are booting by using user_data.
Validation Rules
Baremetal Server API validates the integrity of user_data.
1. If user_data string is encoded by Base64.
2. If user_data string is less than 64KiB.
Executing
If user_data passed validation, Baremetal Service do NOT meddle the contents of user_data itself and just give it to executors for each OS.
This function is just used on user own responsibility.
Executor / Executing Formats
This user_data is based on cloud-init. So, usage formats may change.
In that case, please refer latest cloud-init official reference.

There are three types of executing format. Each OS uses following adaptive executor.
OS Executor Executing Format
RHEL
CentOS
Ubuntu
cloud-init
Windows
cloudbase-init
ESXi
Unsupported
None
CoreOS
CoreOS cloud-init
Network Parameter of deploying ESXi

If you deploy ESXi, port attached nic_physical_port will be configured tag mode.

  1. Network ID

Port created has following attributes.

  • segmentation_type: vlan
  • segmentation_id: 3
  1. port id (You configured segmentation_type is flat)

Overwrite port’s attributes following value.

  • segmentation_type: flat
  • segmentation_id: 0
  1. port id (You configured segmentation_type is vlan)
  • Use specified port’s segmentation_type segmentation_type.

Response

HTTP Response Header

Format

HTTP/1.1 200 OK
  • <response_code>: see “HTTP Responses” section
  • <message>: message based on the response code

Response Code

Response Codes
response code condition
202 normal end
400 specified parameter is invalid
401 unauthorized
403 tenant is not available
404 not found a specified item
405 request URL or method is invalid
413 parameter is over the maximum number
500 compute fault
503 out of stock

HTTP Response Body

Format

{
  "server": "<server>"
}

Response Parameter

Response Parameters
item format   description
server CreatedServer   Server to be Created.

Sample Request and Response

Sample API Request

Request URI

https://baremetal-server-jp1-ecl.api.ntt.com/v2/b322a85578de48beba0f92acce57869b/servers

HTTP Request Header

POST /v2/b322a85578de48beba0f92acce57869b/servers HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.150.51:8774
Accept: application/json
Content-Type: application/json
X-Auth-Token: 62d528dc0cca4827b0ed465efe1c2588

HTTP Request Body

{
    "server": {
        "name": "server-test-1",
        "adminPass": "aabbccddeeff",
        "imageRef": "b5660a6e-4b46-4be3-9707-6b47221b454f",
        "flavorRef": "05184ba3-00ba-4fbc-b7a2-03b62b884931",
        "availability_zone": "zone1-groupa",
        "networks": [
            {
                "uuid": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
                "fixed_ip": "10.0.0.100"
            }
        ],
        "raid_arrays": [
            {
                "primary_storage": true,
                "partitions": [
                    {
                        "lvm": true,
                        "partition_label": "primary-part1"
                    },
                    {
                        "lvm": false,
                        "size": "100G",
                        "partition_label": "var"
                    }
                ]
            },
            {
                "raid_card_hardware_id": "raid_card_uuid",
                "disk_hardware_ids": [
                    "disk1_uuid", "disk2_uuid", "disk3_uuid", "disk4_uuid"
                ],
                "raid_level": 10,
                "partitions": [
                    {
                        "lvm": true,
                        "partition_label": "secondary-part1"
                    }
                ]
            }
        ],
        "lvm_volume_groups": [
            {
                "vg_label": "VG_root",
                "physical_volume_partition_labels": [
                    "primary-part1", "secondary-part1"
                ],
                "logical_volumes": [
                    {
                        "size": "300G",
                        "lv_label": "LV_root"
                    },
                    {
                        "size": "2G",
                        "lv_label": "LV_swap"
                    }
                ]
            }
        ],
        "filesystems": [
            {
                "label": "LV_root",
                "mount_point": "/",
                "fs_type": "xfs"

            },
            {
                "label": "var",
                "mount_point": "/var",
                "fs_type": "xfs"
            },
            {
                "label": "LV_swap",
                "fs_type": "swap"
            }
        ],
        "user_data": "IyEvYmluL2Jhc2gKZWNobyAiS3VtYSBQb3N0IEluc3RhbGwgU2NyaXB0IiA+PiAvaG9tZS9iaWcvcG9zdC1pbnN0YWxsLXNjcmlwdA==",
        "metadata": {
            "foo": "bar"
        }
    }
}

Sample API Response

HTTP Response Header

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: <content-length>
Date: Thu, 17 Jul 2014 04:21:06 GMT

HTTP Response Body

{
    "server": {
        "id": "05184ba3-00ba-4fbc-b7a2-03b62b884931",
        "links": [
            {
                "href": "https://baremetal-server-jp1-ecl.api.ntt.com/v2/openstack/servers/05184ba3-00ba-4fbc-b7a2-03b62b884931",
                "rel": "self"
            },
            {
                "href": "https://baremetal-server-jp1-ecl.api.ntt.com/openstack/servers/05184ba3-00ba-4fbc-b7a2-03b62b884931",
                "rel": "bookmark"
            }
        ],
        "adminPass": "aabbccddeeff"
    }
}