This section describes how to convert the format of an image file on a Windows server and then quickly import it to the cloud platform. You are advised to use a local Windows PC for converting image formats and generating bitmap files.
In Windows, use the open-source tool qemu-img to convert image formats. qemu-img supports conversion between image files of the VHD, VMDK, QCOW2, RAW, VHDX, QCOW, VDI, and QED formats. Convert an image to the RAW format and then use the CreateMF.jar tool to generate a bitmap file.
For example, run the following command to convert an image.qcow2 file to an image.raw file:
qemu-img convert -p -O raw image.qcow2 image.raw
Tool Package | How to Obtain |
|---|---|
createMF.zip |
You can verify the installation by running cmd.exe and then java -version. If Java version information is displayed, JDK has been installed.
For example, if you have downloaded CreateMF.jar to D:/test, run the following commands to access the directory:
D:
cd test
java -jar CreateMF.jar D:/image01.raw D:/image01.mf
You must upload the RAW image file and its bitmap file to the same OBS bucket.
You can register a private image using the converted ZVHD2 or RAW file on the console or using an API.
Method 1: Register a private image on the console.
The IMS console is displayed.
For details about the parameters, see Registering an Image File as a Private Image.
Run the following command to check the system disk capacity in the image file:
qemu-img-hw info test.zvhd2
Method 2: Register a private image using an API.
The API is POST /v2/cloudimages/quickimport/action.
For details about how to call this API, see "Importing an Image File Quickly" in Image Management Service API Reference.