Confirm a maintenance window before proceeding. Changing a host's time might also change the time in its VM instances and affect workloads that depend on system time.
Environment
- Product: ZStack Cloud on a dual-management-node (MN) HA deployment
- Version: 4.2.x~4.8.x.
- Component:
chronyd,/etc/chrony.conf, andzstack.properties. - Trigger/Condition: The platform time source (NTP) needs to be changed to a new external time server.
Symptoms
- The customer needs to change the time source for the ZStack Cloud platform.
- After a planned time source change, hosts and management nodes must keep synchronized time so that VM scheduling, log correlation, and HA decisions remain consistent.
Diagnosis
- Confirm that the platform and all storage pools are healthy before maintenance.
- Confirm that no backups or other long-running tasks are in progress before restarting MN services.
- Identify the current primary MN IP — this will be the value used in
chrony.serverIp.0.
Cause
The management nodes provide time synchronization for the platform. The platform uses chronyd on each management node, and chrony.serverIp.0 in zstack.properties specifies the MN with which the agents on hosts synchronize. To switch the time source, update /etc/chrony.conf on the primary MN and chrony.serverIp.0 on both MNs, and then reconnect the hosts so that they load the new configuration.
Resolution
1. Prerequisites
- Disable global VM HA before starting the change.

- Back up the ZStack MySQL database on both MNs:
# master node
zstack-ctl dump_mysql --file-name zstack-db-backup-master
# slave node
zstack-ctl dump_mysql --file-name zstack-db-backup-slave
- Confirm the new NTP server address and that it is reachable from the management network.
2. Procedure
Before running the following zstack-cli commands, sign in with the admin account:
``bash zstack-cli LogInByAccount accountName=admin password=<password> ``
The loop commands below use apache-tomcat-8.5.87 as an example, while the accompanying screenshots were captured with the source environment path apache-tomcat-8.5.99. The Tomcat directory version can differ between ZStack Cloud versions. Before running the commands, identify the actual apache-tomcat-x.x.xx path in the current environment and replace the key path in every subsequent SSH command.
- List hosts.
zstack-cli QueryHost hypervisorType=KVM fields=managementIp | grep managementIp | awk -F '"' '{print $4}'

- Inspect the current chrony source on each host.
for i in `zstack-cli QueryHost | grep man | awk -F "\"" '{print $4}'`; do
ssh -i /usr/local/zstack/apache-tomcat-8.5.87/webapps/zstack/WEB-INF/classes/ansible/rsaKeys/id_rsa $i \
"echo $i; chronyc sources -v | tail -n2"
done

- Configure the new NTP source on the primary management node.
cp /etc/chrony.conf /root/chrony.conf.bak
vi /etc/chrony.conf
# add or update:
server <new NTP time source> iburst

- Update
chrony.serverIp.0on both management nodes.
cp /usr/local/zstack/apache-tomcat/webapps/zstack/WEB-INF/classes/zstack.properties \
/root/zstack.properties.bak
vi /usr/local/zstack/apache-tomcat/webapps/zstack/WEB-INF/classes/zstack.properties
# set:
chrony.serverIp.0=<IP of the primary management node in the cluster>

- Restart the dual-MN services and verify the configuration.
- Confirm that no backup or other task is running on the platform.
- Restart dual-MN services:
zsha2 stop-node; zsha2 start-node
- Verify the new configuration is in effect:
zstack-ctl show_configuration | grep -i chrony

- Reconnect hosts.
- In the UI, reconnect each host individually so that it loads the new time source from the updated
zstack.properties.
- Restart the
chronydservice on each host.
Add the management IP address of every compute host in the current environment to host_ip.txt, one address per line.


for i in `cat host_ip.txt`; do
ssh -i /usr/local/zstack/apache-tomcat-8.5.87/webapps/zstack/WEB-INF/classes/ansible/rsaKeys/id_rsa $i \
"echo $i; systemctl restart chronyd"
done

- Verify node time sync.
chronyc sources -v
The output must show * for the selected time source on each node.

- Verify the Ceph cluster is healthy, then write the time to hardware clock on every node.
for i in `zstack-cli QueryHost | grep man | awk -F "\"" '{print $4}'`; do
ssh -i /usr/local/zstack/apache-tomcat-8.5.87/webapps/zstack/WEB-INF/classes/ansible/rsaKeys/id_rsa $i \
"echo $i; hwclock -w"
done

- Re-enable global VM HA.
- In the UI, turn global VM HA back on.

Verification
chronyc sources -von each MN and host shows*next to the new NTP server.zstack-ctl show_configuration | grep -i chronyshows the newchrony.serverIp.0value on both MNs.- The Ceph cluster health check (UI) reports healthy.
- VM workloads and HA policy behave normally after global HA is re-enabled.
Risks and rollback
- Risk: During the change, management-node services are restarted, so the UI is briefly unavailable.
- Workload time risk: Changing a host's time might also change the time in its VM instances and affect workloads that depend on system time.
- Compatibility: Both MNs must be updated with the same
chrony.serverIp.0value (the primary MN's IP). - Rollback: Restore
/etc/chrony.conffrom/root/chrony.conf.bakandzstack.propertiesfrom/root/zstack.properties.bak; restartchronydand the MN services.
