X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=ci%2F03-maasdeploy.sh;h=3004e0a0d8edd71d511ca2941b777c31dd55019c;hb=ab10f090847a88679bd5fd9597aae388f01f7e2e;hp=bc0c2cbb85ba4c45c82adfdda74cd8854eef241d;hpb=0aae5f09cedb4f9bfcb6af0e5f1a43824095284a;p=joid.git diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index bc0c2cbb..3004e0a0 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -45,22 +45,26 @@ NODE_ARC="$NODE_ARCHES/generic" # Install the packages needed echo_info "Installing and upgrading required packages" -sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA -sudo apt-get update -y +#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA +sudo apt-get update -y || true sudo apt-get install software-properties-common -y sudo apt-add-repository ppa:juju/stable -y sudo apt-add-repository ppa:maas/stable -y -sudo apt-add-repository cloud-archive:ocata -y -sudo apt-get update -y +sudo apt-add-repository cloud-archive:pike -y +if [ "aarch64" == "$NODE_ARCTYPE" ]; then +sudo add-apt-repository ppa:ubuntu-cloud-archive/pike-staging -y +fi +sudo apt-get update -y || true #sudo apt-get dist-upgrade -y + sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \ maas maas-region-controller juju python-pip python-psutil python-openstackclient \ python-congressclient gsutil charm-tools pastebinit python-jinja2 sshpass \ - openssh-server vlan ipmitool jq expect snap -y + openssh-server vlan ipmitool jq expect snap -y --allow-unauthenticated -#sudo apt-get install snap -y -#sudo snap install maas --classic -#sudo snap install juju --classic +if [ "aarch64" == "$NODE_ARCTYPE" ]; then + sudo apt-get install qemu qemu-efi qemu-system-aarch64 -y --allow-unauthenticated +fi sudo -H pip install --upgrade pip @@ -223,14 +227,6 @@ fi sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys -# -# MAAS deploy -# - -installmaas(){ - sudo apt-get install maas maas-region-controller -y -} - # # MAAS config # https://insights.ubuntu.com/2016/01/23/maas-setup-deploying-openstack-on-maas-1-9-with-juju/ @@ -238,9 +234,7 @@ installmaas(){ # configuremaas(){ #reconfigure maas with correct MAAS address. - #Below code is needed as MAAS have issue in commissioning without restart. - #sudo ./maas-reconfigure-region.sh $MAAS_IP - sleep 30 + sudo maas-rack config --region-url http://$MAAS_IP:5240/MAAS sudo maas createadmin --username=ubuntu --email=ubuntu@ubuntu.com --password=ubuntu || true @@ -257,6 +251,10 @@ configuremaas(){ maas $PROFILE tags create name=$tag || true done + #below tag would be used to enable huge pages for DPDK and SRIOV enablement in Ubuntu kernel via MAAS + 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' + #create the required spaces. maas $PROFILE space update 0 name=default || true for space in admin-api internal-api public-api \ @@ -375,6 +373,27 @@ setupspacenetwork(){ PRIMARY_RACK_CONTROLLER=$(maas $PROFILE rack-controllers read | jq -r '.[0].system_id') maas $PROFILE vlan update $NET_FABRIC_ID $NET_FABRIC_VID dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true fi + elif ([ $type == "public" ] || [ $type == "osapi" ]); then + # If we have a network, we create reserve IPS for public IP range + if ([ $NET_FABRIC_ID ]); then + # Set ranges + SUBNET_PREFIX=${SPACE_CIDR::-5} + IP_RES_RANGE_LOW="$SUBNET_PREFIX.1" + IP_RES_RANGE_HIGH="$SUBNET_PREFIX.39" + maas $PROFILE ipranges create type=reserved \ + start_ip=$IP_RES_RANGE_LOW end_ip=$IP_RES_RANGE_HIGH \ + comment='This is a reserved range' || true + fi + else + if ([ $NET_FABRIC_ID ]); then + # Set ranges + SUBNET_PREFIX=${SPACE_CIDR::-5} + IP_RES_RANGE_LOW="$SUBNET_PREFIX.1" + IP_RES_RANGE_HIGH="$SUBNET_PREFIX.5" + maas $PROFILE ipranges create type=reserved \ + start_ip=$IP_RES_RANGE_LOW end_ip=$IP_RES_RANGE_HIGH \ + comment='This is a reserved range' || true + fi fi done } @@ -383,6 +402,8 @@ addnodes(){ API_KEY=`sudo maas-region apikey --username=ubuntu` maas login $PROFILE $API_SERVERMAAS $API_KEY + maas $PROFILE maas set-config name=default_min_hwe_kernel value=hwe-16.04-edge || true + # make sure there is no machine entry in maas for m in $(maas $PROFILE machines read | jq -r '.[].system_id') do @@ -439,8 +460,8 @@ addnodes(){ virt-install --connect $VIRSHURL --name bootstrap --ram 4098 --cpu $CPU_MODEL --vcpus 2 \ --disk size=20,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ - $netw --boot network,hd,menu=off --noautoconsole \ - --print-xml | tee bootstrap + $netw --boot network,hd,menu=off --video virtio --noautoconsole --autostart \ + --accelerate --print-xml | tee bootstrap if [ "$virtinstall" -eq 1 ]; then bootstrapmac=`grep "mac address" bootstrap | head -1 | cut -d '"' -f 2` @@ -452,7 +473,6 @@ addnodes(){ done fi virsh -c $VIRSHURL define --file bootstrap - virsh -c $VIRSHURL autostart bootstrap rm -f bootstrap @@ -476,11 +496,11 @@ addnodes(){ virt-install --connect $VIRSHURL --name $NODE_NAME --ram 8192 --cpu $CPU_MODEL --vcpus 4 \ --disk size=120,format=qcow2,bus=virtio,cache=directsync,io=native,pool=default \ - $netw $netw --boot network,hd,menu=off --noautoconsole --print-xml | tee $NODE_NAME + $netw $netw --boot network,hd,menu=off --video virtio --noautoconsole --autostart \ + --accelerate --print-xml | tee $NODE_NAME nodemac=`grep "mac address" $NODE_NAME | head -1 | cut -d '"' -f 2` virsh -c $VIRSHURL define --file $NODE_NAME - virsh -c $VIRSHURL autostart $NODE_NAME rm -f $NODE_NAME maas $PROFILE machines create autodetect_nodegroup='yes' name=$NODE_NAME \ @@ -552,9 +572,10 @@ sleep 30 setupspacenetwork -#just make sure rack controller has been synced and import only -# just whether images have been imported or not. -sudo ./maas-reconfigure-region.sh $MAAS_IP +sudo sed -i 's/localhost/'$MAAS_IP'/g' /etc/maas/rackd.conf +sudo service maas-rackd restart +sudo service maas-regiond restart + sleep 120 # Let's add the nodes now. Currently works only for virtual deployment. @@ -688,12 +709,8 @@ if [ -e ./labconfig.json ]; then fi # Add the cloud and controller credentials for MAAS for that lab. -jujuver=`juju --version` - -if [[ "$jujuver" > "2" ]]; then - addcloud - addcredential -fi +addcloud +addcredential # # End of scripts