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.csa...@proxmox.com>
---
 src/PVE/LXC/Config.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 0ad32f4..854b509 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -737,8 +737,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,
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to