devtest_testenvΒΆ

Note

This script is usually called from devtest.sh as devtest_testenv.sh $TE_DATAFILE

JSONFILE=${1:-''}
  1. Set HW resources for VMs used as ‘baremetal’ nodes. NODE_CPU is cpu count, NODE_MEM is memory (MB), NODE_DISK is disk size (GB), NODE_ARCH is architecture (i386, amd64). NODE_ARCH is used also for the seed VM. A note on memory sizing: TripleO images in raw form are currently ~2.7Gb, which means that a tight node will end up with a thrashing page cache during glance -> local + local -> raw operations. This significantly impairs performance. Of the four minimum VMs for TripleO simulation, two are nova baremetal nodes (seed and undercloud) and these need to be 2G or larger. The hypervisor host in the overcloud also needs to be a decent size or it cannot host more than one VM.

    ##

    32bit VMs

    ##
    NODE_CPU=1 NODE_MEM=2048 NODE_DISK=30 NODE_ARCH=i386
    ##
    

    For 64bit it is better to create VMs with more memory and storage because of increased memory footprint:

    ##
    NODE_CPU=1 NODE_MEM=2048 NODE_DISK=30 NODE_ARCH=amd64
    ##
    
  2. Configure a network for your test environment. This configures an openvswitch bridge and teaches libvirt about it.

    setup-network $NUM
    
  3. Configure a seed VM. This VM has a disk image manually configured by later scripts, and hosts the statically configured seed which is used to bootstrap a full dynamically configured baremetal cloud.

    BRIDGE=
    SEED_ARGS="-a $NODE_ARCH"
    if [ -n "$NUM" -a -n "$OVSBRIDGE" ]; then
        BRIDGE="brbm${NUM}"
        SEED_ARGS="$SEED_ARGS -o seed_${NUM} -b $BRIDGE -p $OVSBRIDGE"
    fi
    setup-seed-vm $SEED_ARGS
    
  4. What user will be used to ssh to run virt commands to control our emulated baremetal machines.

    SSH_USER=$(whoami)
    
  5. What IP address to ssh to for virsh operations.

    HOSTIP=${HOSTIP:-192.168.122.1}
    
  6. If a static SEEDIP is in use, define it here. If not defined it will be looked up in the ARP table by the seed MAC address during seed deployment.

    SEEDIP=${SEEDIP:-''}
    
  7. Set the default bare metal power manager. By default devtest uses nova.virt.baremetal.virtual_power_driver.VirtualPowerManager to support a fully virtualized TripleO test environment. You may optionally customize this setting if you are using real baremetal hardware with the devtest scripts. This setting controls the power manager used in both the seed VM and undercloud for Nova Baremetal.

    POWER_MANAGER=${POWER_MANAGER:-'nova.virt.baremetal.virtual_power_driver.VirtualPowerManager'}
    
  8. Ensure we can ssh into the host machine to turn VMs on and off. The private key we create will be embedded in the seed VM, and delivered dynamically by heat to the undercloud VM.

    # generate ssh authentication keys if they don't exist
    if [ ! -f ~/.ssh/id_rsa_virt_power ]; then
        ssh-keygen -t rsa -N "" -C virtual-power-key -f ~/.ssh/id_rsa_virt_power
    fi
    
    # make the local id_rsa_virt_power.pub be in ``.ssh/authorized_keys`` before
    # that is copied into images via ``local-config``
    if ! grep -qF "$(cat ~/.ssh/id_rsa_virt_power.pub)" ~/.ssh/authorized_keys; then
        cat ~/.ssh/id_rsa_virt_power.pub >> ~/.ssh/authorized_keys
        chmod 0600 ~/.ssh/authorized_keys
    fi
    
  9. Wrap this all up into JSON.

    jq "." <<EOF > $JSONFILE
    {
        "arch":"$NODE_ARCH",
        "host-ip":"$HOSTIP",
        "power_manager":"$POWER_MANAGER",
        "seed-ip":"$SEEDIP",
        "ssh-key":"$(cat ~/.ssh/id_rsa_virt_power)",
        "ssh-user":"$SSH_USER"
    }
    EOF
    
  10. If you have an existing set of nodes to use, use them.

    JSON=$(jq -s '.[0].nodes=.[1] | .[0]' $JSONFILE $NODES_PATH)
    echo "${JSON}" > $JSONFILE
    
  11. Create baremetal nodes for the test cluster. The final parameter to create-nodes is the number of VMs to create. To change this in future you can run clean-env and then recreate with more nodes.

    NODE_CNT=$(( $OVERCLOUD_COMPUTESCALE + 2 ))
    create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH $NODE_CNT $SSH_USER $HOSTIP $JSONFILE $BRIDGE
    

Previous topic

devtest_setup

Next topic

devtest_ramdisk

This Page