diff options
Diffstat (limited to 'ci/03-maasdeploy.sh')
-rwxr-xr-x | ci/03-maasdeploy.sh | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 9fb74000..0207e89a 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -11,6 +11,17 @@ if [ ! -e $HOME/.ssh/id_rsa ]; then ssh-keygen -N '' -f $HOME/.ssh/id_rsa fi +NODE_ARCTYPE=`arch` +NODE_ARC="amd64/generic" + +if [ "x86_64" == "$NODE_ARCTYPE" ]; then + NODE_ARC="amd64/generic" +elif [ "ppc64le" == "$NODE_ARCTYPE" ]; then + NODE_ARC='ppc64el' +else + NODE_ARC=$NODE_ARCTYPE +fi + # Install the packages needed echo_info "Installing and upgrading required packages" sudo apt-get install software-properties-common -y @@ -366,16 +377,16 @@ addnodes(){ # prepare a file containing virsh remote url to connect without adding it n command line echo "export VIRSH_DEFAULT_CONNECT_URI=$VIRSHURL" > virsh_uri.sh else + netw="" + brid=`brctl show | grep 8000 | cut -d "8" -f 1 | tr "\n" " " | tr " " " " | tr -s " "` + ADMIN_BR=`cat labconfig.json | jq '.opnfv.spaces[] | select(.type=="admin")'.bridge | cut -d \" -f 2 ` - netw="" for feature in $brid; do - if [ "$feature" == "" ]; then - netw=$netw - elif [ "$feature" == "virbr0" ]; then - netw=$netw - else + if [ "$feature" == "$ADMIN_BR" ]; then netw=$netw" --network bridge="$feature",model=virtio" + else + netw=$netw fi done fi @@ -393,7 +404,7 @@ addnodes(){ echo_info "Creating and adding bootstrap node" virt-install --connect $VIRSHURL --name bootstrap --ram 4098 --cpu host --vcpus 2 --video \ - cirrus --arch x86_64 --disk size=20,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ + cirrus --disk size=20,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ $netw --boot network,hd,menu=off --noautoconsole \ --vnc --print-xml | tee bootstrap @@ -414,7 +425,7 @@ addnodes(){ maas $PROFILE machines create autodetect_nodegroup='yes' name='bootstrap' \ tags='bootstrap' hostname='bootstrap' power_type='virsh' mac_addresses=$bootstrapmac \ power_parameters_power_address="$VIRSHURL" \ - architecture='amd64/generic' power_parameters_power_id='bootstrap' + architecture=$NODE_ARC power_parameters_power_id='bootstrap' bootstrapid=$(maas $PROFILE machines read | jq -r '.[] | select(.hostname == "bootstrap").system_id') @@ -437,7 +448,7 @@ addnodes(){ maas $PROFILE machines create autodetect_nodegroup='yes' name=$NODE_NAME \ tags='control compute' hostname=$NODE_NAME power_type='virsh' mac_addresses=$nodemac \ power_parameters_power_address="$VIRSHURL" \ - architecture='amd64/generic' power_parameters_power_id=$NODE_NAME + architecture=$NODE_ARC power_parameters_power_id=$NODE_NAME nodeid=$(maas $PROFILE machines read | jq -r '.[] | select(.hostname == '\"$NODE_NAME\"').system_id') maas $PROFILE tag update-nodes control add=$nodeid || true maas $PROFILE tag update-nodes compute add=$nodeid || true @@ -449,17 +460,26 @@ addnodes(){ units=$(($units - 1)); NODE_NAME=`cat labconfig.json | jq ".lab.racks[].nodes[$units].name" | cut -d \" -f 2 ` MAC_ADDRESS=`cat labconfig.json | jq ".lab.racks[].nodes[$units].nics[] | select(.spaces[]==\"admin\").mac"[0] | cut -d \" -f 2 ` - MAC_ADDRESS1=`cat labconfig.json | jq ".lab.racks[].nodes[$units].nics[] | select(.spaces[]==\"floating\").mac"[0] | cut -d \" -f 2 ` + #MAC_ADDRESS1=`cat labconfig.json | jq ".lab.racks[].nodes[$units].nics[] | select(.spaces[]==\"floating\").mac"[0] | cut -d \" -f 2 ` POWER_TYPE=`cat labconfig.json | jq ".lab.racks[].nodes[$units].power.type" | cut -d \" -f 2 ` POWER_IP=`cat labconfig.json | jq ".lab.racks[].nodes[$units].power.address" | cut -d \" -f 2 ` POWER_USER=`cat labconfig.json | jq ".lab.racks[].nodes[$units].power.user" | cut -d \" -f 2 ` POWER_PASS=`cat labconfig.json | jq ".lab.racks[].nodes[$units].power.pass" | cut -d \" -f 2 ` + NODE_ARCTYPE=`cat labconfig.json | jq ".lab.racks[].nodes[$units].architecture" | cut -d \" -f 2 ` + + if [ "x86_64" == "$NODE_ARCTYPE" ]; then + NODE_ARC="amd64/generic" + elif [ "ppc64le" == "$NODE_ARCTYPE" ]; then + NODE_ARC='ppc64el' + else + NODE_ARC=$NODE_ARCTYPE + fi echo_info "Creating node $NODE_NAME" maas $PROFILE machines create autodetect_nodegroup='yes' name=$NODE_NAME \ hostname=$NODE_NAME power_type=$POWER_TYPE power_parameters_power_address=$POWER_IP \ power_parameters_power_user=$POWER_USER power_parameters_power_pass=$POWER_PASS mac_addresses=$MAC_ADDRESS \ - mac_addresses=$MAC_ADDRESS1 architecture='amd64/generic' + architecture=$NODE_ARC done fi |