[pve-devel] [PATCH container] seperate serachdomain and nameserver config
Dominik Csapak
d.csapak at proxmox.com
Tue Mar 6 11:08:04 CET 2018
until now, if either searchdomain or nameservers was not set,
we used the values from the host.
it would make sense, to set this individually (e.g. only use a
different searchdomain)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/LXC/Setup/Base.pm | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
index 0228fe7..62e37b9 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -28,27 +28,24 @@ sub lookup_dns_conf {
my $nameserver = $conf->{nameserver};
my $searchdomains = $conf->{searchdomain};
- if (!($nameserver && $searchdomains)) {
-
- if ($conf->{'testmode'}) {
-
- $nameserver = "8.8.8.8 8.8.8.9";
- $searchdomains = "proxmox.com";
-
- } else {
-
- my $host_resolv_conf = $self->{host_resolv_conf};
+ if ($conf->{'testmode'}) {
+ return ('proxmox.com', '8.8.8.8 8.8.8.9');
+ }
- $searchdomains = $host_resolv_conf->{search};
+ my $host_resolv_conf = $self->{host_resolv_conf};
- my @list = ();
- foreach my $k ("dns1", "dns2", "dns3") {
- if (my $ns = $host_resolv_conf->{$k}) {
- push @list, $ns;
- }
+ if (!defined($nameserver)) {
+ my @list = ();
+ foreach my $k ("dns1", "dns2", "dns3") {
+ if (my $ns = $host_resolv_conf->{$k}) {
+ push @list, $ns;
}
- $nameserver = join(' ', @list);
}
+ $nameserver = join(' ', @list);
+ }
+
+ if (!defined($searchdomains)) {
+ $searchdomains = $host_resolv_conf->{search};
}
return ($searchdomains, $nameserver);
--
2.11.0
More information about the pve-devel
mailing list