amt template gives up way too easily

Bug #1310846 reported by Dustin Kirkland 
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Dustin Kirkland 
maas (Ubuntu)
Fix Released
High
Unassigned
Trusty
Fix Released
High
Unassigned

Bug Description

In my (extensive) experience with MAAS and AMT systems, the etc/maas/templates/power/amt.template gives up way too easily, when AMT doesn't respond.

In the current code, it tries the amttool command merely twice.

I find that the first invocation of the command is usually necessary to nudge the AMT awake. The second one then usually succeeds, but it does occasionally get dropped too.

Upping that retry count to ~10 actually makes AMT work about 95% of the time, in my testing.

=== modified file 'etc/maas/templates/power/amt.template'
--- etc/maas/templates/power/amt.template 2014-04-15 20:37:57 +0000
+++ etc/maas/templates/power/amt.template 2014-04-21 23:24:37 +0000
@@ -25,10 +25,16 @@
 }

 state() {
- state=`{
- # Retry the state if it fails because it often fails the first time.
- amt 2> /dev/null || amt
- } | grep '^Powerstate:' | awk '{print $2}'`
+ # Retry the state if it fails because it often fails the first time.
+ local count=0
+ local state=
+ while true; do
+ state=$(amt info | grep '^Powerstate:' | awk '{print $2}')
+ [ -n "$state" ] && break
+ count=$((count+1))
+ [ $count -gt 10 ] && break
+ sleep 1
+ done
   echo $state
 }

@@ -46,7 +52,7 @@
 echo desired $desired_state

 current_state=`state`
-for i in `seq 0 1`; do
+for i in `seq 0 10`; do
   echo found current_state $current_state
   if [ "$current_state" '=' "" ]; then
     echo Cannot get current state

Tags: patch

Related branches

Revision history for this message
Dustin Kirkland  (kirkland) wrote :
Changed in maas (Ubuntu):
importance: Undecided → High
status: New → Triaged
Changed in maas:
status: New → Triaged
importance: Undecided → High
Changed in maas (Ubuntu Trusty):
milestone: none → trusty-updates
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Targeting at trusty-updates. This fix is essential to a properly functioning MAAS/AMT setup.

tags: added: patch
Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
milestone: none → 1.6.0
assignee: nobody → Dustin Kirkland  (kirkland)
Changed in maas (Ubuntu):
status: Triaged → Fix Committed
Changed in maas (Ubuntu Trusty):
status: Triaged → Fix Committed
Changed in maas (Ubuntu):
status: Fix Committed → Triaged
Changed in maas (Ubuntu Trusty):
status: Fix Committed → Triaged
Changed in maas:
status: Fix Committed → Fix Released
Mathew Hodson (mhodson)
Changed in maas (Ubuntu):
milestone: trusty-updates → none
Changed in maas (Ubuntu):
status: Triaged → Fix Released
Changed in maas (Ubuntu Trusty):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.