Skip to content

Deploy Libvirt

The first part of the compute kit is Libvirt.

Run the package deployment

Run the libvirt deployment Script bin/install-libvirt.sh

#!/bin/bash
# shellcheck disable=SC2124,SC2145,SC2294

# Directory to check for YAML files
CONFIG_DIR="/etc/genestack/helm-configs/libvirt"

pushd /opt/genestack/submodules/openstack-helm-infra || exit

# Base helm upgrade command
HELM_CMD="helm upgrade --install libvirt ./libvirt \
    --namespace=openstack \
    --timeout 120m"

# Add the base overrides file
HELM_CMD+=" -f /opt/genestack/base-helm-configs/libvirt/libvirt-helm-overrides.yaml"

# Check if YAML files exist in the specified directory
if compgen -G "${CONFIG_DIR}/*.yaml" > /dev/null; then
    # Append all YAML files from the directory to the helm command
    for yaml_file in "${CONFIG_DIR}"/*.yaml; do
        HELM_CMD+=" -f ${yaml_file}"
    done
fi

HELM_CMD+="${@}"

# Run the helm command
echo "Executing Helm command:"
echo "${HELM_CMD}"
eval "${HELM_CMD}"

popd || exit

Once deployed you can validate functionality on your compute hosts with virsh

kubectl exec -it $(kubectl get pods -l application=libvirt -o=jsonpath='{.items[0].metadata.name}' -n openstack) -n openstack -- virsh list