diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index f20ea382d..1fb1aeeda 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -369,7 +369,15 @@ site Attributes: This setting does not apply to the service node. For sn you need to set servicenode.ftpserver=1 if you want xcatd to bring up vsftpd. - + + + FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts + entries generated by 'makehosts' will put the FQDN before the PQDN(Partially + Qualified Domain Name). Otherwise, the original behavior will be performed. + + + .. code-block:: perl + ----------------------- VIRTUALIZATION ATTRIBUTES ----------------------- diff --git a/docs/source/guides/admin-guides/references/man8/makehosts.8.rst b/docs/source/guides/admin-guides/references/man8/makehosts.8.rst index 4c3868a5e..1e29641b4 100644 --- a/docs/source/guides/admin-guides/references/man8/makehosts.8.rst +++ b/docs/source/guides/admin-guides/references/man8/makehosts.8.rst @@ -58,8 +58,9 @@ OPTIONS \ **-l**\ |\ **--longnamefirst**\ - The long name of the host will appear before the short name for each host in the /etc/hosts file. - The default is short name first. + The FQDN (Fully Qualified Domain Name) of the host will appear before the PQDN (Partially Qualified Domain Name) for each host in the /etc/hosts file. + The default is PQDN first. + After xCAT is installed, the attribute name "FQDNfirst" can be added into "site" table manually. If the value is set as "1", "yes" or "enable", the /etc/hosts entries generated by "makehosts" will put the FQDN before the PQDN. Otherwise, the original behavior will be performed. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 86f7d87dd..4ad0ae990 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1174,6 +1174,9 @@ site => { " This setting does not apply to the service node. For sn\n". " you need to set servicenode.ftpserver=1 if you want xcatd to\n". " bring up vsftpd.\n\n". + "FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts \n". + " entries generated by 'makehosts' will put the FQDN before the PQDN(Partially \n". + " Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n". " -----------------------\n". "VIRTUALIZATION ATTRIBUTES\n". " -----------------------\n". diff --git a/xCAT-client/pods/man8/makehosts.8.pod b/xCAT-client/pods/man8/makehosts.8.pod index e27344959..b597b5930 100644 --- a/xCAT-client/pods/man8/makehosts.8.pod +++ b/xCAT-client/pods/man8/makehosts.8.pod @@ -34,8 +34,9 @@ it will only replace the lines in the file that correspond to the nodes in the s =item B<-l>|B<--longnamefirst> -The long name of the host will appear before the short name for each host in the /etc/hosts file. -The default is short name first. +The FQDN (Fully Qualified Domain Name) of the host will appear before the PQDN (Partially Qualified Domain Name) for each host in the /etc/hosts file. +The default is PQDN first. +After xCAT is installed, the attribute name "FQDNfirst" can be added into "site" table manually. If the value is set as "1", "yes" or "enable", the /etc/hosts entries generated by "makehosts" will put the FQDN before the PQDN. Otherwise, the original behavior will be performed. =item B<-m>|B<--mactolinklocal> diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 7868e41f5..bf5760d2c 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -394,13 +394,14 @@ sub process_request return; } + # get site FQDNfirst(Fully Qualified Domian Name) + my @FQDNfirst = xCAT::TableUtils->get_site_attribute("FQDNfirst"); + if ( (defined($FQDNfirst[0])) && ( $FQDNfirst[0] =~ /^(1|yes|enable)$/i)) { $LONGNAME = "1"; } + # get site domain for backward compatibility - my $sitetab = xCAT::Table->new('site'); - if ($sitetab) { - my $dom = $sitetab->getAttribs({key=>'domain'},'value'); - if ($dom and $dom->{value}) { - $::sitedomain=$dom->{value}; - } + my @domain = xCAT::TableUtils->get_site_attribute("domain"); + if ($domain[0]) { + $::sitedomain=$domain[0]; } my $hoststab = xCAT::Table->new('hosts');