Merge "Use host's NTPD as the time source for NTPD on the master node"

This commit is contained in:
Jenkins 2015-04-03 16:04:02 +00:00 committed by Gerrit Code Review
commit 137bb4089e
2 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,7 @@ from proboscis.asserts import assert_equal
from fuelweb_test import logger
from fuelweb_test.settings import FUEL_PLUGIN_BUILDER_REPO
from fuelweb_test.settings import FUEL_USE_LOCAL_NTPD
class BaseActions(object):
@ -102,6 +103,22 @@ class AdminActions(BaseActions):
"Command [{cmd}] failed with the following result: {res}"
.format(cmd=cmd, res=result))
if FUEL_USE_LOCAL_NTPD:
#Try to use only ntpd on the host as the time sourse for admin node
cmd = 'ntpdate -p 4 -t 0.2 -ub {0}'.format(router)
if not self.admin_remote.execute(cmd)['exit_code']:
# Local ntpd on the host is alive, so
# remove all NTP sources and add the host instead.
cmd = ("sed -i '/^NTP/d' {0} && echo 'NTP1: {1}' >> {0}"
.format(config, router))
logger.info("Switching NTPD on the Fuel admin node to use "
"{0} as the time source.".format(router))
result = self.admin_remote.execute(cmd)
assert_equal(0, result['exit_code'],
"Command [{cmd}] failed with the following "
"result: {res}".format(cmd=cmd, res=result))
class NailgunActions(BaseActions):
def __init__(self, admin_remote):

View File

@ -364,6 +364,7 @@ STORE_ASTUTE_YAML = os.environ.get('STORE_ASTUTE_YAML', 'false') == 'true'
EXTERNAL_DNS = os.environ.get('EXTERNAL_DNS', '208.67.220.220')
EXTERNAL_NTP = os.environ.get('EXTERNAL_NTP', 'ua.pool.ntp.org')
FUEL_USE_LOCAL_NTPD = os.environ.get('FUEL_USE_LOCAL_NTPD', 'true') == 'true'
TIMESTAT_PATH_YAML = os.environ.get(
'TIMESTAT_PATH_YAML', os.path.join(