Commit 544413f3 authored by Dietmar Maurer's avatar Dietmar Maurer

automatically use DNS settings from host

parent 4a8674c9
......@@ -145,6 +145,21 @@ __PACKAGE__->register_method({
$tpath = basename($tpath);
$tpath =~ s/\.tar\.gz$//;
if (!defined($param->{searchdomain}) &&
!defined($param->{nameserver})) {
my $resolv = PVE::INotify::read_file('resolvconf');
$param->{searchdomain} = $resolv->{search} if $resolv->{search};
my @ns = ();
push @ns, $resolv->{dns1} if $resolv->{dns1};
push @ns, $resolv->{dns2} if $resolv->{dns2};
push @ns, $resolv->{dns3} if $resolv->{dns3};
$param->{nameserver} = join(' ', @ns) if scalar(@ns);
}
PVE::OpenVZ::update_ovz_config($conf, $param);
my $rawconf = PVE::OpenVZ::generate_raw_config($pve_base_ovz_config, $conf);
......
......@@ -264,12 +264,12 @@ my $confdesc = {
searchdomain => {
optional => 1,
type => 'string',
description => "Sets DNS search domains for a container.",
description => "Sets DNS search domains for a container. Create will automatically use the setting from the host if you neither set searchdomain or nameserver.",
},
nameserver => {
optional => 1,
type => 'string',
description => "Sets DNS server IP address for a container.",
description => "Sets DNS server IP address for a container. Create will automatically use the setting from the host if you neither set searchdomain or nameserver.",
},
ip_address => {
optional => 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment