[lxc-devel] Configuration question?

Daniel Lezcano daniel.lezcano at free.fr
Tue Jan 26 21:43:39 UTC 2010


Michael H. Warfield wrote:
> On Tue, 2010-01-26 at 21:18 +0100, Daniel Lezcano wrote: 
>   
>> Michael H. Warfield wrote:
>>     
>>> I'm working on some scripts and I have a configuration question.  Yes I
>>> could probably read the code and figure out the answers for myself or
>>> just blindly try it but I figure if I ask here someone could say "no
>>> don't do that" or "hey that's not a bad idea" before I go charging
>>> ahead.
>>>
>>> Put simply...  Is is possible / permissible to add configuration
>>> variables to the config file?  I've been converting containers over from
>>> OpenVZ and there's some odd flags and values I would like to stuff in
>>> there.  Things like "ONBOOT" and "DESCRIPTION" from the OpenVZ file.  Is
>>> lxc-start and friends just going to ignore extraneous (to them)
>>> configuration options or are they going to complain or blow chunks?
>>>       
>> It will complain.
>>
>>     
>>> If it's possible, is there a convention you would like followed.  I'm
>>> thinking along this lines of this for those two examples:
>>>
>>> lxc.onboot = yes|no [default no]
>>> lxc.description = "Arbitrary String"
>>>
>>> Yes?  No?  Maybe?  Hell no?
>>>       
>
>   
>> I am not sure to understand. Can you elaborate a bit ?
>> Do you want to define some environment variables for the container via 
>> the lxc configuration file ? Or are these configuration variables 
>> specific (I don't know OpenVZ except by its name) ?
>>     
>
> OpenVZ supports specifying in their ve config files if a container gets
> started when the host is booted.  If it's not set, the container won't
> get started automatically at boot and has to be manually started.  This
> would be used by a front end startup script.  At boot time, it can check
> all the containers registered with it and start the ones set to
> autostart.  OpenVZ also has a "disabled" option where the container is
> disabled even from manual booting unless "force" is specified but I
> don't know that I see much use for that.  Description is just a high
> level description of the container for front ends and user interfaces.
> The reason I was thinking of putting it in the config file (which I did
> just try just a little bit ago and lxc-start didn't complain, but maybe
> it would in a debug print) is that way it would follow the other config
> variables when the container is created and I could just loop
> through /var/lib/lxc/*/config to find them.
>   
Ok got it, but it's not the right place to put these informations.
You can simply add a file /var/lib/lxc/*/onboot, this is the purpose of 
the lxc directory, store any external information in a single place.
So when you destroy the container, the lxc directory is removed with all 
the external material added at this place.





More information about the lxc-devel mailing list