From 01fd98ff0d589e9c0d5981ca73bf6969de1dce4d Mon Sep 17 00:00:00 2001 From: dougbtv Date: Wed, 31 Jan 2018 09:44:55 -0500 Subject: [PATCH] [bugfix][minor] adds option to skip --cpus parameter for nested virt using qemu --- README.md | 11 +++++++++++ defaults/main.yml | 4 ++++ templates/spinup.sh.j2 | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99e7591..4d2b8b9 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,17 @@ image_destination_name: CentOS-7-x86_64-GenericCloud.qcow2 skip_virthost_depedencies: false ``` +#### Less frequently utilized options + +One less used option is in the case of nested virtualization and using QEMU, +you may need to work-around setting the vCPUs, and can do so by setting, which +will cause there to be no `--vcpus` flag set during `virt-install`. + +``` +nested_virt_qemu_skip_vcpus: true +``` + + ## License Apache v2.0 diff --git a/defaults/main.yml b/defaults/main.yml index 47bd41a..1d3735c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -22,6 +22,10 @@ virtual_machines: - name: kube-node-3 node_type: nodes +# With qemu and a nested virt situation one may +# need to skip specifying the vcpus +nested_virt_qemu_skip_vcpus: false + # Disk options ----------------------------------------- # Spare disk sizes (for virtual machines) diff --git a/templates/spinup.sh.j2 b/templates/spinup.sh.j2 index 6a42393..287915f 100644 --- a/templates/spinup.sh.j2 +++ b/templates/spinup.sh.j2 @@ -30,6 +30,7 @@ MEM=${2:-{{ system_default_ram_mb }}} # Number of virtual CPUs CPUS=${3:-{{ system_default_cpus }}} +{% if nested_virt_qemu_skip_vcpus %}#{% endif %}PARAM_VCPUS="--vcpus $CPUS" # Cloud init files USER_DATA=user-data @@ -104,11 +105,11 @@ _EOF_ echo "$(date -R) Installing the domain and adjusting the configuration..." echo "[INFO] Installing with the following parameters:" - echo "virt-install --import --name $1 --ram $MEM --vcpus $CPUS --disk \ + echo "virt-install --import --name $1 --ram $MEM $PARAM_VCPUS --disk \ $DISK,format=qcow2,bus=virtio --disk $CI_ISO,device=cdrom --network \ bridge={{ bridge_name }},model=virtio $net_ext --os-type=linux --os-variant=rhel6 --noautoconsole" - virt-install --import --name $1 --ram $MEM --vcpus $CPUS --disk \ + virt-install --import --name $1 --ram $MEM $PARAM_VCPUS --disk \ $DISK,format=qcow2,bus=virtio --disk $CI_ISO,device=cdrom --network \ bridge={{ bridge_name }},model=virtio $net_ext --os-type=linux --os-variant=rhel6 --noautoconsole