mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
add dnsforwardmode for makedns (#5970)
* add forwardmode for makedns * polished * polished * update site table man doc * polished * polished
This commit is contained in:
parent
9ae3acb3b8
commit
59c1630e76
@ -135,6 +135,11 @@ site Attributes:
|
||||
service nodes will ignore this value and always be configured to forward
|
||||
to the management node.
|
||||
|
||||
dnsforwardmode: (first or only or no). This is to set forward value in named.conf options section.
|
||||
"first": causes DNS requests to be forwarded before an attempt is made to resolve them via the root name servers.
|
||||
"only": all requests are forwarded and none sent to the root name servers.
|
||||
"no": no request will be forwarded. This is the default value if not specified.
|
||||
|
||||
emptyzonesenable: (yes or no). This is to set empty-zones-enable value in named.conf options section.
|
||||
|
||||
master: The hostname of the xCAT management node, as known by the nodes.
|
||||
|
@ -1059,6 +1059,10 @@ passed as argument rather than by table value',
|
||||
" requests it does not know to these servers. Note that the DNS servers on the\n" .
|
||||
" service nodes will ignore this value and always be configured to forward \n" .
|
||||
" to the management node.\n\n" .
|
||||
" dnsforwardmode: (first or only or no). This is to set forward value in named.conf options section. \n" .
|
||||
" \"first\": causes DNS requests to be forwarded before an attempt is made to resolve them via the root name servers. \n" .
|
||||
" \"only\": all requests are forwarded and none sent to the root name servers.\n".
|
||||
" \"no\": no request will be forwarded. This is the default value if not specified. \n\n" .
|
||||
" emptyzonesenable: (yes or no). This is to set empty-zones-enable value in named.conf options section. \n\n" .
|
||||
" master: The hostname of the xCAT management node, as known by the nodes.\n\n" .
|
||||
" nameservers: A comma delimited list of DNS servers that each node in the cluster should\n" .
|
||||
|
@ -785,7 +785,7 @@ sub process_request {
|
||||
"Update Named Conf dir $ctx->{dbdir} $ctx->{zonesdir}";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
$ctx->{forwardmode} = get_forwardmode();
|
||||
update_namedconf($ctx, $slave);
|
||||
|
||||
unless ($slave)
|
||||
@ -935,6 +935,27 @@ sub get_zonesdir {
|
||||
return "$ZonesDir";
|
||||
}
|
||||
|
||||
sub get_forwardmode {
|
||||
my $forwardmode;
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("dnsforwardmode");
|
||||
my $site_entry = $entries[0];
|
||||
if (defined($site_entry)) {
|
||||
if ($site_entry =~ /^only$|^first$/) {
|
||||
$forwardmode = $site_entry;
|
||||
} elsif ($site_entry =~ /^no$/) {
|
||||
$forwardmode = ""
|
||||
}else {
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "forward mode $site_entry is not supported, supported value: only, first, no.";
|
||||
xCAT::MsgUtils->message("S", "forward mode $site_entry is not supported, supported value: only, first, no.");
|
||||
xCAT::MsgUtils->message("W", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return "$forwardmode";
|
||||
}
|
||||
|
||||
|
||||
sub get_conf {
|
||||
my $conf = "/etc/named.conf";
|
||||
|
||||
@ -1114,6 +1135,8 @@ sub update_namedconf {
|
||||
push @newnamed, "\t\t" . $_ . ";\n";
|
||||
}
|
||||
push @newnamed, "\t};\n";
|
||||
} elsif ($ctx->{forwardmode} and $line =~ /forward/) {
|
||||
push @newnamed, "\tforward " . $ctx->{forwardmode} . ";\n";
|
||||
} elsif ($ctx->{empty_zones_enable} and $line =~ /empty-zones-enable/) {
|
||||
push @newnamed, "\tempty-zones-enable " . $ctx->{empty_zones_enable} . ";\n";
|
||||
} elsif ($ctx->{slaves} and $line =~ /allow-transfer \{/) {
|
||||
@ -1255,6 +1278,10 @@ sub update_namedconf {
|
||||
push @newnamed, "\t};\n";
|
||||
}
|
||||
|
||||
if ($ctx->{forwardmode}){
|
||||
push @newnamed, "\tforward " . $ctx->{forwardmode} . ";\n";
|
||||
}
|
||||
|
||||
if ($ctx->{empty_zones_enable}){
|
||||
push @newnamed, "\tempty-zones-enable " . $ctx->{empty_zones_enable} . ";\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user