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

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: 6020
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.

lp:~ltrager/maas/lp1686171 updated
6018. By Lee Trager

Merge trunk

6019. By Lee Trager

Merge trunk

6020. By Lee Trager

blake_r corrections

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
=== modified file 'src/metadataserver/builtin_scripts/ntp.sh'
--- src/metadataserver/builtin_scripts/ntp.sh 2017-03-29 21:32:26 +0000
+++ src/metadataserver/builtin_scripts/ntp.sh 2017-05-02 23:25:52 +0000
@@ -1,4 +1,4 @@
1#!/bin/bash -e1#!/bin/bash
2#2#
3# ntp - Run ntp clock set to verify NTP connectivity.3# ntp - Run ntp clock set to verify NTP connectivity.
4#4#
@@ -22,9 +22,26 @@
22# cloud-init configures ntp to use the rack controller or a user configured22# cloud-init configures ntp to use the rack controller or a user configured
23# external ntp server before running the test scripts. This test ensures that23# external ntp server before running the test scripts. This test ensures that
24# the configured NTP server is accessible.24# the configured NTP server is accessible.
25e=025
26ntpq -np26source /etc/os-release
27sudo -n systemctl stop ntp.service27
28sudo -n timeout 10 ntpd -gq || e=$?28if [ $VERSION_ID == "14.04" ]; then
29sudo -n systemctl start ntp.service29 which ntpq >/dev/null
30exit $e30 if [ $? -ne 0 ]; then
31 echo -en 'Warning: NTP configuration is not supported in Trusty. ' 1>&2
32 echo -en 'Running with the default NTP configuration.\n\n' 1>&2
33 sudo -n apt-get install -q -y ntp
34 fi
35 ntpq -np
36 sudo -n service ntp stop
37 sudo -n timeout 10 ntpd -gq
38 ret=$?
39 sudo -n service ntp start
40else
41 ntpq -np
42 sudo -n systemctl stop ntp.service
43 sudo -n timeout 10 ntpd -gq
44 ret=$?
45 sudo -n systemctl start ntp.service
46fi
47exit $ret
3148
=== modified file 'src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh'
--- src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh 2017-03-29 23:24:05 +0000
+++ src/metadataserver/builtin_scripts/stress-ng-cpu-long.sh 2017-05-02 23:25:52 +0000
@@ -19,6 +19,15 @@
19# You should have received a copy of the GNU Affero General Public License19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22source /etc/os-release
23if [ $VERSION_ID == '14.04' ]; then
24 # The version of stress-ng in 14.04 does not support required features
25 # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
26 echo 'stress-ng-cpu-long unsupported on 14.04, ' \
27 'please use 16.04 or above.' 1>&2
28 exit 1
29fi
30
22sudo -n apt-get install -q -y stress-ng31sudo -n apt-get install -q -y stress-ng
23echo32echo
2433
2534
=== modified file 'src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh'
--- src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh 2017-03-29 23:24:05 +0000
+++ src/metadataserver/builtin_scripts/stress-ng-cpu-short.sh 2017-05-02 23:25:52 +0000
@@ -19,6 +19,15 @@
19# You should have received a copy of the GNU Affero General Public License19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22source /etc/os-release
23if [ $VERSION_ID == '14.04' ]; then
24 # The version of stress-ng in 14.04 does not support required features
25 # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
26 echo 'stress-ng-cpu-short unsupported on 14.04, ' \
27 'please use 16.04 or above.' 1>&2
28 exit 1
29fi
30
22sudo -n apt-get install -q -y stress-ng31sudo -n apt-get install -q -y stress-ng
23echo32echo
2433
2534
=== modified file 'src/metadataserver/builtin_scripts/stress-ng-memory-long.sh'
--- src/metadataserver/builtin_scripts/stress-ng-memory-long.sh 2017-03-29 23:24:05 +0000
+++ src/metadataserver/builtin_scripts/stress-ng-memory-long.sh 2017-05-02 23:25:52 +0000
@@ -19,6 +19,15 @@
19# You should have received a copy of the GNU Affero General Public License19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22source /etc/os-release
23if [ $VERSION_ID == '14.04' ]; then
24 # The version of stress-ng in 14.04 does not support required features
25 # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
26 echo 'stress-ng-memory-long unsupported on 14.04, ' \
27 'please use 16.04 or above.' 1>&2
28 exit 1
29fi
30
22sudo -n apt-get install -q -y stress-ng31sudo -n apt-get install -q -y stress-ng
23echo32echo
2433
2534
=== modified file 'src/metadataserver/builtin_scripts/stress-ng-memory-short.sh'
--- src/metadataserver/builtin_scripts/stress-ng-memory-short.sh 2017-03-29 23:24:05 +0000
+++ src/metadataserver/builtin_scripts/stress-ng-memory-short.sh 2017-05-02 23:25:52 +0000
@@ -19,6 +19,15 @@
19# You should have received a copy of the GNU Affero General Public License19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.20# along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
22source /etc/os-release
23if [ $VERSION_ID == '14.04' ]; then
24 # The version of stress-ng in 14.04 does not support required features
25 # for testing. Warn and attempt to run incase stress-ng is ever upgraded.
26 echo 'stress-ng-memory-short unsupported on 14.04, ' \
27 'please use 16.04 or above.' 1>&2
28 exit 1
29fi
30
22sudo -n apt-get install -q -y stress-ng31sudo -n apt-get install -q -y stress-ng
23echo32echo
2433