Creating a Data Disk Image Using an External Image File
Function
This API is used to create a data disk image from a data disk image file uploaded to the OBS bucket. The API is an asynchronous one. If it is successfully called, the cloud service system receives the request. However, you need to use the asynchronous job query API to query the image creation status. For details, see Querying the Status of an Asynchronous Job.
URI
POST /v1/cloudimages/dataimages/action
Request
- Request parameters
Parameter
Mandatory
Type
Description
name
Yes
String
Specifies the image name. For detailed description, see Image Attributes.
description
No
String
Provides supplementary information about the image.
For detailed description, see Image Attributes. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. This parameter is left blank by default.
os_type
No
String
Specifies the OS type.
It can only be Windows or Linux. The default is Linux.
image_url
Yes
String
Specifies the URL of the external image file in the OBS bucket.
The format is OBS bucket name:Image file name.
NOTE:The storage class of the OBS bucket must be Standard.
min_disk
Yes
Integer
Specifies the minimum size of the data disk.
Value range: 40 GB to 2048 GB
cmk_id
No
String
Specifies a custom key used for encrypting an image. For its value, see the Key Management Service User Guide.
tags
No
Array of strings
Lists the image tags. This parameter is left blank by default.
For detailed parameter description, see Image Tag Data Formats.
Use either tags or image_tags.
image_tags
No
Array of ImageTag objects
Lists the image tags. This parameter is left blank by default.
Use either tags or image_tags.
enterprise_project_id
No
String
Specifies the enterprise project that the image belongs to.
- If the value is 0 or left blank, the image belongs to the default enterprise project.
- If the value is a UUID, the image belongs to the enterprise project corresponding to the UUID.
For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Center.
Example Request
- Creating a data disk image with parameter tags using a file in an OBS bucket (file address in the bucket: image-test:fedora_data1.qcow2; OS: Linux; minimum size of the data disk: 40 GB)
1 2 3 4 5 6 7 8 9 10 11 12
POST https://{Endpoint}/v1/cloudimages/dataimages/action { "name": "fedora-data1", "image_url": "image-test:fedora_data1.qcow2", "description":"Data disk 1 of Fedora", "min_disk": 40, "tags": [ "aaa.111", "bbb.222" ], "os_type": "Linux" }
- Creating a data disk image with parameter image_tags using a file in an OBS bucket (file address in the bucket: image-test:fedora_data1.qcow2; OS: Linux; minimum size of the data disk: 40 GB)
1 2 3 4 5 6 7 8 9
POST https://{Endpoint}/v1/cloudimages/dataimages/action { "name": "fedora-data2", "image_url": "image-test:fedora_data1.qcow2", "description":"Data disk 2 of Fedora", "min_disk": 40, "image_tags": [{"key":"aaa","value":"111"},{"key":"bbb","value":"222"}], "os_type": "Linux" }
Response
- Response parameters
Parameter
Type
Description
job_id
String
Specifies the asynchronous job ID.
For details, see Querying the Status of an Asynchronous Job.
- Example response
STATUS CODE 200
1 2 3
{ "job_id": "4010a32b5f909853015f90aaa24b0015" }
Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
Request error. For details about the returned error code, see Error Codes.
401 Unauthorized
Authentication failed.
403 Forbidden
You do not have the rights to perform the operation.
404 Not Found
The requested resource was not found.
500 Internal Server Error
Internal service error.
503 Service Unavailable
The service is unavailable.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.