From cb10e5a39751060a1fe0a19e7abbef3678c9b5d4 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 18 Sep 2014 09:01:21 -0400 Subject: [PATCH] Switch to using a $NODES_JSON to register nodes --- deploy-baremetal-overcloudrc | 8 ----- deploy-virt-overcloudrc | 23 +------------ .../extra-data.d/50-add-instack-files | 3 +- .../instack-vm/install.d/51-instack-files | 1 + scripts/instack-deploy-overcloud | 34 ++----------------- scripts/instack-virt-setup | 3 +- 6 files changed, 8 insertions(+), 64 deletions(-) diff --git a/deploy-baremetal-overcloudrc b/deploy-baremetal-overcloudrc index 55f65b5c5..83740f1bb 100644 --- a/deploy-baremetal-overcloudrc +++ b/deploy-baremetal-overcloudrc @@ -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" diff --git a/deploy-virt-overcloudrc b/deploy-virt-overcloudrc index 3f0d42a73..813577df3 100644 --- a/deploy-virt-overcloudrc +++ b/deploy-virt-overcloudrc @@ -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 diff --git a/elements/instack-vm/extra-data.d/50-add-instack-files b/elements/instack-vm/extra-data.d/50-add-instack-files index ef1ac033e..25e1771c4 100755 --- a/elements/instack-vm/extra-data.d/50-add-instack-files +++ b/elements/instack-vm/extra-data.d/50-add-instack-files @@ -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 diff --git a/elements/instack-vm/install.d/51-instack-files b/elements/instack-vm/install.d/51-instack-files index 0a1e0325d..025951ce4 100755 --- a/elements/instack-vm/install.d/51-instack-files +++ b/elements/instack-vm/install.d/51-instack-files @@ -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 diff --git a/scripts/instack-deploy-overcloud b/scripts/instack-deploy-overcloud index 2bdaea670..e6db76b54 100755 --- a/scripts/instack-deploy-overcloud +++ b/scripts/instack-deploy-overcloud @@ -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 diff --git a/scripts/instack-virt-setup b/scripts/instack-virt-setup index f0dbcf3d6..2cb68bdc0 100755 --- a/scripts/instack-virt-setup +++ b/scripts/instack-virt-setup @@ -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