• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Glance
  5. Images
  6. Create Image

Create Image

Function Description

This interface is used to create an image.

Interface Format

Method

URI

Description

POST

/v2/images

Creates an image.

Restrictions

1. The request parameter min_disk constraints are as follows:

The value must be greater than the image system disk size. Otherwise, ECS creation may fail.

2. The request parameter __os_version constraints are as follows:

Set the value based on the OS version of the image file to be uploaded.

If this parameter is not specified, the value will be set to Other Linux(64 bit). In that case, the ECS creation using this image may fail, and the ECS created using this image may fail to run properly.

The values of os_version are as follows:

Other Linux(32 bit)

Other Linux(64 bit)

Windows Server 2012 R2 Standard 64bit

Windows Server 2012 R2 Datacenter 64bit

Windows Server 2012 R2 Essentials 64bit

Windows Server 2012 Standard 64bit

Windows Server 2012 Datacenter 64bit

Windows Server 2008 R2 WEB 64bit

Windows Server 2008 R2 Standard 64bit

Windows Server 2008 R2 Enterprise 64bit

Windows Server 2008 R2 Datacenter 64bit

Windows Server 2008 Standard 64bit

Windows Server 2008 Standard 32bit

Windows Server 2008 Enterprise 64bit

Windows Server 2008 Enterprise 32bit

Windows Server 2008 Datacenter 64bit

Windows Server 2008 Datacenter 32bit

Ubuntu 14.04.3 server 64bit

Ubuntu 14.04.3 server 32bit

Ubuntu 14.04.1 server 64bit

Ubuntu 14.04.1 server 32bit

Ubuntu 14.04 server 64bit

Ubuntu 14.04 server 32bit

Ubuntu 13.10 server 64bit

Ubuntu 13.10 server 32bit

Ubuntu 13.10 desktop 64bit

Ubuntu 13.10 desktop 32bit

Ubuntu 13.04 server 64bit

Ubuntu 13.04 server 32bit

Ubuntu 13.04 desktop 64bit

Ubuntu 13.04 desktop 32bit

Ubuntu 12.10 server 64bit

Ubuntu 12.10 server 32bit

Ubuntu 12.04.2 server 64bit

Ubuntu 12.04.2 server 32bit

Ubuntu 12.04.2 desktop 64bit

Ubuntu 12.04.2 desktop 32bit

Ubuntu 12.04.1 server 64bit

Ubuntu 12.04.1 desktop 64bit

Ubuntu 12.04 server 64bit

Ubuntu 12.04 desktop 64bit

Ubuntu 11.10 server 64bit

Ubuntu 11.10 server 32bit

Ubuntu 10.10 server 64bit

Ubuntu 10.04.4 server 64bit

Ubuntu 10.04.3 server 64bit

Ubuntu 10.04.2 server 64bit

Ubuntu 10.04.1 server 64bit

Ubuntu 10.04.1 desktop 32bit

Ubuntu 10.04 server 64bit

Ubuntu 10.04 server 32bit

Ubuntu 10.04 desktop 64bit

Ubuntu 8.04.4 desktop 32bit

Ubuntu 8.04 desktop 64bit

Redhat 7.0 64bit

Redhat 6.6 64bit

Redhat 6.6 32bit

Redhat 6.5 64bit

Redhat 6.5 32bit

Redhat 6.4 64bit

Redhat 6.4 32bit

Redhat 6.3 64bit

Redhat 6.3 32bit

Redhat 6.2 64bit

Redhat 6.2 32bit

Redhat 6.1 64bit

Redhat 6.1 32bit

Redhat 6.0 64bit

Redhat 6.0 32bit

Redhat 5.11 64bit

Redhat 5.11 32bit

Redhat 5.10 64bit

Redhat 5.10 32bit

Redhat 5.9 64bit

Redhat 5.9 32bit

Redhat 5.8 64bit

Redhat 5.8 32bit

Redhat 5.7 64bit

Redhat 5.7 32bit

Redhat 5.6 64bit

Redhat 5.6 32bit

Redhat 5.5 64bit

Redhat 5.5 32bit

Redhat 5.4 64bit

Redhat 5.4 32bit

Redhat 5.3 64bit

Redhat 5.3 32bit

Redhat 5.2 64bit

Redhat 5.2 32bit

Redhat 5.1 64bit

Redhat 5.1 32bit

Redhat 5.0 64bit

Redhat 5.0 32bit

Redhat 4.8 64bit

Redhat 4.8 32bit

Redhat 4.7 64bit

Redhat 4.7 32bit

Redhat 4.6 64bit

Redhat 4.6 32bit

Redhat 4.5 64bit

