VK Cloud logo

Creating an image with diskimage-builder

The list of supported images is available in the official documentation of the diskimage-builder utility.

As an example, this guide covers creating and configuring a VM image with the OpenSuse Leap OS. All actions are performed on a local computer running Ubuntu.

Preparatory steps

  1. Free up at least 3 GB of disk space on your computer.
  2. Connect your computer to a network with internet access.

1. Install the required software

  1. Set up Python library support:

    sudo apt updatesudo apt -y install python-pip curl
  2. Install the qemu-utils package, which provides QEMU utilities:

    sudo apt install qemu-utils
  3. Install the virtualenv application for creating a Python virtual environment, as described in the official documentation.

  4. Find out the version of Python installed on your computer:

    python –version
  5. Create and activate a Python virtual environment by running the commands one by one:

    virtualenv -p python<PYTHON_VERSION> venv_py<PYTHON_VERSION>source venv_py<PYTHON_VERSION>/bin/activate
  6. Install the diskimage-builder utility:

    pip install git+https://opendev.org/openstack/diskimage-builder.git

2. Build a VM image with the OpenSuse Leap OS

Run the command:

DIB_RELEASE=15.3 disk-image-create -t raw -o opensuse-15.3.raw vm opensuse

A file named opensuse-15.3.raw with a VM image in RAW format will be created.

3. Upload the image to VK Cloud

  1. Make sure that the OpenStack client is installed and pass authentication in your VK Cloud project.

  2. Upload the opensuse-15.3.raw image to VK Cloud under the name Opensuse:

    openstack image create \    --progress \    --private \    --container-format bare \    --disk-format raw \    --file opensuse-15.3.raw \    --property store=s3 \    --property hw_qemu_guest_agent=True \    --property os_require_quiesce=yes \    --property mcs_name='Opensuse' \    Opensuse

    Here, arguments of the form --property <KEY>=<VALUE> are used to assign {metadata tags to the image.

4. Verify that the image was uploaded successfully

  1. Go to the VK Cloud management console.
  2. Navigate to the Cloud Computing → Images section.
  3. Make sure that the list contains an image named Opensuse.

Delete unused resources

If you no longer need the uploaded image, delete it.

Was this article helpful?