devtest_testenvΒΆ

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

JSONFILE=${1:-''}
  1. Configure a network for your test environment. This configures an openvswitch bridge and teaches libvirt about it.

    setup-network
    
  2. 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.

    setup-seed-vm -a $NODE_ARCH
  3. 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 either run clean-env and then recreate with more nodes, or use create-nodes to make more nodes then add their macs to your testenv.json.

    NODE_CNT=$(( $OVERCLOUD_COMPUTESCALE + 2 ))
    MACS=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH $NODE_CNT | tr '\r\n' ' ')
  4. What IP address to ssh to for virsh operations.

    HOSTIP=${HOSTIP:-192.168.122.1}
  5. 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:-''}
  6. 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
  7. Finally wrap this all up into JSON.

    python -c "import json, sys, os; json.dump({'arch':'$NODE_ARCH', 'host-ip':'$HOSTIP', 'power_manager':'$POWER_MANAGER', 'seed-ip':'$SEEDIP', 'node-macs':'$MACS', 'ssh-key': open(os.path.expanduser('~/.ssh/id_rsa_virt_power'), 'rt').read(), 'ssh-user':'`whoami`'}, sys.stdout)" > $JSONFILE

Previous topic

devtest_setup

Next topic

devtest_ramdisk

This Page