Redhat 4.5 32bit

Redhat 4.4 64bit

Redhat 4.4 32bit

Oracle Linux Server release 6.7 64bit

Oracle Linux Server release 6.7 32bit

Oracle Linux Server release 6.1 64bit

Oracle Linux Server release 6.1 32bit

Oracle Linux Server release 5.7 64bit

OpenSUSE 13.2 64bit

OpenSUSE 11.3 64bit

SUSE Linux Enterprise Server 12 SP1 64bit

SUSE Linux Enterprise Server 11 SP4 64bit

SUSE Linux Enterprise Server 11 SP3 64bit

SUSE Linux Enterprise Server 11 SP3 32bit

SUSE Linux Enterprise Server 11 SP2 64bit

SUSE Linux Enterprise Server 11 SP2 32bit

SUSE Linux Enterprise Server 11 SP1 64bit

SUSE Linux Enterprise Server 11 SP1 32bit

SUSE Linux Enterprise Server 11 SP0 64bit

SUSE Linux Enterprise Server 11 SP0 32bit

SUSE Linux Enterprise Server 10 SP4 64bit

SUSE Linux Enterprise Server 10 SP4 32bit

SUSE Linux Enterprise Server 10 SP3 64bit

SUSE Linux Enterprise Server 10 SP3 32bit

SUSE Linux Enterprise Server 10 SP2 64bit

SUSE Linux Enterprise Server 10 SP2 32bit

SUSE Linux Enterprise Server 10 SP1 64bit

SUSE Linux Enterprise Server 10 SP1 32bit

Fedora 22 64bit

Debian 8.2.0 64bit

Debian 7.5.0 64bit

Debian 7.5.0 32bit

Debian 7.4.0 64bit

Debian 7.4.0 32bit

Debian 7.3.0 64bit

Debian 7.3.0 32bit

Debian 7.2.0 64bit

Debian 7.2.0 32bit

Debian 7.1.0 64bit

Debian 7.1.0 32bit

Debian 6.0.7 64bit

Debian 6.0.5 64bit

Debian 6.0.4 64bit

Debian 5.0.10 64bit

CentOS 7.1 64bit

CentOS 7.0 64bit

CentOS 7.0 32bit

CentOS 6.7 64bit

CentOS 6.7 32bit

CentOS 6.6 64bit

CentOS 6.6 32bit

CentOS 6.5 64bit

CentOS 6.5 32bit

CentOS 6.4 64bit

CentOS 6.4 32bit

CentOS 6.3 64bit

CentOS 6.3 32bit

CentOS 6.2 64bit

CentOS 6.2 32bit

CentOS 6.1 64bit

CentOS 6.1 32bit

CentOS 6.0 64bit

CentOS 6.0 32bit

CentOS 5.11 64bi

CentOS 5.11 32bi

CentOS 5.10 64bi

CentOS 5.10 32bi

CentOS 5.9 64bit

CentOS 5.9 32bit

CentOS 5.8 64bit

CentOS 5.8 32bit

CentOS 5.7 64bit

CentOS 5.7 32bit

CentOS 5.6 64bit

CentOS 5.6 32bit

CentOS 5.5 64bit

CentOS 5.5 32bit

CentOS 5.4 64bit

CentOS 5.4 32bit

CentOS 5.3 64bit

CentOS 5.3 32bit

CentOS 5.2 64bit

CentOS 5.2 32bit

CentOS 5.1 64bit

CentOS 5.1 32bit

CentOS 5.0 64bit

CentOS 5.0 32bit

CentOS 4.8 64bit

CentOS 4.8 32bit

CentOS 4.7 64bit

CentOS 4.7 32bit

CentOS 4.6 64bit

CentOS 4.6 32bit

CentOS 4.5 64bit

CentOS 4.5 32bit

CentOS 4.4 64bit

CentOS 4.4 32bit

  

Extension Description

N/A

Request Parameter

Parameter

Type

Restriction

Mandatory

Description

__os_version

String

For the values, see the restrictions in this section.

Yes

Specifies the OS version of the image. The supported OSs are listed in the restrictions in this section.

visibility

String

The value is private.

No

Specifies whether the image can be viewed by other tenants.

name

String

len<=255

No

Specifies the image name.

protected

Bool

The value is false.

No

Specifies whether the image is protected. The protected image cannot be deleted.

container_format

String

The value can be ami, ari, aki, bare, or ovf.

No

Specifies the container format.

disk_format

String

The value can be ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, or iso.

No

Specifies the image file format.

tags

List(string)

string len ≤ 255

No

Specifies the image tag.

min_ram

Int

min_ram<2147483648

No

Specifies the minimum size of the memory (MB) that the running image belongs to.

min_disk

Int

min_disk<2147483648

No

Specifies the minimum size of the disk (GB) that the running image belongs to.

id

String

uuid

No

Specifies the image ID.

Attribute name of a customized image

String

string len ≤ 255

No

Specifies the image attribute. You can specify multiple attribute key pairs, for example, 'a'='b'.

'c'='d'

Response Parameter

Parameter

Type

Restriction

Mandatory

Description

visibility

String

The value is private.

Yes

Specifies whether the image can be viewed by other tenants.

name

String

len<=255

Yes

Specifies the image name.

protected

Bool

The value is false.

Yes

Specifies whether the image is protected. The protected image cannot be deleted.

container_format

String

The value can be ami, ari, aki, bare, or ovf. By default, the value is bare.

Yes

Specifies the container format.

disk_format

String

The value can be ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, or iso. By default, the value is vhd.

Yes

Specifies the image file format.

tags

List(String)

string len ≤ 255

Yes

Specifies the image tag.

min_ram

Int

min_ram<2147483648

Yes

Specifies the minimum size of the memory (MB) that the running image belongs to.

min_disk

Int

min_disk<2147483648

Yes

Specifies the minimum size of the disk (GB) that the running image belongs to.

status

String

N/A

Yes

Specifies the image status.

created_at

Timestamp

N/A

Yes

Specifies the image creation time.

updated_at

Timestamp

N/A

Yes

Specifies the image update time.

self

String

N/A

Yes

Specifies the image self link.

id

String

N/A

Yes

Specifies the image ID.

file

String

N/A

Yes

Specifies the URL for the image file that you can upload or download.

schema

String

N/A

Yes

Specifies the URL for the schema.

__image_source_type

String

The value is uds.

Yes

Specifies the type of the image backend storage.

__image_size

String

N/A

Yes

Specifies the image size.

__isregistered

String

The value is true.

Yes

Specifies whether the image is registered. Only registered images can be queried on the portal.

__os_version

String

For the values, see the restrictions in this section.

Yes

Specifies the type of image OS.

__os_type

String

The value depends on the value of __os_version.

Yes

Specifies the image OS type. The system supports the following OSs:

windows/linux/other

__platform

String

The value depends on the value of __os_version.

Yes

Specifies the OS platform supported by the image.

__os_bit

Int

The value depends on the value of __os_version. The value can be 32 or 64.

Yes

Specifies the OS bit.

__imagetype

String

The value is private.

Yes

Specifies the image type.

gold: platform image

shared: shared image

market: market image

private: private image

virtual_env_type

String

The value can be FushionCompute or Ironic.

By default, the value is FushionCompute.

Yes

Specifies the platform type.

owner

String

Tenant ID

Yes

Specifies the ID of the tenant that the image belongs to.

virtual_size

Int

N/A

Yes

Specifies the virtual size of the image.

size

Int

N/A

Yes

Specifies the image size. This parameter is available after an image is uploaded.

checksum

String

N/A

Yes

Specifies the image verification sum. This parameter is available after an image is uploaded.

Attribute name of a customized image

String

string len ≤ 255

No

Specifies the image attribute. You can specify multiple attribute key pairs, for example, 'a'='b'.

'c'='d'

Request Example

POST /v2/images

{
   "__os_version":"Ubuntu 14.04 server 64bit",  
   "container_format": "bare",
   "disk_format": "vhd",
   "id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86",
   "min_disk": 1,
   "min_ram": 1024,
   "name": "test",
    "tags": [
        "test",
        "image"
    ],
   "visibility": "private",
   "protected": false
}

Response Example

STATUS CODE 200

{
  "schema": "/v2/schemas/image",
  "min_disk": 1,
  "created_at": "2016-06-02T07:49:48Z",
  "size": null,
  "__image_source_type": "uds",
  "container_format": "bare",
  "__image_size": "0",
  "file": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86/file",
  "checksum": null,
  "updated_at": "2016-06-02T07:49:49Z",
  "protected": false,
  "id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86",
  "__isregistered": "true",
  "min_ram": 1024,
  "owner": "b912fb4a4c464b568ecfca1071b21b10",
  "__os_type": "Linux",
  "__imagetype": "private",
  "visibility": "private",
  "virtual_env_type": "FusionCompute",
  "tags": [
    "test",
    "image"
  ],
  "__platform": "Ubuntu",
  "__os_bit": "64",
  "__os_version": "Ubuntu 14.04 server 64bit",
  "name": "test",
  "self": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86",
  "disk_format": "vhd",
  "status": "queued"
  "virtual_size": null
}

Error Code

N/A