[pve-devel] [PATCH container] allow deleting of container hostname
Dominik Csapak
d.csapak at proxmox.com
Mon Jul 4 15:36:16 CEST 2016
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 at 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
More information about the pve-devel
mailing list