Create image
Method | URI | Description |
---|---|---|
POST | /v2/{tenant_id}/volumes/{volume_id}/action | Creates an image. |
Normal response codes: 202
It is necessary to perform preparatory tasks before creating an image of a virtual server whose OS is CentOS, Ubuntu, or Red Hat Enterprise Linux.
If the network settings that need to be removed before image creation are still in the image, network communication with the virtual server created from that image will not be possible.
Refer to "Managing Virtual Server Images" in the "FUJITSU Cloud Service for OSS IaaS Features Handbook" for details on the tasks.
- The image exists
- The status of the image is active
- The sync_status_reason property does not exist for the image
sync_reason_status is a property of images in the Availability Zone where the image was created. Created images are registered to each availability zone so that they can be used from all of them.
When registration of an image to another Availability Zone fails, an error is recorded in sync_status_reason. If an error occurs, delete the image and then create it again.
Example:"sync_status_reason":"ERROR:A timeout occurred during synchronize image the server(http://1.1.1.1:9292) in the image operation. image_id=681995bb-26c3-421e-9734-0c02b1acbf7d"
Check the error record of sync_reason_status using the following API response parameter.
If using Windows in the system volume, it is necessary to perform the following tasks before and after creating an image:
- Tasks before creating an image
Perform the procedure to run Sysprep on the Windows virtual server.
Refer to "Procedure" in "Procedure to Run Sysprep on Windows OS" in the "FUJITSU Cloud Service for OSS IaaS Features Handbook" for details on the tasks.
- Tasks after creating an image
After creating an image, restore a snapshot of the virtual server, and then restart the virtual server.
Refer to "Results" in "Procedure to Run Sysprep on Windows OS" in the "FUJITSU Cloud Service for OSS IaaS Features Handbook" for details on the tasks.
Request
This table shows the URI parameters for the create image request:
Name | Type | Description |
---|---|---|
{tenant_id} | String | The unique identifier of the project or account. |
{volume_id} | UUID | The unique identifier of an existing volume. |
This table shows the body parameters for the create image request:
Name | Type | Description |
---|---|---|
container_format | String (Optional) |
Specifies the container format of the image to be created. Specify "bare". If omitted, "bare" will be used. |
disk_format | String (Optional) |
Specifies the disk format of the image to be created. Specify "raw". If omitted, "raw" will be used. |
image_name | String | Specifies the name of the image to be created. |
force | boolean (Optional) |
If "False" is specified, images cannot be created when a volume is mounted on the instance. If "True" is specified, images can be created even when a volume is mounted on the instance. If you will specify this parameter, stop the operating system beforehand. If omitted, "false" will be used. |
Example. Create volume: JSON request
{
"os-volume_upload_image": {
"container_format": "bare",
"disk_format": "raw",
"image_name": "my_image",
"force": "True"
}
}
Response
Example. Create volume: JSON response
{
"os-volume_upload_image":{
"status":"uploading",
"image_id":"3dc6c4d9-95e9-4cdb-a076-cc3ed50b9654",
"image_name":"20150430_volume_to_image-003",
"volume_type":{
"name":"M1",
"qos_specs_id":null,
"deleted":false,
"created_at":"2014-10-11T11:26:56.000000",
"updated_at":null,
"deleted_at":null,
"id":"13a0247c-9363-401d-acd3-c5d07ccd1a45"
},
"container_format":"bare",
"size":2,
"disk_format":"raw",
"id":"52102306-e352-4c84-9233-2ac2b511d29b",
"display_description":null,
"updated_at":"2015-04-30T06:31:31.000000"
}
}
This table shows the body parameters for the create image response:
Name | Type | Description | |
---|---|---|---|
status | String | Status of the volume. The status will become "uploading" immediately after image creation is started from the volume. When image creation is complete, the status will return to "available" or "in-use". |
|
image_id | uuid | ID of the created image. | |
image_name | String | Value specified in the Request Body. | |
volume_type | String | Type of the volume. When the volume type is not specified, "null" is returned instead of a child element. |
|
name | String | Name of the volume type. | |
qos_specs_id | uuid | ID of the qos spec. | |
deleted | Boolean | Flag indicating that a volume has been deleted. "true" is used to indicate that it has been deleted. |
|
created_at | Datetime | Creation datetime of the volume type. | |
updated_at | Datetime | Update datetime of the volume type. | |
deleted_at | Datetime | Deletion datetime of the volume type. | |
id | uuid | ID of the volume type. | |
container_format | String | The value specified (or omitted) in the Request Body. | |
size | Int | Volume size, in GB. | |
disk_format | String | The value specified (or omitted) in the Request Body. | |
id | Uuid | ID of the volume. | |
display_description | String | Description of the volume. | |
updated_at | Datetime | Update datetime of the volume. |