Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate containers in dependency order #1444

Merged
merged 1 commit into from
May 26, 2015

Conversation

aanand
Copy link

@aanand aanand commented May 21, 2015

Sits on top of #1441.

This fixes a bug introduced by #1441 where migration would fail with an error if a downstream container was migrated before its upstream dependencies (e.g. web before db), due to check_for_legacy_containers() being implicitly called when we fetch links, volumes_from or net dependencies.

@aanand aanand force-pushed the migrate-in-dependency-order branch 2 times, most recently from bf2028c to 3fae80b Compare May 21, 2015 17:32
@aanand aanand modified the milestone: 1.3.0 May 21, 2015
@aanand aanand force-pushed the migrate-in-dependency-order branch from 3fae80b to 7714675 Compare May 26, 2015 10:55
aanand referenced this pull request in aanand/fig May 26, 2015
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This fixes a bug where migration would fail with an error if a
downstream container was migrated before its upstream dependencies, due
to `check_for_legacy_containers()` being implicitly called when we fetch
`links`, `volumes_from` or `net` dependencies.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
@aanand aanand force-pushed the migrate-in-dependency-order branch from 7714675 to 7da8e6b Compare May 26, 2015 15:03
containers = client.containers(all=stopped)

for service in services:
for container in containers:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so if I understand this correctly, the change here is that now we're iterating over things in the order of the passed in services, instead of just the container list order (which is basically undefined).

We have to assume the services were passed in the correct order, but that's probably safe to assume, since that's how we store them generally.

Does that sound right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry, the actual fix is a bit subtle - it relies on the fact that Project keeps its services in order, and so project.service_names returns them in order. That's a widely relied-upon constraint, though, so I don't think this is brittle.

@dnephin
Copy link

dnephin commented May 26, 2015

LGTM

aanand added a commit that referenced this pull request May 26, 2015
Migrate containers in dependency order
@aanand aanand merged commit 1344099 into docker:master May 26, 2015
@aanand aanand deleted the migrate-in-dependency-order branch May 26, 2015 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants