2.4.9. Create Image

Verb URI Action specified in request body Description
POST /servers/id/action createImage Creates a new image for a specified server.

Normal Response Code: 202

Error Response Codes: computeFault (400, 500, …), badRequest (400), unauthorized (401), resizeNotAllowed (403), forbidden (403), itemNotFound (404), Method Not Allowed (405), overLimit (413), backupOrResizeInProgress (409), buildInProgress (409), badMediaType (415), serverCapacityUnavailable (503), serviceUnavailable (503)

Image Status Transition: SAVING ACTIVE
SAVING ERROR (on error)

This operation creates a new image for a specified server. Once complete, a new image is available that you can use to rebuild or create servers. The full URL to the newly created image is returned through the Location header. You can retrieve additional attributes for the image including its creation status by issuing a subsequent GET on that URL. See Section 2.7.2, “Get Image Details” for details.

[Note]Note

This operation is not available for OnMetal servers.

When you create an image, you can also specify custom image metadata. For details about working with metadata, see Section 2.8, “Metadata”. The maximum size of the metadata key and value is 255 bytes each. You can query the maximum number of key-value pairs that you can specify per image through the maxImageMeta absolute limit. See Section 1.9.3, “Get Limits”.

[Warning]Warning

If you create an image of a Performance server, only the system disk is captured. The data disks are not included in the image. To back up the data disks in a Performance server, use Cloud Backup or Cloud Block Storage.

Specify the server ID as id in the URI.

In the request body, specify the createImage action followed by attributes. The following table describes the attributes that you can specify in the request body:

[Important]Important

In addition to creating images manually, you may also schedule images of your server automatically. See Section 3.5, “Scheduled Images Extension” for more information on this extension, including enabling and disabling scheduled images and showing scheduled images.

Table 2.10. Create Image Request Attributes
Attribute Description Required
name The name for the new image. Yes
metadata

Key and value pairs for metadata.

No

This operation does not return a response body.

[Note]Note

Currently, image creation is an asynchronous operation, so coordinating the creation with data quiescence, and so on, is currently not possible.

 

Example 2.62. Create Image: JSON Request

{
    "createImage" : {
        "name" : "new-image",
        "metadata": {
            "ImageType": "Gold",
            "ImageVersion": "2.0"
        }
    }
}

 

Example 2.63. Create Image: XML Request

<?xml version="1.0" encoding="UTF-8"?>
<createImage
    xmlns="http://docs.openstack.org/compute/api/v1.1"
    name="new-image">
    <metadata>
        <meta key="ImageType">Gold</meta>
        <meta key="ImageVersion">2.0</meta>
    </metadata>
</createImage>



loading table of contents...