Skip to content

Commit aa80972

Browse files
authored
Fix configuration of ntp server list in systemVMs (#5160)
1 parent d829093 commit aa80972

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
263263
private final GlobalLock _allocLock = GlobalLock.getInternLock(getAllocLockName());
264264

265265
static final ConfigKey<String> NTPServerConfig = new ConfigKey<String>(String.class, "ntp.server.list", "Advanced", null,
266-
"Comma separated list of NTP servers to configure in Secondary storage VM", false, ConfigKey.Scope.Global, null);
266+
"Comma separated list of NTP servers to configure in Secondary storage VM", true, ConfigKey.Scope.Global, null);
267267

268268
static final ConfigKey<Integer> MaxNumberOfSsvmsForMigration = new ConfigKey<Integer>("Advanced", Integer.class, "max.ssvm.count", "5",
269269
"Number of additional SSVMs to handle migration of data objects concurrently", true, ConfigKey.Scope.Global);

systemvm/debian/opt/cloud/bin/setup/common.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,12 @@ setup_ntp() {
567567
if [ -f $NTP_CONF_FILE ]
568568
then
569569
IFS=',' read -a server_list <<< "$NTP_SERVER_LIST"
570+
sed -i "/^server /d" $NTP_CONF_FILE
570571
for (( iterator=${#server_list[@]}-1 ; iterator>=0 ; iterator-- ))
571572
do
572573
server=$(echo ${server_list[iterator]} | tr -d '\r')
573574
PATTERN="server $server"
574-
if grep -q "^$PATTERN$" $NTP_CONF_FILE ; then
575-
sed -i "/^$PATTERN$/d" $NTP_CONF_FILE
576-
fi
577-
sed -i "0,/^server/s//$PATTERN\nserver/" $NTP_CONF_FILE
575+
sed -i "0,/^#server/s//$PATTERN\n#server/" $NTP_CONF_FILE
578576
done
579577
systemctl enable ntp
580578
else

0 commit comments

Comments
 (0)