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

Support suspending machines #763

Merged
merged 3 commits into from
Jul 30, 2015

Conversation

sjcorbett
Copy link
Contributor

Locations can indicate that they can suspend machines by implementing a new SuspendsMachines interface.

A use of this is given in MachineLifecycleEffectorTasks, which provides a suspend effector implementation. Attaching this effector to entities is left to subclasses of MLET.

An interface for locations that can resume machines is also given but unused. I began an implementation but realised that we need to discuss what it means to "resume" a machine. Eventually JcloudsLocation should implement SuspendResumeLocation rather than SuspendsMachines.

@sjcorbett
Copy link
Contributor Author

@neykov I think the existing stop effector behaviour is your work so would appreciate your wisdom on these additions.

@sjcorbett sjcorbett force-pushed the feature/suspend-resume-location branch from 14b23cb to 1d1910f Compare July 21, 2015 16:30
@asfbot
Copy link

asfbot commented Jul 21, 2015

incubator-brooklyn-pull-requests #1499 FAILURE
Looks like there's a problem with this pull request

@asfbot
Copy link

asfbot commented Jul 21, 2015

incubator-brooklyn-pull-requests #1498 SUCCESS
This pull request looks good

@sjcorbett
Copy link
Contributor Author

Seems we've got unpredictable tests again..

.parameter(StopSoftwareParameters.STOP_MACHINE_MODE)
.impl(newSuspendEffectorTask())
.build();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the semantics of stopMachineMode here? Would IF_NOT_STOPPED really mean IF_NOT_SUSPENDED? How does this interact with stop? Is a suspended machine stoppable via stop(IF_NOT_STOPPED)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suspending a machine has the same semantics as stopping a machine. They both use MachineLifecycleEffectorTasks#doStop. The former calls MachineProvisioningLocation#release (which becomes JcloudsLocation#releaseNode), the latter MachineManagementMixins.SuspendsMachines#suspendMachine (which becomes JcloudsLocation#suspendMachine). A suspended machine cannot subsequently be stopped if IF_NOT_STOPPED is true because MachineLifecycleEffectorTasks#doStop sets the entity's state to STOPPED.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.. except of course that when suspending a machine JcloudsLocation does not call the pre- and post-release methods of any attached JcloudsLocationCustomizers. I think this is fair given that the machine may be resumed.

@neykov
Copy link
Member

neykov commented Jul 23, 2015

Finished review, a couple of comments worth addressing.

ResumeLocation will tie nicely with your proposal for binding JcloudsLocation to existing machines.

@sjcorbett sjcorbett force-pushed the feature/suspend-resume-location branch from 1d1910f to bfdb092 Compare July 28, 2015 12:46
@asfbot
Copy link

asfbot commented Jul 28, 2015

incubator-brooklyn-pull-requests #1534 SUCCESS
This pull request looks good

@sjcorbett
Copy link
Contributor Author

I think I've addressed the comments. I took the opportunity to name all the anonymous classes in MachineLifecycleEffectorTasks and its subclasses.

@sjcorbett sjcorbett force-pushed the feature/suspend-resume-location branch from bfdb092 to fcb1af0 Compare July 29, 2015 16:00
@asfbot
Copy link

asfbot commented Jul 29, 2015

incubator-brooklyn-pull-requests #1542 SUCCESS
This pull request looks good

@alasdairhodge
Copy link
Contributor

We have no way to trigger the SUSPENDED to STOPPED transition within Brooklyn, but if this is fine (and it is for my customer project) then I'd be delighted to see this merged.

@sjcorbett
Copy link
Contributor Author

Thanks for the comments. I will merge this.

@asfgit asfgit merged commit fcb1af0 into apache:master Jul 30, 2015
asfgit pushed a commit that referenced this pull request Jul 30, 2015
@Override
public Void call(ConfigBag parameters) {
Collection<? extends Location> locations = null;
return new StartEffectorBody();
Copy link
Member

Choose a reason for hiding this comment

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

This will break rebinding as the anonymous classes will be needed when reconstructing the entities. The approach used to keep backwards compatibility in similar cases is to keep the methods creating the anonymous classes but not use them, i.e. rename to newStartEffectorTaskDeprecated and change its visibility to private. Only needed for the newXXXEffectorTask methods. Once #738 is merged one could instead add code to do the rename on the fly.
Apologies for writing this late, was just able to review this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will affect anybody who ran a 0.8.0-SNAPSHOT server with persistence since #735 was closed, on the tenth of July, right? What do you think? Revert fcb1af0 and only name the new suspend effector? How many users are using the latest snapshots?

Copy link
Member

Choose a reason for hiding this comment

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

I think both re-introducing the effector anonymous classes (in inaccessible methods) or reverting is a valid way to go.
The effect should be quite limited (I'd say non-existent) because users have to explicitly re-configure the key with a LifecycleEffectorTasks instance. Using it as a default value doesn't get it serialized.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sjcorbett @neykov This is a bit scary. I just hit it in my testing for a customer release. But that's because I tested a release candidate a day ago and then again today with this change.

Looking at what is persisted (with non-static classes etc), it feels scary for trying to support (or transform) that in future releases.

I'm going to change SoftwareProcess. LIFECYCLE_EFFECTOR_TASKS so that if the config is null it defaults to as before; if it's non-null then it will use the config value. That means we can take our time over whether we want to have a SoftwareProcessDriverLifecycleEffectorTasks instances persisted by pretty much every customer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I see that this is kind-of separate from LIFECYCLE_EFFECTOR_TASKS.

@sjcorbett Why will it not affect previous users, where their code did LIFECYCLE_TASKS.attachLifecycleEffectors(this) so will have populated the effector body?

@sjcorbett sjcorbett deleted the feature/suspend-resume-location branch September 8, 2015 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants