[pve-devel] [PATCH manager 2/4] fix lxc hostname editing

Dominik Csapak d.csapak at proxmox.com
Wed Jul 6 13:54:49 CEST 2016


>>>
>>> not sure if localhost itself is not a particulary good placeholder, as
>>> it is not unique, and will create a duplicate entry in the /etc/hosts
>>> container
>>
>> The issue was that on the backend side if no hostname is set we do use
>> 'localhost' rather than 'ct$vmid' as the gui suggested.
>
> it seems the behaviour on the backend differs depending on which LXC
> template you use because using Centos6 and Debian8 templates, I do get a
> hostname of the form "CT$vmid".
>
> could it be that some other templates override the base behaviour here ?
>

after a bit of testing and looking it is sadly a not so simple

the jsonschema has "hostname" as optional, but on container create it 
generates "CT$vmid" as hostname

since it is marked optional you can manually delete it fine from 
$vmid.conf without complaining when starting

now thing get ugly.

if we get no hostname we set "lxc.utsname = CT$vmid" (in sub 
update_lxc_config) meaning the hostname in lxc is CT$vmid, but in the 
setup code we consistently set hostname to 'localhost' if no one is set

my propsal would be that we either set it consistently in the setup and 
in update_lxc_config, or we make it not optional in the jsonschema to 
prevent deleting it

so this patch from me can be ignored either way




More information about the pve-devel mailing list