Quickly Importing an Image File (Windows)
Scenarios
This section describes how to quickly import an image file in Windows. You are advised to use a local PC running Windows 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. Therefore, 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 or Optimization Process. In addition, ensure that the image file meets the requirements in Table 1 or Table 1.
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 downloaded.
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 performing the following operation:
Run 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 the bitmap file corresponding to the image file in the RAW format:
- Obtain the CreateMF.jar package and decompress it.
- Use OBS Browser to upload files to the 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: Create a private image on the console.
- Log in to the management console.
- Under Computing, 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 System disk image or Data disk image for Type.
- Select Image File for Source. 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, ensure that the image file has been optimized, and select the sentence following Image File Preparation. Figure 1 Importing an image file quickly
- Set parameters as prompted.
For details about the parameters, see Registering an External Image File as a Private Image and Registering an External Image File as a Private Image.
Method 2: Create a private image using an API.
You can use the POST /v2/cloudimages/quickimport/action API to quickly import an image file.
For details about how to call this API, see Importing an Image File Quickly.
Last Article: Quickly Importing an Image File (Linux)
Next Article: Managing Private Images
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.