Creating an Image from an ISO File
Scenarios
An ISO file is a disk image of an optical disc. A large number of data files can be compressed into a single ISO file. Likewise, to access the files stored in an ISO, the ISO file needs to be decompressed. For example, you can use a virtual CD-ROM to open an ISO file, or burn the ISO file to a CD or DVD and then use the CD-ROM to read the image.
This section describes how to use APIs to create a private image from an ISO file.
Involved APIs
If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the IMS API when making an API call.
Procedure
- Obtain the token by referring to Authentication.
- Create a private image using an ISO image file uploaded to the OBS bucket.
- Send POST https://IMS endpoint/v2/cloudimages/action.
- Add X-Auth-Token to the request header.
- Set the following parameters in the request body:
For details about the parameters, see Creating an Image.
{ "name": "ims_test_file", //Image name (mandatory, string) "description": "Image creation using an image file uploaded to the OBS bucket", //Image description (optional, string) "image_url": "ims-image:centos70.iso", //Image file address in an OBS bucket (mandatory, string) "os_type": "Linux", //OS type (optional, string) "os_version": "CentOS 7.0 64bit", //OS version (mandatory, string) "type": "IsoImage", //Image type (mandatory, string) "min_disk": 40, //Minimum system disk space (mandatory, integer) "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] //Image tags (optional, array of objects) }
- Obtain the image ID by querying job details based on the returned job_id. For details, see Querying the Status of an Asynchronous Job.
- Create a temporary ECS from the ISO image.
- You can select only a general-computing flavor with 2 vCPUs, 4 GB or more memory, and KVM virtualization type.
- You need to create a system disk and a data disk for the ECS. The OS will be installed on the data disk by default.
- Send POST https://ECS endpoint/v1/project_id/cloudservers.
- Add X-Auth-Token to the request header.
- Set the following parameters in the request body:
The following parameters are all mandatory. For details about the parameters, see "Creating an ECS" in Elastic Cloud Server API Reference.
{ "server": { "imageRef": "fac42d61-ea1e-4271-94ba-6543a852d2c6", //Image ID "flavorRef": "rc6.large.2_manage", "name": "instance-test", "vpcid": "18ec99f0-7159-4d7b-ad27-f32315d5af61", "nics": [{ "subnet_id": "81a4ecb0-0451-4c60-8373-8b923238ec40" }], "root_volume": { "volumetype": "SATA", "size": "40" }, "data_volumes": [{ "volumetype": "SATA", "size": "40" }], "availability_zone": "az-1a", "metadata": { "virtual_env_type": "IsoImage" }, "extendparam": { "diskPrior": "true" } } }
- Obtain the ECS ID by querying job details based on the returned job_id. For details, see "Querying Task Execution Status" in Elastic Cloud Server API Reference.
- Query ECS details based on the ECS ID to obtain the data disk ID (volume_id) required in 4. For details, see "Querying Details About an ECS" in Elastic Cloud Server API Reference.
- Use the temporary ECS to create a standard private image.
- Send POST https://IMS endpoint/v2/cloudimages/action.
- Add X-Auth-Token to the request header.
- Set the following parameters in the request body:
For details about the parameters, see Creating an Image.
{ "name": "ims_test", //Image name (a mandatory string) "description": "Creating a system disk image from a data disk", //Image description (optional, string) "volume_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a", //Data disk ID (mandatory, string) "type": "ECS", //Image type (mandatory, string) "os_version": "CentOS 7.0 64bit", //OS version (mandatory, string) "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}] //Image tags (optional, array of objects) }
- Obtain the image ID by querying job details based on the returned job_id. For details, see Querying the Status of an Asynchronous Job.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot