Switch to using a $NODES_JSON to register nodes

This commit is contained in:
James Slagle 2014-09-18 09:01:21 -04:00
parent b71e7e85e2
commit cb10e5a397
6 changed files with 8 additions and 64 deletions

View File

@ -1,12 +1,4 @@
#!/bin/bash
export CPU=1
export MEM=3072
export DISK=30
export ARCH=amd64
export MACS=""
export PM_IPS=""
export PM_USERS=""
export PM_PASSWORDS=""
export NeutronPublicInterface=em2
export OVERCLOUD_LIBVIRT_TYPE=kvm
export NETWORK_CIDR="10.0.0.0/8"

View File

@ -1,8 +1,5 @@
#!/bin/bash
export CPU=1
export MEM=3072
export DISK=30
export ARCH=amd64
export NODES_JSON=instackenv.json
export NeutronPublicInterface=eth0
export OVERCLOUD_LIBVIRT_TYPE=qemu
export NETWORK_CIDR=10.0.0.0/8
@ -11,24 +8,6 @@ export FLOATING_IP_END=192.0.2.64
export FLOATING_IP_CIDR=192.0.2.0/24
export NEUTRON_NETWORK_TYPE=gre
export NEUTRON_TUNNEL_TYPES=gre
export MACS=""
export COMPUTESCALE=1
export BLOCKSTORAGESCALE=1
export SWIFTSTORAGESCALE=1
### VIRTUAL_POWER_USER ###
# The user to use to connect to VIRTUAL_POWER_HOST.
# This is a user on your virsh host.
export VIRTUAL_POWER_USER=stack
### VIRTUAL_POWER_HOST ###
# The virsh host to use for Overcloud instances.
export VIRTUAL_POWER_HOST=192.168.122.1
### SSH_KEY ###
# The ssh key to use to ssh to the virsh host. This should be a path to an ssh
# private key. The public key portion must be added to the
# ~/.ssh/authorized_keys file for the virtual power user on the virt host. If
# instack-virt-setup was used, this key already exists and has already been
# copied to the virt host.
export SSH_KEY=/home/stack/.ssh/id_rsa_virt_power

View File

@ -13,7 +13,8 @@ fi
file_list="$HOME/.ssh/id_rsa_virt_power
$HOME/.ssh/id_rsa_virt_power.pub
/tmp/deploy-virt-overcloudrc
$ANSWERSFILE"
$ANSWERSFILE
$TE_DATAFILE"
for f in $file_list; do
cp "$f" "$TMP_HOOKS_PATH"
done

View File

@ -10,6 +10,7 @@ cp /tmp/in_target.d/id_rsa_virt_power /home/stack/.ssh/id_rsa_virt_power
cp /tmp/in_target.d/id_rsa_virt_power.pub /home/stack/.ssh/id_rsa_virt_power.pub
cp /tmp/in_target.d/deploy-virt-overcloudrc /home/stack/deploy-overcloudrc
cp /tmp/in_target.d/instack.answers.sample /home/stack/instack.answers
cp /tmp/in_target.d/$TE_DATAFILE /home/stack/instackenv.json
chown -R stack:stack /home/stack

View File

@ -10,44 +10,14 @@ fi
# setup-baremetal requires this to be set
export TRIPLEO_ROOT=.
CPU=${CPU:-1}
MEM=${MEM:-3072}
DISK=${DISK:-30}
ARCH=${ARCH:-amd64}
MACS=${MACS:-"52:54:00:b5:bd:f0 52:54:00:f2:be:f0"}
VIRTUAL_POWER_USER=${VIRTUAL_POWER_USER:-$USER}
VIRTUAL_POWER_HOST=${VIRTUAL_POWER_HOST:-"192.168.122.1"}
SSH_KEY=${SSH_KEY:-""}
export NODES_JSON=${NODES_JSON:-"instackenv.json"}
PM_IPS=( ${PM_IPS:-} )
PM_USERS=( ${PM_USERS:-} )
PM_PASSWORDS=( ${PM_PASSWORDS:-} )
export USE_IRONIC=1
export ROOT_DISK=${ROOT_DISK:-10}
JSONFILE=nodes.json
rm -f $JSONFILE
echo '{}' > $JSONFILE
JSON=$(jq .nodes=[] $JSONFILE)
count=0
for mac in $MACS; do
if [ -n "${PM_IPS:-}" -a -n "${PM_USERS:-}" -a -n "${PM_PASSWORDS:-}" ]; then
JSON=$(jq ".nodes=(.nodes + [{mac:[\"$mac\"], cpu:\"$CPU\", memory:\"$MEM\", disk:\"$DISK\", arch:\"$ARCH\", pm_user:\"$PM_USERS[$count]\", pm_addr:\"$PM_IPS[$count]\", pm_password:\"$PM_PASSWORDS[$count]\", pm_type:\"ipmi\"}])" <<< $JSON)
else
if [ ! -f "$SSH_KEY" ]; then
echo \$SSH_KEY must be the full file path to the virtual power key
exit 1
fi
JSON=$(jq ".nodes=(.nodes + [{mac:[\"$mac\"], cpu:\"$CPU\", memory:\"$MEM\", disk:\"$DISK\", arch:\"$ARCH\", pm_user:\"$VIRTUAL_POWER_USER\", pm_addr:\"$VIRTUAL_POWER_HOST\", pm_password:\"$(cat $SSH_KEY)\", pm_type:\"pxe_ssh\"}])" <<< $JSON)
fi
count=$((count + 1))
done
echo $JSON | python -mjson.tool
echo $JSON > $JSONFILE
register-nodes --service-host undercloud --nodes <(jq '.nodes' $JSONFILE)
register-nodes --service-host undercloud --nodes <(jq '.nodes' $NODES_JSON)
# Must wait for baremetal nodes to register as nova hypervisors
tripleo wait_for 180 1 tripleo wait_for_hypervisor_stats

View File

@ -38,7 +38,8 @@ source $DEVTEST_VARIABLES
export NODE_ARCH=${NODE_ARCH:-amd64}
export NODE_MEM=${NODE_MEM:-3072}
tripleo devtest_testenv.sh instackenv.json
export TE_DATAFILE=instackenv.json
tripleo devtest_testenv.sh $TE_DATAFILE
sudo virsh undefine --remove-all-storage seed