You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2021/06/26 12:47:04 UTC

[cloudstack] branch 4.15 updated: Fix configuration of ntp server list in systemVMs (#5160)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new aa80972  Fix configuration of ntp server list in systemVMs (#5160)
aa80972 is described below

commit aa809727a8ebcdd9178cc5594ab9fc4691cf5e38
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Sat Jun 26 18:16:36 2021 +0530

    Fix configuration of ntp server list in systemVMs (#5160)
---
 .../cloudstack/secondarystorage/SecondaryStorageManagerImpl.java    | 2 +-
 systemvm/debian/opt/cloud/bin/setup/common.sh                       | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index f0b3c91..4123ddb 100644
--- a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -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);
diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh
index e24642f..987f07d 100755
--- a/systemvm/debian/opt/cloud/bin/setup/common.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/common.sh
@@ -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