我要评分
获取效率
正确性
完整性
易理解

Creating a QCOW2 Image for a cVM

This section describes how to create a QCOW2 image, which is required for starting a cVM.

  1. Install the dependencies.
    yum install dnf-plugins-core grub2-efi-aa64-modules libguestfs-tools qemu-img virt-install guestfs-tools cloud-utils-growpart nbdkit ncurses-devel openssl-devel elfutils-libelf-devel dwarves
    yum groupinstall "Development Tools"
  2. Pull the script file.
    git clone https://gitee.com/openeuler/virtCCA_sdk.git
    cd virtCCA_sdk/cvm-image-rewriter/
  3. Check that libvirtd is installed and start it. For details about how to install libvirtd, see Deploying Libvirt.
    systemctl start libvirtd
  4. After the libvirtd startup process is complete, check the libvirtd status. If the status is "active (running)", libvirtd has been started successfully.
    systemctl status libvirtd

  5. After executing the create-oe-image.sh script, a QCOW2 image and the cVM image measurement baseline value file image_reference_measurement.json are generated in the current script directory.
    export LIBGUESTFS_BACKEND=direct
    sh create-oe-image.sh -v 24.03-LTS-SP2  -s 10

    The create-oe-image.sh script supports two modes: image creation mode and measurement mode.

    • Image creation mode
      • -v: Set the version.
      • -p: sets the root password for the image.
      • -s: (Optional) Expand the image space. If you do not set this parameter, an additional 40 GB can be added by default. By default, the /var/tmp folder is used for space expansion. If the script reports an insufficient space, you can run the following command to replace this folder with a folder that has a sufficient space.
        export TMPDIR=/home/xxx

      • -o: (Optional) Set the image output path. If you do not set this parameter, the current script path is used by default.
      • -f: (Optional) Re-execute the script forcibly and delete the downloaded files.
      • -k: (Optional) Compile and install the KAE driver.
    • Measurement mode:

      -i: measures a specified image. After the measurement is complete, the cVM image measurement baseline value file image_reference_measurement.json is generated in the current directory of the script.

      Example:

      sh create-oe-image.sh -i /home/xxx.qcow2

      The script cannot specify both the image creation mode and the measurement mode at the same time. Only one of these modes can be selected per execution.