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

Add machine undertaker worker #6082

Merged
merged 7 commits into from Aug 30, 2016
Merged

Conversation

babbageclunk
Copy link
Contributor

@babbageclunk babbageclunk commented Aug 24, 2016

This ensures any necessary provider-level cleanup is done before the machine is fully removed.

In particular, for containers in MAAS we need to release allocated addresses - the container provisioner can't do this because it has no way to talk to the provider directly. So now the provisioner task will mark the machine as ready for removal when its work is completed. This worker watches for the removal request, releases addresses for containers (where the provider supports it), and then removes the machine and associated records. It's expected that other provider-level cleanup like IP address management will be added here.

Fixes http://pad.lv/1585878.

QA steps:

  • bootstrapped against LXD (no container networking)
    • added and removed machines
  • bootstrapped against MAAS 1.9
    • added and removed machines
    • added and removed single-nic containers - checked that the addresses for the containers are gone from the host machine in the MAAS UI
    • added and removed multi-nic containers - checked that the addresses for the containers are gone from the host machine in the MAAS UI
  • bootstrapped against MAAS 2
    • added and removed machines
    • added and removed single-nic containers - checked that the addresses for the containers are gone from the host machine in the MAAS UI
    • added and removed multi-nic containers - checked that the addresses for the containers are gone from the host machine in the MAAS UI

(Review request: http://reviews.vapour.ws/r/5540/)

machineUndertakerName: ifNotMigrating(machineundertaker.Manifold(machineundertaker.ManifoldConfig{
APICallerName: apiCallerName,
EnvironName: environTrackerName,
NewWorker: machineundertaker.NewWorker,
Copy link
Contributor

Choose a reason for hiding this comment

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

you are likely to find manifold testing a bit easier if you supply NewFacade as a dependency too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't done this, since I'd already written the tests for the manifold, and in this case it wasn't too hard to contrive to get an error out of the real API client.

@babbageclunk babbageclunk force-pushed the machine-undertaker branch 2 times, most recently from 49039b1 to 7467d55 Compare August 25, 2016 13:19
... rather than waiting for the machine to be removed.

Also a drive-by fix of some test code that had become nonsensical over
time - getContainerInstance was using the OS to choose between identical
alternatives.
Plus some small tweaks to the worker to make it easier to test.
@babbageclunk
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Aug 30, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 5de605c into juju:master Aug 30, 2016
@babbageclunk babbageclunk deleted the machine-undertaker branch August 30, 2016 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants