Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add lxd container type to cloud + local providers #4191
Conversation
jameinel
reviewed
Jan 26, 2016
| - if err != nil { | ||
| - errors = append(errors, err) | ||
| - } else if insideLXC { | ||
| + insideLXC := container.RunningInContainer() |
jameinel
Jan 26, 2016
Owner
Probably we should switch to "insideContainer" as the variable name for clarity.
jameinel
reviewed
Jan 26, 2016
| @@ -21,6 +22,8 @@ func NewContainerManager(forType instance.ContainerType, conf container.ManagerC | ||
| switch forType { | ||
| case instance.LXC: | ||
| return lxc.NewContainerManager(conf, imageURLGetter, looputil.NewLoopDeviceManager()) | ||
| + case instance.LXD: |
jameinel
Jan 26, 2016
Owner
I would think we need similar support for LoopDeviceManager from LXC containers. But I suppose that can be on a TODO.
jameinel
reviewed
Jan 26, 2016
| +) | ||
| + | ||
| +var requiredPackages = []string{ | ||
| + "lxd", |
tych0
Jan 26, 2016
Contributor
lxd-images is in lxd proper, so I don't think so. Calling out to that will go away soon as well, and we'll just use the API to import images as soon as the LXD simplestreams code lands.
jameinel
reviewed
Jan 26, 2016
| + | ||
| + for _, pack := range requiredPackages { | ||
| + pkg := pack | ||
| + if config.SeriesRequiresCloudArchiveTools(series) && |
jameinel
Jan 26, 2016
Owner
I'm not sure if we need this one, but I believe we do need to add something that knows to install "lxd/trusty-backports" on Trusty machines. IIRC CloudArchive was only needed for Precise? (And I'm guessing LXD isn't going to be available there.) I suppose you could still use a Trusty host with a Precise container?
tych0
Jan 26, 2016
Contributor
I thought cloud archive existed for trusty too (and will probably exist for xenial when it comes time to push updated versions), but I'm not an expert here. I'll see about adding some code to do the backports thing, though, thanks.
jameinel
reviewed
Jan 26, 2016
| +} | ||
| + | ||
| +func (i imageClient) EnsureImageExists(series string) error { | ||
| + name := i.ImageNameForSeries(series) |
jameinel
Jan 26, 2016
Owner
do we have to worry about architecture? Or that is naturally determined just by the local host architecture?
tych0
Jan 26, 2016
Contributor
Right, although it is possible to run i386 images on amd64 hosts, the architectures in general match. Of course we can support the i386 bit if that is necessary, but I suppose it isn't?
jameinel
reviewed
Jan 26, 2016
| - defer updateLXDVars(origDirname) | ||
| - | ||
| - cfg, err := lxdLoadConfig() | ||
| + cfg, err := lxdLoadConfig(path.Join(configDir, "config.yml")) |
jameinel
Jan 26, 2016
Owner
Were we going to try and change this to be config strings that we pass in, rather than maintaining a somewhat arbitrary config directory?
tych0
Jan 26, 2016
Contributor
Sure, but I don't know where/how to store it in juju's database, so I just left it as-is.
jameinel
Jan 27, 2016
Owner
So we do have the issue that we don't generally let Providers (and thus Broker/container.Managers) have direct DB access. So we'd need to be passing this information in via just extra parameters to Init or Config.
What are the things we need, certificates and the config that says to use "local"?
I know we have support for some of those things at the Provider level, to date we haven't needed them for Brokers. Will need some thought as you need a custom cert for every machine to every LXD, right? How do we validate the LXD's certificate, or do we just accept it as long as it is valid?
tych0
Jan 29, 2016
Contributor
On Tue, Jan 26, 2016 at 08:27:30PM -0800, John Arbash Meinel wrote:
@@ -52,11 +56,7 @@ var lxdLoadConfig = lxd.LoadConfig
func newRawClient(remote, configDir string) (*lxd.Client, error) {
logger.Debugf("loading LXD client config from %q", configDir)
- // This will go away once LoadConfig takes a dirname argument.
- origDirname := updateLXDVars(configDir)
- defer updateLXDVars(origDirname)
- cfg, err := lxdLoadConfig()
- cfg, err := lxdLoadConfig(path.Join(configDir, "config.yml"))
So we do have the issue that we don't generally let Providers (and thus Broker/container.Managers) have direct DB access. So we'd need to be passing this information in via just extra parameters to Init or Config.
What are the things we need, certificates and the config that says to use "local"?
We don't need any certificates if you only want to talk to the LXD
provider on the local host, just enough perms to write to
/var/lib/lxd/unix.socket
I know we have support for some of those things at the Provider level, to date we haven't needed them for Brokers. Will need some thought as you need a custom cert for every machine to every LXD, right? How do we validate the LXD's certificate, or do we just accept it as long as it is valid?
If you're only talking to the local lxd, since it's the only thing
that can listen on /var/lib/lxd/unix.socket, so there is no
authentication required. Things get a little more complicated when you
want to talk to remotes, but as far as I can tell we don't need to do
that (at least right now with the LXD provider/container type).
jameinel
reviewed
Jan 26, 2016
| @@ -68,6 +69,8 @@ var VerifyPrerequisites = func(containerType instance.ContainerType) error { | ||
| switch containerType { | ||
| case instance.LXC: | ||
| return verifyLxc() | ||
| + case instance.LXD: | ||
| + return nil |
|
I think there are still a few steps that we'll need to add to bring it up to par with LXC. Things like creating template images and caching them in global state so that the time to bring up a large deployment with containers doesn't regress. I'm also concerned that there aren't any new tests, even though there is a fair amount of new code being added. While I have some faith that Tycho is writing decent code, I'm concerned about future maintenance for people that don't understand this code as well, and may not know what the assumptions are. |
|
On Tue, Jan 26, 2016 at 03:56:44AM -0800, John Arbash Meinel wrote:
Yep, definitely.
Yep, I can add some tests for this (similar to what the LXC tests do). |
pushed a commit
to tych0/juju-utils
that referenced
this pull request
Jan 26, 2016
tych0
referenced this pull request
in juju/utils
Jan 26, 2016
Merged
add config.RequiresBackports #192
|
Ok, I believe I've addressed all the review comments modulo the test bits which I'll try to address tomorrow (got some other kernel goop to debug today). I've also rebased things since there were patches that landed in master that conflicted. |
added a commit
to juju/utils
that referenced
this pull request
Jan 27, 2016
|
I did just try to bootstrap this branch on EC2 with a Trusty target, and it failed because it couldn't install just "LXD". The worker that failed kept dying and trying again. So we'll have to think carefully about how we enable trusty, given the need for more than just the obvious package. |
|
On Wed, Jan 27, 2016 at 04:27:10AM -0800, John Arbash Meinel wrote:
Right, this is a known bug (see the commit message), which apparently
|
|
On Wed, Jan 27, 2016 at 04:27:10AM -0800, John Arbash Meinel wrote:
I guess that's a good point, though, that even with the bugfix we'll |
|
@tycho FYI, this repo has integration with reviewboard: https://github.com/juju/juju/blob/master/CONTRIBUTING.md#code-review However, that does not work until you have logged in to reviewboard the first time. I'd recommend doing that so future PRs will automatically have review requests created. |
|
Hi folks. I've pushed some sanity tests here, as well as fixed another bug. I think it would be good to land this so we can get people to start playing with it (and/or land #4131 so at least the 0.27 incompatibility is fixed). Thoughts? |
cherylj
commented
Feb 3, 2016
|
@tych0 master is attempting to get a bless so we can ship alpha2. Once we get a bless and ship alpha2, then we should merge this. |
|
Ok. It's probably worth landing #4131 at least, then. |
cherylj
commented
Feb 3, 2016
|
Could you guys drop this in a feature branch so it could get some CI testing before landing into master? You will need to rebase as the api-command-rename branch has landed, and without those changes, nothing will pass CI. |
|
On Wed, Feb 03, 2016 at 06:48:19AM -0800, Cheryl Jennings wrote:
I don't know how to do that, exactly. Are there any docs on how you
Thanks for the heads up, I've rebased both this and #4131 in case you |
and others
added some commits
Jan 14, 2016
|
And rebased again :) |
cherylj
commented
Feb 5, 2016
|
This PR is currently in feature branch lxd-container-type for CI testing and can be closed. We will merge the feature branch into master when it has passed CI. |
tych0 commentedJan 22, 2016
Hello folks,
Here's a patchset that adds lxd container type support for all the cloud providers + local provider. Some notes:
Thoughts appreciated!