[pve-devel] [PATCH 1/2] add dns hotplug

Alexandre Derumier aderumier at odiso.com
Tue Jun 30 12:23:55 CEST 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/LXC.pm | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 36c3995..7b7226b 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1005,9 +1005,11 @@ sub update_lxc_config {
     my @nohotplug;
 
     my $rootdir;
+    my $lxc_setup;
     if ($running) {
 	my $pid = find_lxc_pid($vmid);
 	$rootdir = "/proc/$pid/root";
+	$lxc_setup = PVE::LXCSetup->new($conf, $rootdir);
     }
 
     if (defined($delete)) {
@@ -1025,12 +1027,10 @@ sub update_lxc_config {
 		delete $conf->{'pve.startup'};
 	    } elsif ($opt eq 'nameserver') {
 		delete $conf->{'pve.nameserver'};
-		push @nohotplug, $opt;
-		next if $running;
+		$lxc_setup->set_dns($conf);
 	    } elsif ($opt eq 'searchdomain') {
 		delete $conf->{'pve.searchdomain'};
-		push @nohotplug, $opt;
-		next if $running;
+		$lxc_setup->set_dns($conf);
 	    } elsif ($opt =~ m/^net(\d)$/) {
 		delete $conf->{$opt};
 		next if !$running;
@@ -1054,13 +1054,11 @@ sub update_lxc_config {
 	} elsif ($opt eq 'nameserver') {
 	    my $list = verify_nameserver_list($value);
 	    $conf->{'pve.nameserver'} = $list;
-	    push @nohotplug, $opt;
-	    next if $running;
+	    $lxc_setup->set_dns($conf);
 	} elsif ($opt eq 'searchdomain') {
 	    my $list = verify_searchdomain_list($value);
 	    $conf->{'pve.searchdomain'} = $list;
-	    push @nohotplug, $opt;
-	    next if $running;
+	    $lxc_setup->set_dns($conf);
 	} elsif ($opt eq 'memory') {
 	    $conf->{'lxc.cgroup.memory.limit_in_bytes'} = $value*1024*1024;
 	    write_cgroup_value("memory", $vmid, "memory.limit_in_bytes", $value*1024*1024);
-- 
2.1.4




More information about the pve-devel mailing list