Merge lp:~sseman/juju-ci-tools/add-more-maas-nodes into lp:juju-ci-tools

Proposed by Seman on 2016-09-21
Status: Needs review
Proposed branch: lp:~sseman/juju-ci-tools/add-more-maas-nodes
Merge into: lp:juju-ci-tools
Diff against target: 33 lines (+29/-0)
1 file modified
maas-p8/add-additional-maas-nodes.bash (+29/-0)
To merge this branch: bzr merge lp:~sseman/juju-ci-tools/add-more-maas-nodes
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code 2016-09-21 Approve on 2016-09-21
Review via email: mp+306403@code.launchpad.net

Description of the change

Added script to add additional MAAS nodes. It duplicates some of the code in add-virtual-maas-nodes.bash. In future, it can be improved by unifying these scripts.

To post a comment you must log in.
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Unmerged revisions

1614. By Seman on 2016-09-21

properties changed to +x

1613. By Seman on 2016-09-21

Added script to add additional MAAS nodes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'maas-p8/add-additional-maas-nodes.bash'
2--- maas-p8/add-additional-maas-nodes.bash 1970-01-01 00:00:00 +0000
3+++ maas-p8/add-additional-maas-nodes.bash 2016-09-21 22:17:37 +0000
4@@ -0,0 +1,29 @@
5+#!/bin/bash -xe
6+
7+usage() {
8+ echo "usage: $0 number-of-nodes-to-add starting-node-number"
9+ exit 1
10+}
11+
12+test $# -eq 2 || usage
13+
14+add_count=$1
15+base_name='maas-node'
16+base_node_num=1
17+start_node_num=$2
18+maas_login_key='maas19'
19+power_address='qemu+ssh://ubuntu@10.0.30.1/system'
20+pool_path='/images/maaspool1'
21+base='/images'
22+
23+[[ -d $base/maas ]] || { echo "\$base/maas is required."; exit 1; }
24+
25+## Clone additional nodes
26+next_num=${start_node_num}
27+last_num=$((next_num + add_count))
28+while (($next_num < $last_num)); do
29+ virt-clone -o ${base_name}-${base_node_num} -n ${base_name}-${next_num} -f ${pool_path}/${base_name}-${next_num}.1.qcow2 -f ${pool_path}/${base_name}-${next_num}.2.qcow2
30+ mac_to_add=$(virsh dumpxml ${base_name}-${next_num} |grep "mac address" | head -2 | tail -1 | awk -F\' '{print $2}')
31+ maas ${maas_login_key} nodes new architecture="ppc64el/generic" mac_addresses="${mac_to_add}" hostname="${base_name}-${next_num}" power_type="virsh" power_parameters_power_address="${power_address}" power_parameters_power_id="${base_name}-${next_num}" autodetect_nodegroup=1
32+ next_num=$((next_num+1))
33+done

Subscribers

People subscribed via source and target branches