From 5cb0ea7a1b2473a1969e48eff41ff50d540c53bd Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Wed, 25 Jan 2017 08:18:09 +0000 Subject: bug fixes in 03-maasdeploy.sh This patch includes the following fixes: - make the script pick the first 'system_id' from output of `maas machines create` - add missing parameter name in bootstrap machine creation - change file owner of ssh key files, so that maas user can access qemu via ssh - execute 'enablesubnetanddhcp()' Change-Id: Idf889425548760ec1d9a25458916d7c0d485d683 Signed-off-by: Ryota MIBU --- ci/03-maasdeploy.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'ci') diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index f84f5d6f..63d637a3 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -170,6 +170,8 @@ if [ ! -e ~maas/.ssh/id_rsa.pub ]; then sudo -u maas mkdir ~maas/.ssh/ || true sudo cp $HOME/id_rsa_maas ~maas/.ssh/id_rsa sudo cp $HOME/id_rsa_maas.pub ~maas/.ssh/id_rsa.pub + sudo chown maas:maas ~maas/.ssh/id_rsa + sudo chown maas:maas ~maas/.ssh/id_rsa.pub fi # Ensure virsh can connect without ssh auth @@ -301,6 +303,12 @@ addnodes(){ API_KEY=`sudo maas-region apikey --username=ubuntu` maas login $PROFILE $API_SERVERMAAS $API_KEY + # make sure there is no machine entry in maas + for m in `maas $PROFILE machines read | grep system_id | cut -d '"' -f4 | sort | uniq` + do + maas ubuntu machine delete $m + done + if [ "$virtinstall" -eq 1 ]; then ntew=virbr0 else @@ -331,10 +339,11 @@ addnodes(){ fi sudo virsh -c qemu:///system define --file bootstrap - bootstrapid=`maas $PROFILE machines create autodetect_nodegroup='yes' name='bootstrap' \ - tags='bootstrap' hostname='bootstrap' power_type='virsh' $bootstrapmac \ + bootstrap=`maas $PROFILE machines create autodetect_nodegroup='yes' name='bootstrap' \ + tags='bootstrap' hostname='bootstrap' power_type='virsh' mac_addresses=$bootstrapmac \ power_parameters_power_address='qemu+ssh://'$USER'@'$MAAS_IP'/system' \ - architecture='amd64/generic' power_parameters_power_id='bootstrap' | grep system_id | cut -d '"' -f 4 ` + architecture='amd64/generic' power_parameters_power_id='bootstrap'` + bootstrapid=`echo "$bootstrap" | grep -m1 'system_id' | cut -d '"' -f 4` maas $PROFILE tag update-nodes bootstrap add=$bootstrapid @@ -365,18 +374,21 @@ addnodes(){ sudo virsh -c qemu:///system define --file node5-compute - controlnodeid=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node1-control' \ + controlnode=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node1-control' \ tags='control' hostname='node1-control' power_type='virsh' mac_addresses=$node1controlmac \ power_parameters_power_address='qemu+ssh://'$USER'@'$MAAS_IP'/system' \ - architecture='amd64/generic' power_parameters_power_id='node1-control' | grep system_id | cut -d '"' -f 4 ` - computenode2id=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node2-compute' \ + architecture='amd64/generic' power_parameters_power_id='node1-control'` + controlnodeid=`echo "$controlnode" | grep -m1 'system_id' | cut -d '"' -f 4` + computenode2=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node2-compute' \ tags='compute' hostname='node2-compute' power_type='virsh' mac_addresses=$node2computemac \ power_parameters_power_address='qemu+ssh://'$USER'@'$MAAS_IP'/system' \ - architecture='amd64/generic' power_parameters_power_id='node2-compute' | grep system_id | cut -d '"' -f 4 ` - computenode5id=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node5-compute' \ + architecture='amd64/generic' power_parameters_power_id='node2-compute'` + computenode2id=`echo "$computenode2" | grep -m1 'system_id' | cut -d '"' -f 4` + computenode5=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node5-compute' \ tags='compute' hostname='node5-compute' power_type='virsh' mac_addresses=$node5computemac \ power_parameters_power_address='qemu+ssh://'$USER'@'$MAAS_IP'/system' \ - architecture='amd64/generic' power_parameters_power_id='node5-compute' | grep system_id | cut -d '"' -f 4 ` + architecture='amd64/generic' power_parameters_power_id='node5-compute'` + computenode5id=`echo "$computenode5" | grep -m1 'system_id' | cut -d '"' -f 4` maas $PROFILE tag update-nodes control add=$controlnodeid || true maas $PROFILE tag update-nodes compute add=$compute2nodeid || true @@ -385,6 +397,9 @@ addnodes(){ } configuremaas +if [ "$virtinstall" -eq 1 ]; then + enablesubnetanddhcp +fi addnodes #sudo chown $USER:$USER environments.yaml -- cgit 1.2.3-korg