Public bug reported: 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 ** Affects: maas Importance: High Status: Triaged ** Affects: maas (Ubuntu) Importance: High Status: Triaged ** Affects: maas (Ubuntu Trusty) Importance: High Status: Triaged -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to maas in Ubuntu. https://bugs.launchpad.net/bugs/1310846 Title: amt template gives up way too easily To manage notifications about this bug go to: https://bugs.launchpad.net/maas/+bug/1310846/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs