Merge lp:~ltrager/maas/lp1686171 into lp:~maas-committers/maas/trunk

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: no longer in the source branch.
Merged at revision: 6035
Proposed branch: lp:~ltrager/maas/lp1686171
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 121 lines (+60/-7)
5 files modified
src/metadataserver/builtin_scripts/ntp.sh (+24/-7)
src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh (+9/-0)
src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh (+9/-0)
src/metadataserver/builtin_scripts/stress-ng-memory-long.sh (+9/-0)
src/metadataserver/builtin_scripts/stress-ng-memory-short.sh (+9/-0)
To merge this branch: bzr merge lp:~ltrager/maas/lp1686171
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Andres Rodriguez (community) Needs Fixing
Review via email: mp+323196@code.launchpad.net

Commit message

Warn users when running unsupported tests on 14.04

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Seems like your missing the exit code.

review: Needs Information
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Comment inline!

review: Needs Fixing
Revision history for this message
Lee Trager (ltrager) wrote :

I don't exit 1 after detecting 14.04 in case cloud-init or stress-ng are ever updated in 14.04 to include the features we need. I can add in the exit 1 if that is preferable.

The purpose of the NTP test is to ensure the MAAS configured NTP server is accessible by the machine. While I could install NTP I realized this would only test the default NTP server. This would be misleading to the user as they expect the MAAS NTP server to be tested, not the default. Further it may indicate to the user NTP configuration is supported in 14.04 when it really isn't.

Revision history for this message
Blake Rouse (blake-rouse) wrote :

I think exit 1 would be better.

For ntp what I would check for trusty and if ntpd is already installed then run the test (might be the case if cloud-init is every SRU'd). If trusty and ntpd is not installed print a nice message saying ntpd was not configured to use MAAS, will test with upstream ntpd.

Another thing that would be nice is to include the IP address or hostname that ntpd is testing. That might already be in the logs. If that is the case then just a nice warning say its running on trusty would be enough.

Revision history for this message
Lee Trager (ltrager) wrote :

Updated as per Blake's suggestions.

Revision history for this message
Blake Rouse (blake-rouse) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/metadataserver/builtin_scripts/ntp.sh'
2--- src/metadataserver/builtin_scripts/ntp.sh 2017-03-29 21:32:26 +0000
3+++ src/metadataserver/builtin_scripts/ntp.sh 2017-05-02 23:25:52 +0000
4@@ -1,4 +1,4 @@
5-#!/bin/bash -e
6+#!/bin/bash
7 #
8 # ntp - Run ntp clock set to verify NTP connectivity.
9 #
10@@ -22,9 +22,26 @@
11 # cloud-init configures ntp to use the rack controller or a user configured
12 # external ntp server before running the test scripts. This test ensures that
13 # the configured NTP server is accessible.
14-e=0
15-ntpq -np
16-sudo -n systemctl stop ntp.service
17-sudo -n timeout 10 ntpd -gq || e=$?
18-sudo -n systemctl start ntp.service
19-exit $e
20+
21+source /etc/os-release
22+
23+if [ $VERSION_ID == "14.04" ]; then
24+ which ntpq >/dev/null
25+ if [ $? -ne 0 ]; then
26+ echo -en 'Warning: NTP configuration is not supported in Trusty. ' 1>&2
27+ echo -en 'Running with the default NTP configuration.\n\n' 1>&2
28+ sudo -n apt-get install -q -y ntp
29+ fi
30+ ntpq -np
31+ sudo -n service ntp stop
32+ sudo -n timeout 10 ntpd -gq
33+ ret=$?
34+ sudo -n service ntp start
35+else
36+ ntpq -np
37+ sudo -n systemctl stop ntp.service
38+ sudo -n timeout 10 ntpd -gq
39+ ret=$?
40+ sudo -n systemctl start ntp.service
41+fi
42+exit $ret
43
44=== modified file 'src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh'
45--- src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh 2017-03-29 23:24:05 +0000
46+++ src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh 2017-05-02 23:25:52 +0000
47@@ -19,6 +19,15 @@
48 # You should have received a copy of the GNU Affero General Public License
49 # along with this program. If not, see <http://www.gnu.org/licenses/>.
50
51+source /etc/os-release
52+if [ $VERSION_ID == '14.04' ]; then
53+ # The version of stress-ng in 14.04 does not support required features
54+ # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
55+ echo 'stress-ng-cpu-long unsupported on 14.04, ' \
56+ 'please use 16.04 or above.' 1>&2
57+ exit 1
58+fi
59+
60 sudo -n apt-get install -q -y stress-ng
61 echo
62
63
64=== modified file 'src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh'
65--- src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh 2017-03-29 23:24:05 +0000
66+++ src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh 2017-05-02 23:25:52 +0000
67@@ -19,6 +19,15 @@
68 # You should have received a copy of the GNU Affero General Public License
69 # along with this program. If not, see <http://www.gnu.org/licenses/>.
70
71+source /etc/os-release
72+if [ $VERSION_ID == '14.04' ]; then
73+ # The version of stress-ng in 14.04 does not support required features
74+ # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
75+ echo 'stress-ng-cpu-short unsupported on 14.04, ' \
76+ 'please use 16.04 or above.' 1>&2
77+ exit 1
78+fi
79+
80 sudo -n apt-get install -q -y stress-ng
81 echo
82
83
84=== modified file 'src/metadataserver/builtin_scripts/stress-ng-memory-long.sh'
85--- src/metadataserver/builtin_scripts/stress-ng-memory-long.sh 2017-03-29 23:24:05 +0000
86+++ src/metadataserver/builtin_scripts/stress-ng-memory-long.sh 2017-05-02 23:25:52 +0000
87@@ -19,6 +19,15 @@
88 # You should have received a copy of the GNU Affero General Public License
89 # along with this program. If not, see <http://www.gnu.org/licenses/>.
90
91+source /etc/os-release
92+if [ $VERSION_ID == '14.04' ]; then
93+ # The version of stress-ng in 14.04 does not support required features
94+ # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
95+ echo 'stress-ng-memory-long unsupported on 14.04, ' \
96+ 'please use 16.04 or above.' 1>&2
97+ exit 1
98+fi
99+
100 sudo -n apt-get install -q -y stress-ng
101 echo
102
103
104=== modified file 'src/metadataserver/builtin_scripts/stress-ng-memory-short.sh'
105--- src/metadataserver/builtin_scripts/stress-ng-memory-short.sh 2017-03-29 23:24:05 +0000
106+++ src/metadataserver/builtin_scripts/stress-ng-memory-short.sh 2017-05-02 23:25:52 +0000
107@@ -19,6 +19,15 @@
108 # You should have received a copy of the GNU Affero General Public License
109 # along with this program. If not, see <http://www.gnu.org/licenses/>.
110
111+source /etc/os-release
112+if [ $VERSION_ID == '14.04' ]; then
113+ # The version of stress-ng in 14.04 does not support required features
114+ # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
115+ echo 'stress-ng-memory-short unsupported on 14.04, ' \
116+ 'please use 16.04 or above.' 1>&2
117+ exit 1
118+fi
119+
120 sudo -n apt-get install -q -y stress-ng
121 echo
122