Fast Import in Windows
Scenarios
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.
Prerequisites
- The image file has been optimized. For details, see Optimization Process (Windows) or Optimization Process (Linux). Ensure that the image file meets the requirements in Table 2 (Windows) or Table 2 (Linux).
Select the reference content based on the OS type in the image file.
- An OBS bucket has been created on the management console, and OBS Browser+ has been ready.
Procedure
- Install the open-source image conversion tool qemu-img. For details, see Converting the Image Format Using qemu-img.
- Run the cmd command to go to the qemu-img installation directory and run the qemu-img command to convert the image file to the RAW format.
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
- Use CreateMF.jar to generate a bitmap file.
- Obtain the CreateMF.jar package and decompress it.
Table 1 CreateMF.jar package Tool Package
How to Obtain
createMF.zip
https://cn-south-1-cloud-reset-pwd.obs.cn-south-1.myhuaweicloud.com/imageImportTools/createMF.zip
- Ensure that JDK has been installed in the current environment.
You can verify the installation by running cmd.exe and then java -version. If Java version information is displayed, JDK has been installed.
- Go to the directory where CreateMF.jar is stored.
For example, if you have downloaded CreateMF.jar to D:/test, run the following commands to access the directory:
D:
cd test
- Run the following command to generate a bitmap file for the RAW image file:
java -jar CreateMF.jar D:/image01.raw D:/image01.mf
- The generated .mf bitmap file must have the same name as the RAW image file. For example, if the image file name is image01.raw, the generated bitmap name is image01.mf.
- Obtain the CreateMF.jar package and decompress it.
- Use OBS Browser+ to upload the converted image file and its bitmap file to an OBS bucket.
You must upload the RAW image file and its bitmap file to the same OBS bucket.
- Register a private image.
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.
- Access the IMS console.
- Log in to the management console.
- Under Compute, click Image Management Service.
The IMS console is displayed.
- In the upper right corner, click Create Image.
- In the Image Type and Source area, select Import Image for Type and then select System disk image or Data disk image for Image Type.
- Select the bucket storing the ZVHD2 or RAW image file and then select the image file. If the image file is in the RAW format, you also need to select its bitmap file.
- Select Enable Fast Create, and select the sentence following Image File Preparation.
Figure 1 Fast import of an image file
- Set parameters as prompted.
For details about the parameters, see Registering an External Image File as a Private Image.
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.
- Access the IMS console.
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