[pve-devel] [PATCH 2/2] add hostname hotplug

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


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

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 7b7226b..9214dd2 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1047,6 +1047,9 @@ sub update_lxc_config {
 	my $value = $param->{$opt};
 	if ($opt eq 'hostname') {
 	    $conf->{'lxc.utsname'} = $value;
+            $lxc_setup->set_hostname($conf);
+            my $cmd = ['lxc-attach', '-n', $vmid, '--', 'hostname', $value ];
+            PVE::Tools::run_command($cmd);
 	} elsif ($opt eq 'onboot') {
 	    $conf->{'pve.onboot'} = $value ? 1 : 0;
 	} elsif ($opt eq 'startup') {
-- 
2.1.4




More information about the pve-devel mailing list