vcpus=$1
ramsize=$(($2*1024))
fi
- #start by generating the opening json for instackenv.json
- cat > $CONFIG/instackenv-virt.json << EOF
-{
- "nodes": [
+ #start by generating the opening yaml for the inventory-virt.yaml file
+ cat > $APEX_TMP_DIR/inventory-virt.yaml << EOF
+nodes:
EOF
# next create the virtual machines and add their definitions to the file
if [ "$ha_enabled" == "False" ]; then
- # 1 controller + computes
- # zero based so just pass compute count
- vm_index=$VM_COMPUTES
+ controller_index=0
else
+ controller_index=2
# 3 controller + computes
# zero based so add 2 to compute count
- vm_index=$((2+$VM_COMPUTES))
+ if [ $VM_COMPUTES -lt 2 ]; then
+ VM_COMPUTES=2
+ fi
fi
- for i in $(seq 0 $vm_index); do
+ for i in $(seq 0 $(($controller_index+$VM_COMPUTES))); do
+ if [ $i -gt $controller_index ]; then
+ capability="profile:compute"
+ else
+ capability="profile:control"
+ if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && "$ramsize" -lt 10240 ]]; then
+ echo "WARN: RAM per controller too low. OpenDaylight specified in HA deployment requires at least 10GB"
+ echo "INFO: Increasing RAM per controller to 10GB"
+ ramsize=10240
+ fi
+ fi
if ! virsh list --all | grep baremetal${i} > /dev/null; then
- define_vm baremetal${i} network 41 'admin_network' $vcpus $ramsize
- for n in private_network public_network storage_network api_network; do
+ define_vm baremetal${i} network 41 'admin' $vcpus $ramsize
+ for n in tenant external storage api; do
if [[ $enabled_network_list =~ $n ]]; then
echo -n "$n "
virsh attach-interface --domain baremetal${i} --type network --source $n --model virtio --config
fi
done
else
- echo "Found Baremetal ${i} VM, using existing VM"
+ echo "Found baremetal${i} VM, using existing VM"
fi
#virsh vol-list default | grep baremetal${i} 2>&1> /dev/null || virsh vol-create-as default baremetal${i}.qcow2 41G --format qcow2
- mac=$(virsh domiflist baremetal${i} | grep admin_network | awk '{ print $5 }')
-
- if [ "$VM_COMPUTES" -gt 0 ]; then
- capability="profile:compute"
- VM_COMPUTES=$((VM_COMPUTES - 1))
- else
- capability="profile:control"
- fi
+ mac=$(virsh domiflist baremetal${i} | grep admin | awk '{ print $5 }')
- cat >> $CONFIG/instackenv-virt.json << EOF
- {
- "pm_addr": "192.168.122.1",
- "pm_user": "root",
- "pm_password": "INSERT_STACK_USER_PRIV_KEY",
- "pm_type": "pxe_ssh",
- "mac": [
- "$mac"
- ],
- "cpu": "$vcpus",
- "memory": "$ramsize",
- "disk": "41",
- "arch": "x86_64",
- "capabilities": "$capability"
- },
+ cat >> $APEX_TMP_DIR/inventory-virt.yaml << EOF
+ node${i}:
+ mac_address: "$mac"
+ ipmi_ip: 192.168.122.1
+ ipmi_user: root
+ ipmi_pass: "INSERT_STACK_USER_PRIV_KEY"
+ pm_type: "pxe_ssh"
+ cpus: $vcpus
+ memory: $ramsize
+ disk: 41
+ arch: "x86_64"
+ capabilities: "$capability"
EOF
done
- #truncate the last line to remove the comma behind the bracket
- tail -n 1 $CONFIG/instackenv-virt.json | wc -c | xargs -I {} truncate $CONFIG/instackenv-virt.json -s -{}
-
- #finally reclose the bracket and close the instackenv.json file
- cat >> $CONFIG/instackenv-virt.json << EOF
- }
- ],
- "arch": "x86_64",
- "host-ip": "192.168.122.1",
- "power_manager": "nova.virt.baremetal.virtual_power_driver.VirtualPowerManager",
- "seed-ip": "",
- "ssh-key": "INSERT_STACK_USER_PRIV_KEY",
- "ssh-user": "root"
-}
-EOF
#Overwrite the tripleo-inclubator domain.xml with our own, keeping a backup.
if [ ! -f /usr/share/tripleo/templates/domain.xml.bak ]; then
/usr/bin/mv -f /usr/share/tripleo/templates/domain.xml /usr/share/tripleo/templates/domain.xml.bak