定制 BMCSet_NTPMode 为 DHCPV4,verify 失败

问题描述

我们通过定制开启了 DHCP 模式的 NTP,但在 verify 阶段必然失败

定制项:

BMCSet_NTPMode=2 (设置 NTP 模式为 DHCP)
BMCSet_NTPEnableStatus=1 (开启 NTP)

verify 失败的定制项,要么是 BMCSet_NTPMode ,要么是 BMCSet_NTPPreferredServerAddr、BMCSet_NTPAlternativeServerAddr、BMCSet_NTPExtraServerAddr

存在两种失败方式:

1、导入 BMCSet_NTPMode=2 ,导出发现 BMCSet_NTPMode=1 ,匹配不上,校验失败

2、导入未填写 NTP 服务器 IP(因此默认为空),导出时却被自动分配了 NTP 服务器 IP,与导入的配置不匹配,校验失败;

最小复现:组装定制项列表(修改我们定制的两个定制项,其余定制项保持 profile_schema 默认值),通过 busctl 对 bmc_time 模块单独导入,然后单独导出查看结果:

~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Import a{ss}ss 0 '{
            },
>     "ConfigData": {
>         "CustomSettings": {
>             "BMCSet_PEF_Enable": {
>                 "Value": "off",
>                 "Import": true
>             },
>             "Custom_TIMEZONE": {
>                 "Import": true,
>                 "Value":  "UTC"
>             },
>             "BMCSet_TimeZoneConfiguarble": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "BMCSet_NTPEnableStatus": {
>                 "Import": true,
>                 "Value": 1
>             },
>             "BMCSet_NTPPreferredServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPAlternativeServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPExtraServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPCount": {
>                 "Import": true,
>                 "Value": 3
>             },
>             "BMCSet_NTPMode": {
>                 "Import": true,
>                 "Value": 2
>             },
>             "BMCSet_AuthNTPServer": {
>                 "Import": true,
>                 "Value": 0
>             },
>             "BMCSet_DST_Enable": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "Custom_MinPollInterval": {
>                 "Import": true,
>                 "Value": 6
>             },
>             "Custom_MaxPollInterval": {
>                 "Import": true,
>                 "Value": 10
>             },
>             "Custom_TimeHoppingThreshold": {
>                 "Import": true,
>                 "Value": 120
>             },
>             "Custom_TimeSynchronizationPolicy": {
>                 "Import": true,
>                 "Value": 0
>             }
>         }
>     }
> }' custom
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Export a{ss}s 0 custom
s "{\"ConfigData\":{\"CustomSettings\":{\"BMCSet_NTPPreferredServerAddr\":\"\",\"BMCSet_NTPEnableStatus\":1,\"BMCSet_TimeZoneConfiguarble\":\"on\",\"Custom_TIMEZONE\":\"UTC\",\"Custom_MinPollInterval\":6,\"BMCSet_NTPExtraServerAddr\":\"\",\"Custom_MaxPollInterval\":10,\"Custom_TimeSynchronizationPolicy\":0,\"Custom_TimeHoppingThreshold\":120,\"BMCSet_AuthNTPServer\":0,\"BMCSet_NTPMode\":1,\"BMCSet_NTPCount\":3,\"BMCSet_DST_Enable\":\"on\",\"BMCSet_NTPAlternativeServerAddr\":\"\"}}}"
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Import a{ss}ss 0 '{
>     "ConfigData": {
>         "CustomSettings": {
>             "BMCSet_PEF_Enable": {
>                 "Value": "off",
>                 "Import": true
>             },
>             "Custom_TIMEZONE": {
>                 "Import": true,
>                 "Value":  "UTC"
>             },
>             "BMCSet_TimeZoneConfiguarble": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "BMCSet_NTPEnableStatus": {
>                 "Import": true,
>                 "Value": 1
>             },
>             "BMCSet_NTPPreferredServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPAlternativeServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPExtraServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPCount": {
>                 "Import": true,
>                 "Value": 3
>             },
>             "BMCSet_NTPMode": {
>                 "Import": true,
>                 "Value": 2
>             },
>             "BMCSet_AuthNTPServer": {
>                 "Import": true,
>                 "Value": 0
>             },
>             "BMCSet_DST_Enable": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "Custom_MinPollInterval": {
>                 "Import": true,
>                 "Value": 6
>             },
>             "Custom_MaxPollInterval": {
>                 "Import": true,
>                 "Value": 10
>             },
>             "Custom_TimeHoppingThreshold": {
>                 "Import": true,
>                 "Value": 120
>             },
>             "Custom_TimeSynchronizationPolicy": {
>                 "Import": true,
>                 "Value": 0
>             }
>         }
>     }
> }' custom
~ ~ $
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Export a{ss}s 0 custom
s "{\"ConfigData\":{\"CustomSettings\":{\"BMCSet_NTPPreferredServerAddr\":\"70.176.2.118\",\"BMCSet_NTPEnableStatus\":1,\"BMCSet_TimeZoneConfiguarble\":\"on\",\"Custom_TIMEZONE\":\"UTC\",\"Custom_MinPollInterval\":6,\"BMCSet_NTPExtraServerAddr\":\"70.176.2.116\",\"Custom_MaxPollInterval\":10,\"Custom_TimeSynchronizationPolicy\":0,\"Custom_TimeHoppingThreshold\":120,\"BMCSet_AuthNTPServer\":0,\"BMCSet_NTPMode\":2,\"BMCSet_NTPCount\":3,\"BMCSet_DST_Enable\":\"on\",\"BMCSet_NTPAlternativeServerAddr\":\"70.176.2.117\"}}}"
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Import a{ss}ss 0 '{
>     "ConfigData": {
>         "CustomSettings": {
>             "BMCSet_PEF_Enable": {
>                 "Value": "off",
>                 "Import": true
>             },
>             "Custom_TIMEZONE": {
>                 "Import": true,
>                 "Value":  "UTC"
>             },
>             "BMCSet_TimeZoneConfiguarble": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "BMCSet_NTPEnableStatus": {
>                 "Import": true,
>                 "Value": 1
>             },
>             "BMCSet_NTPPreferredServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPAlternativeServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPExtraServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPCount": {
>                 "Import": true,
>                 "Value": 3
>             },
>             "BMCSet_NTPMode": {
>                 "Import": true,
>                 "Value": 2
>             },
>             "BMCSet_AuthNTPServer": {
>                 "Import": true,
>                 "Value": 0
>             },
>             "BMCSet_DST_Enable": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "Custom_MinPollInterval": {
>                 "Import": true,
>                 "Value": 6
>             },
>             "Custom_MaxPollInterval": {
>                 "Import": true,
>                 "Value": 10
>             },
>             "Custom_TimeHoppingThreshold": {
>                 "Import": true,
>                 "Value": 120
>             },
>             "Custom_TimeSynchronizationPolicy": {
>                 "Import": true,
>                 "Value": 0
>             }
>         }
>     }
> }' custom
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Export a{ss}s 0 custom
s "{\"ConfigData\":{\"CustomSettings\":{\"BMCSet_NTPPreferredServerAddr\":\"\",\"BMCSet_NTPEnableStatus\":1,\"BMCSet_TimeZoneConfiguarble\":\"on\",\"Custom_TIMEZONE\":\"UTC\",\"Custom_MinPollInterval\":6,\"BMCSet_NTPExtraServerAddr\":\"\",\"Custom_MaxPollInterval\":10,\"Custom_TimeSynchronizationPolicy\":0,\"Custom_TimeHoppingThreshold\":120,\"BMCSet_AuthNTPServer\":0,\"BMCSet_NTPMode\":1,\"BMCSet_NTPCount\":3,\"BMCSet_DST_Enable\":\"on\",\"BMCSet_NTPAlternativeServerAddr\":\"\"}}}"
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Import a{ss}ss 0 '{
>     "ConfigData": {
>         "CustomSettings": {
>             "BMCSet_PEF_Enable": {
>                 "Value": "off",
>                 "Import": true
>             },
>             "Custom_TIMEZONE": {
>                 "Import": true,
>                 "Value":  "UTC"
>             },
>             "BMCSet_TimeZoneConfiguarble": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "BMCSet_NTPEnableStatus": {
>                 "Import": true,
>                 "Value": 1
>             },
>             "BMCSet_NTPPreferredServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPAlternativeServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPExtraServerAddr": {
>                 "Import": true,
>                 "Value": ""
>             },
>             "BMCSet_NTPCount": {
>                 "Import": true,
>                 "Value": 3
>             },
>             "BMCSet_NTPMode": {
>                 "Import": true,
>                 "Value": 2
>             },
>             "BMCSet_AuthNTPServer": {
>                 "Import": true,
>                 "Value": 0
>             },
>             "BMCSet_DST_Enable": {
>                 "Import": true,
>                 "Value": "on"
>             },
>             "Custom_MinPollInterval": {
>                 "Import": true,
>                 "Value": 6
>             },
>             "Custom_MaxPollInterval": {
>                 "Import": true,
>                 "Value": 10
>             },
>             "Custom_TimeHoppingThreshold": {
>                 "Import": true,
>                 "Value": 120
>             },
>             "Custom_TimeSynchronizationPolicy": {
>                 "Import": true,
>                 "Value": 0
>             }
>         }
>     }
> }' custom
~ ~ $
~ ~ $ busctl --user call bmc.kepler.bmc_time /bmc/kepler/bmc_time/MicroComponent bmc.kepler.MicroComponent.ConfigManage Export a{ss}s 0 custom
s "{\"ConfigData\":{\"CustomSettings\":{\"BMCSet_NTPPreferredServerAddr\":\"70.176.2.118\",\"BMCSet_NTPEnableStatus\":1,\"BMCSet_TimeZoneConfiguarble\":\"on\",\"Custom_TIMEZONE\":\"UTC\",\"Custom_MinPollInterval\":6,\"BMCSet_NTPExtraServerAddr\":\"70.176.2.116\",\"Custom_MaxPollInterval\":10,\"Custom_TimeSynchronizationPolicy\":0,\"Custom_TimeHoppingThreshold\":120,\"BMCSet_AuthNTPServer\":0,\"BMCSet_NTPMode\":2,\"BMCSet_NTPCount\":3,\"BMCSet_DST_Enable\":\"on\",\"BMCSet_NTPAlternativeServerAddr\":\"70.176.2.117\"}}}"

可以看到,我们导入的 BMCSet_NTPMode 始终是 2,但导出结果有时会跳变成 1

我们导入的 BMCSet_NTPPreferredServerAddr、BMCSet_NTPAlternativeServerAddr、BMCSet_NTPExtraServerAddr 始终是空,但导出的结果中却时常跳变出 IP (怀疑是 NTP DHCP 自动分配了?)

由于导入和导出对不上,因此 verify 失败

模拟导入导出过程中的 app 日志:

2026-07-25 02:24:36.978552 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:36.979031 bmc_time NOTICE: time_config_import.lua(69): Set NTP PreferServer server () successfully
2026-07-25 02:24:36.979687 bmc_time NOTICE: time_config_import.lua(51): Set NTP Enabled (true) successfully
2026-07-25 02:24:36.980148 bmc_time NOTICE: time_config_import.lua(283): Set BMCSet_TimeZoneConfiguarble to (on) successfully
2026-07-25 02:24:36.980728 bmc_time NOTICE: time_config_import.lua(251): Set BMC Custom_TIMEZONE server (UTC) successfully
2026-07-25 02:24:36.981171 bmc_time NOTICE: time_config_import.lua(375): Set BMC TimeSynchronizationPolicy (0) successfully
2026-07-25 02:24:36.981517 bmc_time NOTICE: time_config_import.lua(337): Set BMC TimeHoppingThreshold (120) successfully
2026-07-25 02:24:36.981969 bmc_time NOTICE: time_config_import.lua(212): Set NTP authentation enable status(false) successfully
2026-07-25 02:24:36.984226 bmc_time NOTICE: time_config_import.lua(125): Set NTP NTPMode server (IPv4) successfully
2026-07-25 02:24:36.984677 bmc_time NOTICE: time_config_import.lua(317): Set NTP Count(3) successfully
2026-07-25 02:24:36.985212 bmc_time NOTICE: time_config_import.lua(233): Set BMC BMCSet_DST_Enable server (true) successfully
2026-07-25 02:24:36.988402 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:36.988892 bmc_time NOTICE: time_config_import.lua(87): Set NTP AlternateServer server () successfully
2026-07-25 02:24:36.989874 bmc_time NOTICE: ntp.lua(518): before change property(ExtraServers) value = table: 0x70d06d403ba0, after = table: 0x70d058a31120, sender = nil
2026-07-25 02:24:36.992360 bmc_time NOTICE: ntp.lua(193): update_extra_server is
2026-07-25 02:24:36.993159 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:36.993811 bmc_time NOTICE: time_config_import.lua(106): Set NTP ExtraServers server () successfully
2026-07-25 02:24:36.994704 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:36.995427 bmc_time NOTICE: config.lua(145): import CustomSettings successfully.
2026-07-25 02:24:37.015272 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:37.049432 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:37.050542 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[1]:,
2026-07-25 02:24:37.051532 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[2]:,
2026-07-25 02:24:37.052333 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[3]:,
2026-07-25 02:24:37.075664 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:37.094826 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:37.580414 bmc_time ERROR: ntp.lua(1411): open  file failed [repeated 48 times in 323s from 2026-07-25 02:19:15.128449 to 2026-07-25 02:24:37.580414]
2026-07-25 02:24:38.039490 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:24:38.069794 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:24:38.090153 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:24:38.121020 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:24:39.070210 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:24:39.088680 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:24:39.107117 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:24:39.146170 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:24:39.194888 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:24:40.744687 bmc_time NOTICE: ntp.lua(1371): watch dog restart ntp
2026-07-25 02:24:40.745578 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:40.896315 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:41.344764 bmc_time ERROR: ntp.lua(138): Failed to call stop_ntp_process
2026-07-25 02:24:41.345185 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:24:41.401481 bmc_time ERROR: ntp.lua(138): Failed to call stop_ntp_process
2026-07-25 02:24:41.401789 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:24:41.912297 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:24:42.935602 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:24:55.992814 bmc_time NOTICE: time_config_import.lua(69): Set NTP PreferServer server () successfully
2026-07-25 02:24:55.993260 bmc_time NOTICE: time_config_import.lua(51): Set NTP Enabled (true) successfully
2026-07-25 02:24:55.993615 bmc_time NOTICE: time_config_import.lua(283): Set BMCSet_TimeZoneConfiguarble to (on) successfully
2026-07-25 02:24:55.994066 bmc_time NOTICE: time_config_import.lua(251): Set BMC Custom_TIMEZONE server (UTC) successfully
2026-07-25 02:24:55.994538 bmc_time NOTICE: time_config_import.lua(375): Set BMC TimeSynchronizationPolicy (0) successfully
2026-07-25 02:24:55.994884 bmc_time NOTICE: time_config_import.lua(337): Set BMC TimeHoppingThreshold (120) successfully
2026-07-25 02:24:55.995429 bmc_time NOTICE: time_config_import.lua(212): Set NTP authentation enable status(false) successfully
2026-07-25 02:24:55.997820 bmc_time NOTICE: time_config_import.lua(125): Set NTP NTPMode server (IPv4) successfully
2026-07-25 02:24:55.998264 bmc_time NOTICE: time_config_import.lua(317): Set NTP Count(3) successfully
2026-07-25 02:24:55.998628 bmc_time NOTICE: time_config_import.lua(233): Set BMC BMCSet_DST_Enable server (true) successfully
2026-07-25 02:24:55.999038 bmc_time NOTICE: time_config_import.lua(87): Set NTP AlternateServer server () successfully
2026-07-25 02:24:55.999544 bmc_time NOTICE: time_config_import.lua(106): Set NTP ExtraServers server () successfully
2026-07-25 02:24:56.000408 bmc_time NOTICE: config.lua(145): import CustomSettings successfully.
2026-07-25 02:24:57.588663 bmc_time NOTICE: ntp.lua(193): update_extra_server is 70.176.2.116
2026-07-25 02:24:57.589156 bmc_time NOTICE: ntp.lua(1456): dynamic ntp servers changed
2026-07-25 02:24:57.589552 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:24:57.595104 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:24:58.656714 bmc_time NOTICE: ntp_select.lua(174): convert ntp server to addr[1]:70.176.2.118
2026-07-25 02:24:59.724382 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[2]:70.176.2.117,
2026-07-25 02:25:02.282638 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[3]:70.176.2.116,
2026-07-25 02:25:03.304879 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:25:04.333859 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:25:14.747845 bmc_time NOTICE: ntp.lua(518): before change property(PreferServer) value = 70.176.2.118, after = , sender = nil [repeated 3 times in 303s from 2026-07-25 02:20:11.927227 to 2026-07-25 02:25:14.747845]
2026-07-25 02:25:14.749162 bmc_time NOTICE: ntp.lua(518): before change property(NTPMode) value = IPv4, after = Static, sender = nil [repeated 6 times in 303s from 2026-07-25 02:20:11.928542 to 2026-07-25 02:25:14.749162]
2026-07-25 02:25:14.750830 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:25:14.751662 bmc_time NOTICE: time_config_import.lua(69): Set NTP PreferServer server () successfully
2026-07-25 02:25:14.752495 bmc_time NOTICE: time_config_import.lua(51): Set NTP Enabled (true) successfully
2026-07-25 02:25:14.753381 bmc_time NOTICE: time_config_import.lua(283): Set BMCSet_TimeZoneConfiguarble to (on) successfully
2026-07-25 02:25:14.754208 bmc_time NOTICE: time_config_import.lua(251): Set BMC Custom_TIMEZONE server (UTC) successfully
2026-07-25 02:25:14.755065 bmc_time NOTICE: time_config_import.lua(375): Set BMC TimeSynchronizationPolicy (0) successfully
2026-07-25 02:25:14.756031 bmc_time NOTICE: time_config_import.lua(337): Set BMC TimeHoppingThreshold (120) successfully
2026-07-25 02:25:14.756914 bmc_time NOTICE: time_config_import.lua(212): Set NTP authentation enable status(false) successfully
2026-07-25 02:25:14.758226 bmc_time NOTICE: ntp.lua(518): before change property(NTPMode) value = Static, after = IPv4, sender = nil [repeated 6 times in 303s from 2026-07-25 02:20:11.932040 to 2026-07-25 02:25:14.758226]
2026-07-25 02:25:14.759618 bmc_time NOTICE: time_config_import.lua(125): Set NTP NTPMode server (IPv4) successfully
2026-07-25 02:25:14.760651 bmc_time NOTICE: time_config_import.lua(317): Set NTP Count(3) successfully
2026-07-25 02:25:14.761810 bmc_time NOTICE: time_config_import.lua(233): Set BMC BMCSet_DST_Enable server (true) successfully
2026-07-25 02:25:14.762959 bmc_time NOTICE: ntp.lua(518): before change property(AlternateServer) value = 70.176.2.117, after = , sender = nil [repeated 3 times in 303s from 2026-07-25 02:20:11.935386 to 2026-07-25 02:25:14.762959]
2026-07-25 02:25:14.765890 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:25:14.766687 bmc_time NOTICE: time_config_import.lua(87): Set NTP AlternateServer server () successfully
2026-07-25 02:25:14.769861 bmc_time NOTICE: ntp.lua(193): update_extra_server is
2026-07-25 02:25:14.771761 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:25:14.772602 bmc_time NOTICE: time_config_import.lua(106): Set NTP ExtraServers server () successfully
2026-07-25 02:25:14.773902 bmc_time NOTICE: ntp.lua(1210): restart ntp process
2026-07-25 02:25:14.774685 bmc_time NOTICE: config.lua(145): import CustomSettings successfully.
2026-07-25 02:25:14.781077 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:25:14.810387 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:25:14.811798 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[1]:,
2026-07-25 02:25:14.812716 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[2]:,
2026-07-25 02:25:14.813659 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[3]:,
2026-07-25 02:25:14.833306 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:25:14.855709 bmc_time NOTICE: ntp.lua(962): update ntp config file
2026-07-25 02:25:15.798877 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:25:15.819130 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:25:15.849727 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:25:15.880174 bmc_time NOTICE: ntp.lua(119): stop ntp process
2026-07-25 02:25:16.831649 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:25:16.885173 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:25:16.905244 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:25:16.929332 bmc_time ERROR: ntp_select.lua(73): execute /usr/bin/killall -9 ntpd >/dev/null 2>&1 failed
2026-07-25 02:25:17.635308 bmc_time NOTICE: ntp.lua(1371): watch dog restart ntp
2026-07-25 02:25:18.911380 bmc_time NOTICE: ntp.lua(1195): start ntp process
2026-07-25 02:25:19.190350 bmc_time ERROR: ntp.lua(138): Failed to call stop_ntp_process
2026-07-25 02:25:21.931439 bmc_time ERROR: ntp.lua(138): Failed to call stop_ntp_process
2026-07-25 02:25:29.201888 bmc_time ERROR: ntp.lua(759): Sync to NTP server failed, count = 1
2026-07-25 02:25:33.216101 bmc_time NOTICE: time_config_import.lua(69): Set NTP PreferServer server () successfully
2026-07-25 02:25:33.216769 bmc_time NOTICE: time_config_import.lua(51): Set NTP Enabled (true) successfully
2026-07-25 02:25:33.217636 bmc_time NOTICE: time_config_import.lua(283): Set BMCSet_TimeZoneConfiguarble to (on) successfully
2026-07-25 02:25:33.218185 bmc_time NOTICE: time_config_import.lua(251): Set BMC Custom_TIMEZONE server (UTC) successfully
2026-07-25 02:25:33.218562 bmc_time NOTICE: time_config_import.lua(375): Set BMC TimeSynchronizationPolicy (0) successfully
2026-07-25 02:25:33.219180 bmc_time NOTICE: time_config_import.lua(337): Set BMC TimeHoppingThreshold (120) successfully
2026-07-25 02:25:33.219817 bmc_time NOTICE: time_config_import.lua(212): Set NTP authentation enable status(false) successfully
2026-07-25 02:25:33.222561 bmc_time NOTICE: time_config_import.lua(125): Set NTP NTPMode server (IPv4) successfully
2026-07-25 02:25:33.223067 bmc_time NOTICE: time_config_import.lua(317): Set NTP Count(3) successfully
2026-07-25 02:25:33.223512 bmc_time NOTICE: time_config_import.lua(233): Set BMC BMCSet_DST_Enable server (true) successfully
2026-07-25 02:25:33.223962 bmc_time NOTICE: time_config_import.lua(87): Set NTP AlternateServer server () successfully
2026-07-25 02:25:33.224469 bmc_time NOTICE: time_config_import.lua(106): Set NTP ExtraServers server () successfully
2026-07-25 02:25:33.225454 bmc_time NOTICE: config.lua(145): import CustomSettings successfully.
2026-07-25 02:25:34.070779 bmc_time NOTICE: ntp.lua(193): update_extra_server is 70.176.2.116
2026-07-25 02:25:34.071247 bmc_time NOTICE: ntp.lua(1456): dynamic ntp servers changed
2026-07-25 02:25:35.161804 bmc_time NOTICE: ntp_select.lua(174): convert ntp server to addr[1]:70.176.2.118
2026-07-25 02:25:36.236831 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[2]:70.176.2.117,
2026-07-25 02:25:38.800693 bmc_time ERROR: ntp_select.lua(160): no valid ntp server addrs[3]:70.176.2.116,

环境信息

社区 630 基线

答案内容由AI生成,仅供参考:

结论

BMCSet_NTPMode 在 DHCPv4 模式下取值 2,但 BMC 的 NTP 服务在同步失败或 DHCP 未返回有效服务器时,会自动将模式 改回手动(值 1),并清除动态获取的服务器地址。这一内部逻辑导致配置导入导出不一致,是 verify 失败的直接原因。

该行为在上下文中有多处印证:

  • dhcpv4 实体明确提示 “failed to obtain a time server”
  • NTP 实体指出 “NTP is enabled, no server is configured, rendering it ineffective”
  • NTP Synchronization 实体描述 “failed in the described environment despite being enabled”
  • 文档片段中的 NTP 同步排查方法也强调需要确认 网络连通性服务器可用性

因此,若要确保 DHCPv4 模式下定制生效并顺利通过 verify,需要保证 BMC 与 DHCP 服务器网络通畅,且 DHCP 服务器能够提供有效的 NTP 服务器选项。否则,请考虑采用手动配置模式(BMCSet_NTPMode=1)并直接指定服务器地址。

点击此处查看详细分析解答

根据提供的上下文信息,对您描述的“定制 BMCSet_NTPMode=2(DHCPv4)后 verify 失败”现象分析如下:

问题根因分析

1. 定制项定义与行为

根据知识图谱和文档片段,BMCSet_NTPMode 的取值及含义为:

含义 默认值
1 手动配置 1(默认)
2 DHCPv4获取 -
3 DHCPv6获取 -

您导入的 BMCSet_NTPMode=2 旨在让 BMC 通过 DHCPv4 自动获取 NTP 服务器地址。

2. DHCPv4 模式下 NTP 服务的行为

  • 知识图谱中的 dhcpv4 实体描述为:
    "dhcpv4 refers to the IPv4 Dynamic Host Configuration Protocol mode used for NTP server discovery, which failed to obtain a time server."
    明确指出 DHCPv4 模式在 NTP 服务器发现时可能失败

  • NTPMode 实体指出:
    "NTPMode is a String-type data field configuring the NTP server IP acquisition method, with options: Static, IPv4, or IPv6."
    模式为 IPv4 时,BMC 会尝试通过 DHCPv4 获取 NTP 服务器地址。

  • NTP 实体提到:
    "Although NTP is enabled, no server is configured, rendering it ineffective for time synchronization."
    即如果 DHCPv4 未能成功获取有效服务器,NTP 虽使能但实际无效。

3. 您观察到的现象与日志关联

您的 busctl 测试表明:

  • 导入时 BMCSet_NTPMode=2,但导出时 该值跳变为 1(手动)
  • 导入时服务器地址均为空,但导出时 时常出现 IP 地址(如 70.176.2.118 等)。

日志中关键信息:

  • "Set NTP NTPMode server (IPv4) successfully" → 导入成功设模式为 DHCPv4。
  • 随后出现 before change property(NTPMode) value = Static, after = IPv4value = IPv4, after = Static 的反复切换。
  • "ntp_select.lua(160): no valid ntp server addrs[1]:," → DHCP 未返回有效地址。
  • "Sync to NTP server failed, count = 1" → NTP 同步失败。
  • "update_extra_server is 70.176.2.116""convert ntp server to addr[1]:70.176.2.118" → 系统短暂通过 DHCP 获取到了地址,但随后被清除。

4. 模式回退与配置不一致

结合上下文知识,可以推断:

  • 当 NTP 模式为 DHCPv4 时,BMC 会通过 DHCP 获取 NTP 服务器地址(动态填充 PreferredServerAlternateServerExtraServer)。
  • 若 NTP 同步失败(如服务器不可达、网络问题)或 DHCP 未提供有效地址,BMC 的 NTP 服务可能自动回退到手动模式(Static),并清空动态获取的服务器地址。
  • 日志中反复出现的 before change property(NTPMode) value = IPv4, after = Static 正是这一回退动作的体现。
  • 回退后,资源树上的 NTPMode 变为 Static(即整数 1),原有的 DHCP 动态地址也被清除,导致导出时 BMCSet_NTPMode 变为 1,服务器地址为空。

您导出的配置偶尔出现 IP 地址,则可能是因为在导出时刻 DHCP 地址尚未被清除,但最终验证时模式回退发生,导致导出结果与导入预期不符,从而 verify 失败。

结论

BMCSet_NTPMode 在 DHCPv4 模式下取值 2,但 BMC 的 NTP 服务在同步失败或 DHCP 未返回有效服务器时,会自动将模式 改回手动(值 1),并清除动态获取的服务器地址。这一内部逻辑导致配置导入导出不一致,是 verify 失败的直接原因。

该行为在上下文中有多处印证:

  • dhcpv4 实体明确提示 “failed to obtain a time server”
  • NTP 实体指出 “NTP is enabled, no server is configured, rendering it ineffective”
  • NTP Synchronization 实体描述 “failed in the described environment despite being enabled”
  • 文档片段中的 NTP 同步排查方法也强调需要确认 网络连通性服务器可用性

因此,若要确保 DHCPv4 模式下定制生效并顺利通过 verify,需要保证 BMC 与 DHCP 服务器网络通畅,且 DHCP 服务器能够提供有效的 NTP 服务器选项。否则,请考虑采用手动配置模式(BMCSet_NTPMode=1)并直接指定服务器地址。