labs: option to set number of vCPUs for each node

Currently, all nodes get the default number of vCPUs (1). With this
patch, the number of vCPUs can be set in a node's configuration
file.

For the compute node, we set the number of vCPUs to 2.

Change-Id: I137be612bc6cb8f2d31adfd756404a9c6349e3c5
Implements: blueprint openstack-training-labs
This commit is contained in:
Roger Luethi 2014-08-19 11:30:48 +02:00
parent a9d74f1348
commit 354579813b
3 changed files with 12 additions and 0 deletions

View File

@ -10,3 +10,6 @@ FOURTH_OCTET=53
NET_IF_0=nat
NET_IF_1=MGMT_NET
NET_IF_2=DATA_NET
# Override number of virtual CPUs (default is 1)
VM_CPUS=2

View File

@ -291,6 +291,12 @@ function vm_mem {
$VBM modifyvm "$NAME" --memory "$MEM"
}
function vm_cpus {
local NAME="$1"
local CPUS="$2"
$VBM modifyvm "$NAME" --cpus "$CPUS"
}
# Port forwarding from host to VM (binding to host's 127.0.0.1)
function vm_port {
local NAME="$1"

View File

@ -50,6 +50,9 @@ function vm_build_node {
# Set VM_MEM in config/config.NODE_NAME to override
vm_mem "$NODE_NAME" "${VM_MEM:-512}"
# Set VM_CPUS in config/config.NODE_NAME to override
vm_cpus "$NODE_NAME" "${VM_CPUS:-1}"
_vbox_configure_ifs
# Port forwarding