]> git.proxmox.com Git - pve-container.git/commitdiff
allow deleting of container hostname
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 4 Jul 2016 13:36:16 +0000 (15:36 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 25 Jul 2016 07:24:47 +0000 (09:24 +0200)
since we allow to create a container without hostname
(we are using localhost by default then) and hostname
is marked optional in the JSONSchema of the config
we should be able to delete the hostname

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/LXC/Config.pm

index 79882032acfbd148b3bc9cf66735dc0a1d0c8386..cfe952f2fe168c1816e08243316d2cac1204fc55 100644 (file)
@@ -766,8 +766,10 @@ sub update_pct_config {
                next;
            }
 
-           if ($opt eq 'hostname' || $opt eq 'memory' || $opt eq 'rootfs') {
+           if ($opt eq 'memory' || $opt eq 'rootfs') {
                die "unable to delete required option '$opt'\n";
+           } elsif ($opt eq 'hostname') {
+               delete $conf->{$opt};
            } elsif ($opt eq 'swap') {
                delete $conf->{$opt};
                PVE::LXC::write_cgroup_value("memory", $vmid,