Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix][minor] adds option to skip --cpus parameter for nested virt with qemu #8

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions templates/spinup.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down