[lxc-devel] [LXD] Default routes changes.

Serge Hallyn serge.hallyn at ubuntu.com
Fri Dec 19 18:56:49 UTC 2014


Quoting Kunal Kushwaha (kunalkushwahaoss at gmail.com):
> Hi,
> 
> With ref to LXD issue #114 <https://github.com/lxc/lxd/issues/114>
> 
> There are two ways to implement the default roots.
> 
> 1. Initialize within code.
> Instead of initializing with empty Config Structure at
> https://github.com/lxc/lxd/blob/master/config.go#L56
> 
> can  be initialized as
> 
> remotes := map[string]RemoteConfig{
> "images": RemoteConfig{"https+registry://registry.linuxcontainers.org"},
> "local":  RemoteConfig{"unix+lxd://var/lib/lxd/socket"},
> }
> 
> defaultConfig := &Config{TestOption: "",
> DefaultRemote: "",
> Remotes:       remotes,
> ListenAddr:    "80"}
> 
> 
> 
> 2. Create a default config file.
> While installation, a default config.yml can be create with default
> settings.
> 
> ---
> test-option:
> default-remote:
> remotes:
>   images:
>     addr: https+registry://registry.linuxcontainers.org
>   local:
>     addr: unix+lxd://var/lib/lxd/socket
> listen-addr: 80
> 
> 
> Which approach is better?

The comment at https://github.com/lxc/lxd/blob/master/config.go#L55 says
that a missing config == default config.  So it sounds like:

1. if there is no specified config, use the two defaults (hard-coded in code)

2. user can add more entries, which results in a config being written out,
which includes bot the two defaults and the new config

3. user can remove entries from the config file, including the defaults.  The
defaults are not re-added unless the config file is deleted altogether.

my 2c
-serge


More information about the lxc-devel mailing list