Merge lp:~secroft/obinstall/obinstall-fixes into lp:obinstall/next

Proposed by Scott Croft
Status: Merged
Approved by: Scott Croft
Approved revision: 18
Merge reported by: Scott Croft
Merged at revision: not available
Proposed branch: lp:~secroft/obinstall/obinstall-fixes
Merge into: lp:obinstall/next
Diff against target: 140 lines (+110/-15)
2 files modified
05-add_physical_nodes.sh (+1/-15)
amt_vnc_config.sh (+109/-0)
To merge this branch: bzr merge lp:~secroft/obinstall/obinstall-fixes
Reviewer Review Type Date Requested Status
Akash Chandrashekar (community) Approve
Craig Bender Approve
Review via email: mp+312729@code.launchpad.net

Description of the change

The wsman commands used to configure the amt ports on the nodes for vnc were removed into a separate script named amt_vnc_config.sh. This script will allow you to configure all of the nodes, i.e. a new OrangeBox, or a single node, in the event that a node was replaced.

The 05-add_physical_nodes.sh was changed after removing the wsman commands to move the power configuration of the noded into the create line and the update and commission lines were removed as the update is not needed and the commissioning of the nodes will automatically happen during a machine creation

To post a comment you must log in.
Revision history for this message
Craig Bender (craig-bender) wrote :

Sorry for the delay, missed this one!

review: Approve
Revision history for this message
Akash Chandrashekar (achandrashekar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '05-add_physical_nodes.sh'
2--- 05-add_physical_nodes.sh 2016-09-20 09:23:07 +0000
3+++ 05-add_physical_nodes.sh 2016-12-07 18:00:20 +0000
4@@ -60,21 +60,7 @@
5 echo "The name of the node is node${nodenum}ob${ob_number}"
6
7 # Add each node to MAAS and commission it
8-maas admin machines create architecture=amd64 power_type=amt mac_addresses=${mac} hostname=node${nodenum}ob${ob_number}
9-system_id=$(maas admin nodes read mac_address=$mac | grep system_id | cut -d'"' -f4)
10-maas admin machine update $system_id power_parameters_power_address=172.27.${ob_number}.${amtnum} power_parameters_power_pass=Password1+
11-maas admin machine commission $system_id
12-
13-# Set AMT to work with VNC and Remmina
14- wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k RFBPassword=Ubuntu1+ > /dev/null 2>&1
15- # enable KVM redirection to port 5900
16- wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k Is5900PortEnabled=true > /dev/null 2>&1
17- # disable opt-in policy
18- wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k OptInPolicy=false > /dev/null 2>&1
19- # disable session timeout
20- wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k SessionTimeout=0 > /dev/null 2>&1
21- # enable KVM
22- wsman invoke -a RequestStateChange http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_KVMRedirectionSAP -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k RequestedState=2 > /dev/null 2>&1
23+maas admin machines create architecture=amd64 power_type=amt power_parameters_power_address=172.27.${ob_number}.${amtnum} power_parameters_power_pass=Password1+ mac_addresses=${mac} hostname=node${nodenum}ob${ob_number}
24
25 #Add tags to MAAS if not already there
26 maas admin tags create name=physical || true
27
28=== added file 'amt_vnc_config.sh'
29--- amt_vnc_config.sh 1970-01-01 00:00:00 +0000
30+++ amt_vnc_config.sh 2016-12-07 18:00:20 +0000
31@@ -0,0 +1,109 @@
32+#!/bin/bash
33+#
34+# Script to modify physical OrangeBox nodes, setting the amt settings correctly
35+# Copyright (C) 2016 Canonical Ltd.
36+#
37+# Authors: Scott Croft <scott@canonical.com>
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU General Public License as published by
41+# the Free Software Foundation, version 3 of the License.
42+#
43+# This program is distributed in the hope that it will be useful,
44+# but WITHOUT ANY WARRANTY; without even the implied warranty of
45+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+# GNU General Public License for more details.
47+#
48+# You should have received a copy of the GNU General Public License
49+# along with this program. If not, see <http://www.gnu.org/licenses/>.
50+#
51+
52+#set -aux
53+
54+usage()
55+{
56+cat << EOF
57+usage: $0 options
58+
59+This script to setup amt on the node(s)
60+
61+OPTIONS:
62+ -h Show this message
63+ -a Sets the amt port configuration for all nodes
64+ -s <node #> Sets the amt configuration for a single node numbering between 11 and 20 where
65+ node1 is equal to 11, node2 - 12, etc.
66+EOF
67+}
68+
69+if [ "$(id -u)" != "0" ]; then
70+ echo "Must be run with sudo or by root"
71+ exit 77
72+fi
73+
74+# Get ob number
75+#
76+ob_number=`hostname | cut -c 10- -`
77+
78+AMT_PASSWORD=Password1+
79+
80+all_nodes(){
81+ for amtnum in {11..20}
82+ do
83+ # Set AMT to work with VNC and Remmina
84+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k RFBPassword=Ubuntu1+ > /dev/null 2>&1
85+ # enable KVM redirection to port 5900
86+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k Is5900PortEnabled=true > /dev/null 2>&1
87+ # disable opt-in policy
88+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k OptInPolicy=false > /dev/null 2>&1
89+ # disable session timeout
90+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k SessionTimeout=0 > /dev/null 2>&1
91+ # enable KVM
92+ wsman invoke -a RequestStateChange http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_KVMRedirectionSAP -h 172.27.${ob_number}.${amtnum} -P 16992 -u admin -p ${AMT_PASSWORD} -k RequestedState=2 > /dev/null 2>&1
93+ done
94+}
95+
96+single_node(){
97+ if [ ${node} -lt 11 ] || [ ${node} -gt 20 ];then
98+ echo "The node numbers range from 11-20"
99+ exit 1
100+ fi
101+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${node} -P 16992 -u admin -p ${AMT_PASSWORD} -k RFBPassword=Ubuntu1+ > /dev/null 2>&1
102+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${node} -P 16992 -u admin -p ${AMT_PASSWORD} -k Is5900PortEnabled=true > /dev/null 2>&1
103+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${node} -P 16992 -u admin -p ${AMT_PASSWORD} -k OptInPolicy=false > /dev/null 2>&1
104+ wsman put http://intel.com/wbem/wscim/1/ips-schema/1/IPS_KVMRedirectionSettingData -h 172.27.${ob_number}.${node} -P 16992 -u admin -p ${AMT_PASSWORD} -k SessionTimeout=0 > /dev/null 2>&1
105+ wsman invoke -a RequestStateChange http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_KVMRedirectionSAP -h 172.27.${ob_number}.${node} -P 16992 -u admin -p ${AMT_PASSWORD} -k RequestedState=2 > /dev/null 2>&1
106+}
107+
108+if (($# == 0)); then
109+ usage
110+fi
111+
112+while getopts "ahs:" OPTION
113+do
114+ case $OPTION in
115+ a)
116+ echo "Working"
117+ all_nodes
118+ echo "Done"
119+ ;;
120+ h)
121+ usage
122+ exit 1
123+ ;;
124+ s)
125+ node=$2
126+ echo "Working"
127+ single_node
128+ echo "Done"
129+ ;;
130+ ?)
131+ usage
132+ exit
133+ ;;
134+ \?)
135+ echo "Invalid option: -$OPTARG" >&2
136+ usage
137+ exit
138+ ;;
139+ esac
140+done

Subscribers

People subscribed via source and target branches

to all changes: