2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Display a warning when setting NTP Server

This commit is contained in:
Mark Gurevich 2018-03-23 15:42:05 -04:00
parent fa5c6e3f37
commit 6629798889
2 changed files with 11 additions and 0 deletions

View File

@ -345,6 +345,10 @@ rmdir \"/tmp/$userid\" \n")
if nic in netinfo:
ntpservers = netinfo[nic]['ntpservers']
self.callback.info('%s: BMC NTP Servers: %s' % (node, ntpservers))
if ntpservers != None:
# Display a warning if the host in not powered off
# Time on the BMC is not synced while the host is powered on
self.callback.info('%s: Warning: time will not be synchronized until the host is powered off.' % node)
def _get_facing_nic(self, bmcip, netinfo):
for k,v in netinfo.items():

View File

@ -3379,6 +3379,7 @@ sub rspconfig_response {
my @gateway = ();
my @vlan = ();
my @ntpservers = ();
my $real_ntp_server = 0;
my @nics = keys %nicinfo;
foreach my $nic (@nics) {
my $addon_info = '';
@ -3388,6 +3389,7 @@ sub rspconfig_response {
if ($nicinfo{$nic}{ntpservers}) {
push @ntpservers, "BMC NTP Servers$addon_info: $nicinfo{$nic}{ntpservers}";
$real_ntp_server = 1;
} else {
push @ntpservers, "BMC NTP Servers$addon_info: None";
}
@ -3410,6 +3412,11 @@ sub rspconfig_response {
push @output, "BMC Hostname: $hostname";
} elsif ($opt eq "ntpservers") {
push @output, @ntpservers;
if (($real_ntp_server) && ($status_info{RSPCONFIG_SET_RESPONSE}{argv} =~ "NTPServers")) {
# Display a warning if the host in not powered off
# Time on the BMC is not synced while the host is powered on.
push @output, "Warning: time will not be synchronized until the host is powered off.";
}
}
if ($multiple_error and ($opt =~ /^ip$|^ipsrc$|^netmask$|^gateway$|^vlan$/)) {