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

Make machine present in workspace runtime when starting event is sent #8210

Merged
merged 4 commits into from
Jan 11, 2018

Conversation

garagatyi
Copy link

What does this PR do?

Make machine present in workspace runtime when starting event is sent.
Also set machine RUNNING status before bootstrapping installers and
checking servers statuses.

What issues does this PR fix or reference?

Fixes #7900
Fixes #8056

Release Notes

Docs PR

@garagatyi garagatyi added kind/bug Outline of a bug - must adhere to the bug report template. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Jan 9, 2018
@garagatyi
Copy link
Author

ci-build

@garagatyi
Copy link
Author

ci-test

@codenvy-ci
Copy link

throws InternalInfrastructureException {
if (machines != null) {
if (!machines.containsKey(name)) {
throw new InternalInfrastructureException("Machine is not in a STARTING state");
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 it doesn't really mean that machine is not STARTING. The condition will be true even when a machine is RUNNING. But is this check critical?
What we can do

  • add checking that a machine has STARTING status;
  • do not check that and put a new machine in any case.

Copy link
Member

Choose a reason for hiding this comment

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

RunningDockerMachine everywhere looks not so good. And StaringDockerMachine is a stub that cannot be used outside of DockerInternalRuntime.
I propose to consider the following way:

  1. Create StartingDockerMachine internal class of DockerInternalRuntime that will extend Machine.
  2. Have two methods in StartSynchronizer: one for getting Machine (public representation) and another one for getting DockerMachine (internal representation).

Then we won't need a refactoring and having an interface for DockerMachine.
Let me know if I didn't explain good enough.
WDYT?

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:8210
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

…arting event is sent

Also set machine RUNNING status before bootstrapping installers and
checking servers statuses.
Signed-off-by: Oleksandr Garagatyi <ogaragat@redhat.com>
@garagatyi
Copy link
Author

@sleshchenko I reworked the PR in accordance with our discussion. Please, take a look

@garagatyi
Copy link
Author

ci-test

/** Name of the latest tag used in Docker image. */
public static final String LATEST_TAG = "latest";

private static final Logger LOG = getLogger(DockerMachine.class);
Copy link
Member

Choose a reason for hiding this comment

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

I'd revert this moving

Copy link
Author

Choose a reason for hiding this comment

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

+1

* @throws InternalInfrastructureException if machine is not present in this storage which means
* that correct runtime start flow is broken
*/
public synchronized void replaceMachine(String name, DockerMachine machine)
Copy link
Member

Choose a reason for hiding this comment

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

method name says nothing about STARTING machines. Why do we need this method?
Maybe it would be good enough to have only putMachine(String name, DockerMachine machine) instead of addMachine and replaceMachine.

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking about preventing misuse of the method

Copy link
Author

Choose a reason for hiding this comment

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

Agree to simplify this

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM.
Separated thanks for refactoring of StartSynchonizer.

try {
startMachine(machineName, config);
DockerMachine machine = startMachine(machineName, containerEntry.getValue());
Copy link
Member

@sleshchenko sleshchenko Jan 10, 2018

Choose a reason for hiding this comment

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

Let's put running machine into runtimeMachines here instead of in startMachine method. I think it will make it more clear that starting machine will be updated.


/** Returns machines map. If runtime start is canceled returns empty map. */
public synchronized Map<String, DockerMachine> getMachines() {
return machines != null ? machines : emptyMap();
Copy link
Contributor

@akorneta akorneta Jan 10, 2018

Choose a reason for hiding this comment

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

As I understand here it is better to return the copy of original machines, because of guarantee that it won't be modified by RuntimeMachines and you can traverse on it(like here) without risking of concurrent modification.

Copy link
Author

Choose a reason for hiding this comment

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

The copy is done here, whereas this component is kinda internal, so I would leave it as is, for now

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:8210
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

Copy link
Contributor

@akorneta akorneta left a comment

Choose a reason for hiding this comment

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

It's a cool that you decoupled the DockerInternalRuntime, Good Job.

@garagatyi
Copy link
Author

@akorneta you are right. I've fixed that

@garagatyi garagatyi merged commit 4f8f5e9 into eclipse-che:master Jan 11, 2018
@garagatyi garagatyi deleted the machineStatusFix branch January 11, 2018 09:35
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jan 11, 2018
@benoitf benoitf added this to the 6.0.0-M5 milestone Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
6 participants