Configure persistent virtualization with libvirt and bcvk

Use libvirt with bcvk to gain the stability and control required for production. This configuration maintains system state across reboots and provides granular resource allocation to ensure that your bootable images mirror the performance and constraints of target hardware.

Before you begin

  • You have installed the bcvk utility on the host system.
  • You have installed, enabled, and started the libvirtd daemon.
  • You have permissions to manage libvirt domains. The typical membership in the libvirt group.
  • You have access to the registry.redhat.io container registry.

To configure persistent virtualization, complete the following steps.

Procedure

  1. Create a persistent libvirt VM by using one of the following methods:
    • To create a basic VM with default settings:

      The libvirt run command automates VM provisioning, including networking and SSH configuration.

      $ bcvk libvirt run registry.redhat.io/rhel10/rhel-bootc:latest
    • To create a customized VM with specific resource constraints:

      Use flags to define the name, memory (in MB), CPU count, and disk size (in GB).

      $ bcvk libvirt run --name dev-vm --memory 4096 --cpus 4 --filesystem btrfs --disk-size 50G registry.redhat.io/rhel10/rhel-bootc:latest
  2. After the VM is provisioned, manage its state by using the bcvk libvirt subcommands:
    Task Command

    List VMs

    bcvk libvirt list

    Start a VM

    bcvk libvirt start <vm_name>

    Stop a VM

    bcvk libvirt stop <vm_name>

    Remove a VM

    bcvk libvirt rm -f <vm_name>

    Access by SSH

    bcvk libvirt ssh <vm_name>

    Important

    The bcvk utility handles secure access by injecting SSH keys using systemd credentials. The private key generated during the provisioning process is unique to which specific VM and is stored securely within the domain metadata. For production environments or longer-term development, bcvk integrates directly with libvirt.