Fix configuration of ntp server list in systemVMs (#5160)

This commit is contained in:
Pearl Dsilva 2021-06-26 18:16:36 +05:30 committed by GitHub
parent d82909318f
commit aa809727a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -263,7 +263,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
private final GlobalLock _allocLock = GlobalLock.getInternLock(getAllocLockName());
static final ConfigKey<String> NTPServerConfig = new ConfigKey<String>(String.class, "ntp.server.list", "Advanced", null,
"Comma separated list of NTP servers to configure in Secondary storage VM", false, ConfigKey.Scope.Global, null);
"Comma separated list of NTP servers to configure in Secondary storage VM", true, ConfigKey.Scope.Global, null);
static final ConfigKey<Integer> MaxNumberOfSsvmsForMigration = new ConfigKey<Integer>("Advanced", Integer.class, "max.ssvm.count", "5",
"Number of additional SSVMs to handle migration of data objects concurrently", true, ConfigKey.Scope.Global);

View File

@ -567,14 +567,12 @@ setup_ntp() {
if [ -f $NTP_CONF_FILE ]
then
IFS=',' read -a server_list <<< "$NTP_SERVER_LIST"
sed -i "/^server /d" $NTP_CONF_FILE
for (( iterator=${#server_list[@]}-1 ; iterator>=0 ; iterator-- ))
do
server=$(echo ${server_list[iterator]} | tr -d '\r')
PATTERN="server $server"
if grep -q "^$PATTERN$" $NTP_CONF_FILE ; then
sed -i "/^$PATTERN$/d" $NTP_CONF_FILE
fi
sed -i "0,/^server/s//$PATTERN\nserver/" $NTP_CONF_FILE
sed -i "0,/^#server/s//$PATTERN\n#server/" $NTP_CONF_FILE
done
systemctl enable ntp
else