lxc / go-lxc

Go bindings for liblxc
https://linuxcontainers.org/lxc
Other
430 stars 76 forks source link

DefaultConfigPath not consistent with GetConfigPath and SetConfigPath #129

Closed xmcqueen closed 5 years ago

xmcqueen commented 5 years ago

DefaultConfigPath in the lxc-binding is setting the path to the container root.

func DefaultConfigPath() string {
    return GlobalConfigItem("lxc.lxcpath")
} 

It seems to be used consistently for this purpose, its in all the examples and seems to be working perfectly. However, its confusing because in container.go I'm seeing SetConfigPath described as being used to set the configuration file's path - not the container root - which it does via go_lxc_set_config_path, which is described as being used to set the path to the containers's config file here:

https://linuxcontainers.org/lxc/apidoc/structlxc__container.html#ad140523960327ab5537629ee8dc62dd3

ConfigPath is used in the same way in container.go via the lxc-binding call to go_lxc_get_config_path. So the getter and the setter seem to be consistent. But the DefaultConfigPath seems to be confusingly misnamed. It should probably be DefaultContainerRoot.

get_config_path is described here:

https://linuxcontainers.org/lxc/apidoc/structlxc__container.html#a3cdd629f0b11a313938178a46b18a263

I'm not sure about advice, because changing that would break things. Its used in the Hashicorp nomad driver.

Should I put up a pr to rename it? It just sounds too hazardous.

xmcqueen commented 5 years ago

I see, there's another config in the container root.