Add VM setup documentation for Cyborg development

Add documentation for creating development VMs using virsh command from
provided vm Cyborg xml file for testing and driver development.
This provides a foundation for contributors who don't have access
to physical hardware.

New documentation:
- vm-setup.rst: Step-by-step guide for creating VMs with virsh command,
  including host prerequisites, VM creation, Ubuntu installation, and
  post-installation configuration
- devstack/cyborg_vm.xml: Basic reference VM XML definition for users
  to recreate the environment.

The VM is configured with Q35 machine type and
host-passthrough CPU for nested virtualization support. Driver-specific
device configuration (NVMe, GPU, FPGA) can be added after following this
guide.

Generated-By: Claude Sonnet 4.6
Change-Id: Ic067ac0792c5e9598cebf70ea6fa35463136bfb6
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Chandan Kumar (raukadah) committed 2026-05-13 14:31:29 +05:30
1 parent 186cdd2b76
commit e58289918a
4 files changed
+474 -1

No files matched your search

+131
View File
@@ -0,0 +1,131 @@
<domain type='kvm'>
<name>cyborg-devstack</name>
<uuid>f689c33c-774a-4a16-933f-d697ef66c464</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://ubuntu.com/ubuntu/24.04"/>
</libosinfo:libosinfo>
</metadata>
<memory unit='KiB'>12582912</memory>
<currentMemory unit='KiB'>12582912</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-10.1'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/cyborg-devstack_VARS.fd</nvram>
</os>
<features>
<acpi/>
<apic/>
<ioapic driver='qemu'/>
</features>
<cpu mode='host-passthrough' check='none' migratable='on'/>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/devstack.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='sda' bus='sata'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0' model='qemu-xhci' ports='15'>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</controller>
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x10'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
</controller>
<controller type='pci' index='2' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='2' port='0x11'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
</controller>
<controller type='pci' index='3' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='3' port='0x12'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
</controller>
<controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='4' port='0x13'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
</controller>
<controller type='pci' index='5' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='5' port='0x14'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
</controller>
<controller type='pci' index='6' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='6' port='0x15'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
</controller>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:df:1c:96'/>
<source network='default'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='unix'>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='tablet' bus='usb'>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<audio id='1' type='none'/>
<video>
<model type='virtio' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<watchdog model='itco' action='reset'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
</memballoon>
<rng model='virtio'>
<rate bytes='1024' period='1000'/>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
</rng>
</devices>
</domain>
+1 -1
View File
@@ -25,7 +25,7 @@ LOGDAYS=2
disable_service swift
# etcd is only needed by cinder backup
disable_service etcd
# Cinder is not required for basic Cyborg testing;
# Cinder is not required for basic Cyborg testing.
disable_service cinder
# Horizon is not required for Cyborg
disable_service horizon
+3
View File
@@ -28,6 +28,8 @@ Reviewing
* :doc:`/contributor/devstack_setup`: DevStack setup guide for Cyborg
development
* :doc:`/contributor/vm-setup`: Creating development VMs for testing
* :doc:`/contributor/driver-development-guide`: Get your driver development
guide to contribute
@@ -41,5 +43,6 @@ Reviewing
microversions
releasenotes
devstack_setup
vm-setup
driver-development-guide
release-guide
+339
View File
@@ -0,0 +1,339 @@
====================================
Creating Development VMs for Testing
====================================
Overview
========
This guide provides instructions for creating a development virtual machine
(VM) for Cyborg testing and development. This is useful when you don't have
access to physical hardware with accelerator devices, or when you want to
test in an isolated environment.
The VM created using these instructions provides a foundation suitable for
Cyborg development with emulated devices like Nvme and passthrough scenarios.
Prerequisites
=============
Before creating a development VM, ensure you have:
* A Linux host system with sufficient resources (16GB+ RAM, 100GB+ disk space)
* Nested virtualization and IOMMU support enabled
* Basic DevStack knowledge (see :doc:`/contributor/devstack_setup`)
When to Use This Guide
======================
Use this guide when you need to:
* Create a VM for Cyborg development without physical accelerator hardware
* Test Cyborg with emulated devices (NVMe, GPU, etc.)
* Set up an isolated development environment
**Note:** If you already have a physical or cloud-based server with Ubuntu
installed, you can skip this guide and proceed directly to
:doc:`/contributor/devstack_setup`.
Host System Requirements
========================
Nested Virtualization Support
-----------------------------
Your host system must support nested virtualization to run VMs inside the
development VM, and nested virtualization must also be enabled **inside the
development VM** for nova instances to use KVM acceleration under DevStack.
For full setup instructions, including how to make the configuration
persistent across reboots, refer to the
`official DevStack nested virtualization guide <https://docs.openstack.org/devstack/latest/guides/devstack-with-nested-kvm.html>`_.
Host IOMMU Configuration (Optional)
-----------------------------------
.. note::
**You only need to configure host IOMMU if:**
* You are installing DevStack directly on the host (not in a VM), OR
* You are passing a physical host device to the DevStack VM (PCI passthrough)
**You do NOT need host IOMMU** to use vIOMMU (virtual IOMMU) inside the guest
VM. The VM configuration in this guide already includes vIOMMU support via
the Q35 machine type.
If you need to pass physical devices from your host to the VM, enable IOMMU
on the host system:
Check if IOMMU is enabled in your kernel:
.. code-block:: console
$ sudo dmesg | grep -e IOMMU -e DMAR
You should see messages indicating IOMMU/DMAR is enabled. If not, you may need
to enable it in your BIOS/UEFI settings and add kernel parameters.
To enable IOMMU on the **host**, edit your bootloader configuration:
.. code-block:: console
$ sudo vim /etc/default/grub
# For Intel processors: add intel_iommu=on iommu=pt
# For AMD processors: add amd_iommu=on iommu=pt
Update GRUB and reboot:
.. code-block:: console
$ sudo update-grub
$ sudo reboot
Install Required Packages on Host
---------------------------------
Install QEMU, libvirt, and related tools:
On Ubuntu/Debian:
.. code-block:: console
$ sudo apt update
$ sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients \
bridge-utils virt-manager virt-viewer virtinst ovmf
On Fedora/RHEL:
.. code-block:: console
$ sudo dnf install -y qemu-kvm libvirt virt-manager virt-viewer \
virt-install edk2-ovmf
Add your user to the libvirt group:
.. code-block:: console
$ sudo usermod -aG libvirt $USER
$ newgrp libvirt
Verify the installation:
.. code-block:: console
$ sudo virsh list --all
$ sudo systemctl status libvirtd
Download Ubuntu Server Image
============================
Download the Ubuntu 24.04 LTS server ISO:
.. code-block:: console
$ cd /var/lib/libvirt/images/
$ sudo wget https://releases.ubuntu.com/24.04/ubuntu-24.04.4-live-server-amd64.iso
Create VM Using virsh
=====================
Create VM Disk Image
--------------------
Create a 50GB qcow2 disk image for the VM (25–50GB is sufficient for a
standard DevStack all-in-one setup; increase if you need extra space for
driver-specific devices such as NVMe emulation):
.. code-block:: console
$ sudo qemu-img create -f qcow2 /var/lib/libvirt/images/devstack.qcow2 50G
Prepare VM Configuration
------------------------
The Cyborg repository includes a VM XML definition at
``devstack/cyborg_vm.xml``. Copy it and customize for your environment:
.. code-block:: console
$ cd <cyborg-repo>
$ cp devstack/cyborg_vm.xml /tmp/cyborg-devstack.xml
Edit ``/tmp/cyborg-devstack.xml`` to customize:
* **Memory**: Adjust the ``<memory>`` value based on your system
(default: 12GB)
* **CPUs**: Adjust the ``<vcpu>`` count based on availability (default: 4)
* **Disk path**: Update the disk ``<source file>`` path to match your disk
location
* **Disk size**: You can create a larger/smaller disk as needed
Define and Start VM
-------------------
Define the VM in libvirt:
.. code-block:: console
$ sudo virsh define /tmp/cyborg-devstack.xml
Insert the Ubuntu installation ISO into the CDROM device:
.. code-block:: console
$ sudo virsh change-media cyborg-devstack sda \
/var/lib/libvirt/images/ubuntu-24.04.4-live-server-amd64.iso --insert
Start the VM and connect to the console:
.. code-block:: console
$ sudo virsh start cyborg-devstack
$ virt-viewer --connect qemu:///system --wait cyborg-devstack
The VM uses UEFI firmware (OVMF) via ``/usr/share/OVMF/OVMF_CODE.fd``,
which is provided by the ``ovmf`` (Ubuntu) or ``edk2-ovmf`` (Fedora)
package. When you start the VM with the ISO inserted, UEFI will boot the
Ubuntu installer from the CDROM. After installation, UEFI writes a boot
entry for the installed system to NVRAM and will boot from the hard disk
automatically on subsequent reboots.
Complete Ubuntu Installation
----------------------------
Follow the Ubuntu Server installation wizard in the console window (see the
Ubuntu Installation section below for detailed steps).
Ubuntu Installation
-------------------
Follow the Ubuntu Server installation wizard:
1. Select language: English
2. Base of installation: Ubuntu Server
3. Configure network (use DHCP or configure static IP)
4. Skip proxy address configuration
5. Wait for Ubuntu archive mirror configuration
6. Guided storage configuration: Use entire disk
7. Continue with storage configuration
8. Profile configuration:
- Server name: ``cyborg-devstack``
- Pick a username and password (using ``stack`` is recommended for
consistency with DevStack conventions)
- Enable "Install OpenSSH server"
- Import SSH key (optional)
9. Wait for installation to complete and reboot.
When the installation completes, eject the ISO before rebooting:
.. code-block:: console
$ sudo virsh change-media cyborg-devstack sda --eject
$ sudo virsh reboot cyborg-devstack
UEFI will boot from the installed Ubuntu system on the hard disk.
Key VM Features
---------------
The VM defined in the XML configuration includes these key features:
* **Q35 machine type**: Required for IOMMU and PCIe device passthrough
* **host-passthrough CPU**: Provides nested virtualization support
* **12GB RAM, 4 vCPUs** (as defined in the XML): Minimum is 8GB RAM and
4 vCPUs for an all-in-one DevStack node; 8 vCPUs is recommended
* **UEFI firmware (OVMF)**: Manages boot order via NVRAM; boots the installer
ISO on first start, then automatically boots the installed system after
the ISO is ejected
After installation, you can add driver-specific devices (such as NVMe
controllers, GPUs, etc.) as needed. Refer to the respective driver
documentation for device-specific setup.
.. note::
The VM configuration used in this guide is based on the XML definition at
``<cyborg-repo>/devstack/cyborg_vm.xml``. This file can be customized further
for driver-specific device additions.
Post-Installation Configuration
===============================
After the VM reboots, log in through the console or SSH.
Find VM IP Address
------------------
From the host system, find the VM's IP address:
.. code-block:: console
$ sudo virsh domifaddr cyborg-devstack
Name MAC address Protocol Address
-------------------------------------------------------------------------------
vnet0 52:54:00:df:1c:96 ipv4 192.168.122.100/24
SSH Access
----------
SSH to the VM from your host:
.. code-block:: console
$ ssh stack@192.168.122.100
Configure Passwordless sudo
---------------------------
For DevStack to work properly, configure passwordless sudo:
.. code-block:: console
$ echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER
System Update
-------------
Update the system packages:
.. code-block:: console
$ sudo apt update
$ sudo apt upgrade -y
Hostname Resolution
-------------------
Add the VM hostname to ``/etc/hosts`` for proper name resolution:
.. note:: Replace below ip with vm ip.
.. code-block:: console
$ echo "<ip> $(hostname)" | sudo tee -a /etc/hosts
Verify that host ip address is displayed:
.. code-block:: console
$ hostname -i
<vm ip>
Next Steps
==========
Your base development VM is now ready. The typical workflow is:
1. **Install DevStack**: Follow :doc:`/contributor/devstack_setup` to install
OpenStack with Cyborg enabled.
References
==========
* :doc:`/contributor/devstack_setup` - DevStack setup guide for Cyborg
* `libvirt Domain XML format <https://libvirt.org/formatdomain.html>`_
* `QEMU Machine Types <https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-5>`_
* `DevStack with nested KVM <https://docs.openstack.org/devstack/latest/guides/devstack-with-nested-kvm.html>`_