diff options
Diffstat (limited to 'ci/03-maasdeploy.sh')
-rwxr-xr-x | ci/03-maasdeploy.sh | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 27a72a40..73b789f1 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -61,9 +61,9 @@ if [ "$snapinstall" -eq "0" ]; then sudo apt-add-repository ppa:maas/stable -y fi if [ "bionic" != "$opnfvdistro" ]; then - sudo apt-add-repository cloud-archive:pike -y + sudo apt-add-repository cloud-archive:queens -y if [ "aarch64" == "$NODE_ARCTYPE" ]; then - sudo add-apt-repository ppa:ubuntu-cloud-archive/pike-staging -y + sudo add-apt-repository ppa:ubuntu-cloud-archive/queens-staging -y fi fi @@ -209,7 +209,6 @@ sudo virsh pool-define-as default --type dir --target /var/lib/libvirt/images/ | sudo virsh pool-start default || true sudo virsh pool-autostart default || true -# In case of virtual install set network if [ "$virtinstall" -eq 1 ]; then sudo virsh net-dumpxml default > default-net-org.xml sed -i '/dhcp/d' default-net-org.xml @@ -217,7 +216,18 @@ if [ "$virtinstall" -eq 1 ]; then sudo virsh net-destroy default sudo virsh net-define default-net-org.xml sudo virsh net-start default + sudo virsh net-autostart default || true rm -f default-net-org.xml +else + # As we use kvm so setup network on admin network + ADMIN_BR=`cat labconfig.json | jq '.opnfv.spaces[] | select(.type=="admin")'.bridge | cut -d \" -f 2 ` + sed -i "s@brAdm@$ADMIN_BR@" net.xml + sudo virsh net-destroy default || true + sudo virsh net-undefine default || true + sudo virsh net-define net.xml || true + sudo virsh net-autostart default || true + sudo virsh net-start default || true + sudo virsh net-autostart default || true fi # @@ -282,6 +292,7 @@ configuremaas(){ maas $PROFILE maas set-config name=upstream_dns value=$MY_UPSTREAM_DNS || true maas $PROFILE maas set-config name='maas_name' value=$MAAS_NAME || true maas $PROFILE maas set-config name='ntp_server' value='ntp.ubuntu.com' || true + maas $PROFILE domain update 0 name=$MAAS_NAME || true maas $PROFILE sshkeys create "key=$SSH_KEY" || true for tag in bootstrap compute control storage @@ -293,9 +304,9 @@ configuremaas(){ maas $PROFILE tags create name='opnfv-dpdk' comment='OPNFV DPDK enablement' \ kernel_opts='hugepagesz=2M hugepages=1024 hugepagesz=1G hugepages=20 default_hugepagesz=1G intel_iommu=on' || true - maas $PROFILE package-repositories create name="Ubuntu Proposed new" \ - url="http://archive.ubuntu.com/ubuntu" components="main" \ - distributions="xenial-proposed" arches=amd64,i386 + #maas $PROFILE package-repositories create name="Ubuntu Proposed new" \ + # url="http://archive.ubuntu.com/ubuntu" components="main" \ + # distributions="xenial-proposed" arches=amd64,i386 #create the required spaces. maas $PROFILE space update 0 name=default || true @@ -310,8 +321,16 @@ configuremaas(){ maas $PROFILE boot-source update $SOURCE_ID \ url=$URL keyring_filename=$KEYRING_FILE || true + maas $PROFILE boot-source-selections create 1 \ + os="ubuntu" release="xenial" arches="amd64" \ + labels="*" || true + maas $PROFILE boot-source-selections create 1 \ + os="ubuntu" release="bionic" arches="amd64" \ + labels="*" || true + if [ $NODE_ARCTYPE != "x86_64" ] ; then - maas $PROFILE boot-source-selection update 1 1 arches="$NODE_ARCHES" + maas $PROFILE boot-source-selection update 1 1 arches="$NODE_ARCHES" || true + maas $PROFILE boot-source-selection update 1 2 arches="$NODE_ARCHES" || true fi if [ "$snapinstall" -eq "0" ]; then @@ -465,9 +484,7 @@ addnodes(){ VIRSHIP="" # TODO: parse from $VIRSHURL if needed fi - if [ "$virtinstall" -eq 1 ]; then - netw=" --network bridge=virbr0,model=virtio" - elif ([ "$VIRSHHOST" != "" ]); then + if ([ "$VIRSHHOST" != "" ]); then # Get the bridge hosting the remote virsh brid=$(ssh $VIRSHHOST "ip a l | grep $VIRSHHOST | perl -pe 's/.* (.*)\$/\$1/g'") netw=" --network bridge=$brid,model=virtio" @@ -476,7 +493,7 @@ addnodes(){ else netw="" - brid=`brctl show | grep 8000 | cut -d "8" -f 1 | tr "\n" " " | tr " " " " | tr -s " "` + brid=`sudo 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 ` for feature in $brid; do @@ -584,7 +601,20 @@ addnodes(){ done fi - maas $PROFILE pods create type=virsh power_address="$VIRSHURL" power_user=$USER + # Iterate to avoid "Conflict error" issue + for ii in 1 2 3 4 5 6 7 8 9 10 + do + echo "Try $ii" + maas $PROFILE pods create type=virsh power_address="$VIRSHURL" power_user=$USER > /tmp/deploy.out 2>&1 || true + cat /tmp/deploy.out + if ! fgrep -q 'Conflict' /tmp/deploy.out + then + break + else + continue + fi + done + # Make sure nodes are added into MAAS and none of them is in commissioning state i=0 |