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

Changed Unmanage flow - Unmanage cluster will happen per node and not via tendrl/monitor #975

Closed
wants to merge 6 commits into from

Conversation

anmolsachan
Copy link
Member

@anmolsachan anmolsachan commented May 22, 2018

tendrl-bug-id: #841
bugzilla: 1583590
Signed-off-by: Anmol Sachan anmol13694@gmail.com

@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@anmolsachan anmolsachan requested a review from a team as a code owner May 22, 2018 15:47
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@anmolsachan anmolsachan force-pushed the master branch 2 times, most recently from 0635467 to da12256 Compare May 22, 2018 19:25
@anmolsachan
Copy link
Member Author

@r0h4n @shtripat @GowthamShanmugam , Please review.

@anmolsachan
Copy link
Member Author

@Tendrl/admins Please DO NOT merge this PR, There is some new code that went in monitoring integration, need to verify again with same first.

@anmolsachan
Copy link
Member Author

anmolsachan commented May 24, 2018

@Tendrl/admins PR verified. Can be merged now.

raise FlowExecutionFailedError(
"Cluster is already in un-managed state"
)
if (_cluster.status is not None and
Copy link
Member

Choose a reason for hiding this comment

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

I feel this check should not be done on child task of un-manage flow, so cant you move this inside if condition at L#55?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Will put it in first condition itself rather than L#55. Flow will be like : Check if another job being executed or not ( checked by parent node which has accepted unmanage job) -> If not , lock the cluster and then run the unmanage flow for the parent node.

Copy link
Member

Choose a reason for hiding this comment

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

Ack

loop_count += 1
continue

# Deleting cluster details
Copy link
Member

Choose a reason for hiding this comment

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

Create a separate function for this and invoke here

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do it

_cluster = NS.tendrl.objects.Cluster(
integration_id=integration_id
).load()
_cluster.short_name = ""
Copy link
Member

Choose a reason for hiding this comment

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

Why short_name to be un-set after un-manage? After un-manage short_name should be retained I feel, and while re-import user should have option to provide a different name or retain the same.
@nthomas-redhat @r0h4n @julienlim thoughts?

Copy link
Member Author

@anmolsachan anmolsachan May 25, 2018

Choose a reason for hiding this comment

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

I have same thoughts, By design, it should be an option for user to retain the same name of the cluster as it was part of their infra before. Needs to be discussed.

Copy link
Member

Choose a reason for hiding this comment

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

So what I feel is, if cluster.short_name available while import populate the same in UI screen where list of nodes to be imported are listed. User still should be able to edit the field.

Copy link
Member

Choose a reason for hiding this comment

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

@shtripat @anmolsachan +1 that it would be nice to retain the short_name during the unmanage if possible so that if the same cluster was imported again, user had the option to reuse the same short name. However, if it's too complex, then we defer to this in the future as I think it's a nice-to-have.

@nthomas-redhat

Copy link
Member Author

Choose a reason for hiding this comment

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

@gnehapk Will this be a big change for UI ? Can this be done ?

Copy link
Member

Choose a reason for hiding this comment

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

@anmolsachan Its a small change in UI. UI will by populate cluster name field with short_name if exist else integration_id on import cluster flow. The cluster name is a editable field and can be changed by user. Created issue for the same Tendrl/ui#973

Copy link
Member Author

Choose a reason for hiding this comment

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

@gnehapk @shtripat Back-end will save the cluster name now. Made the required change

flow_id=self.parameters['flow_id']
)
loop_count = 0
# Wait for (no of nodes) * 6 minutes for unmanage to complete
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to wait for 6 mins per node for un-manage to complete? Its not an import where packages installation etc happen. So I feel a couple of mins would more more than required.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Will reduce the time

super(StopIntegrationServices, self).__init__(*args, **kwargs)

def run(self):
services = ["tendrl-gluster-integration"]
Copy link
Member

Choose a reason for hiding this comment

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

Write a utility function which takes list of services and stops+disables the services. The same utility could be called from both the atoms, StopMonitoringServices and StopIntegrationServices.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, Will do it

@anmolsachan anmolsachan force-pushed the master branch 2 times, most recently from ec6a2a4 to ae376ce Compare May 28, 2018 14:44
@anmolsachan
Copy link
Member Author

anmolsachan commented May 28, 2018

@Tendrl/admins @shtripat Incorporated the recommended changes. Please review

Copy link
Member

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

Looks fine. Minor ones.


def run(self):
services = ["tendrl-gluster-integration"]
return service_utils.stop_service(services, self.parameters)
Copy link
Member

Choose a reason for hiding this comment

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

Make it one statement as below

return service_utils.stop_service(
    ['tendrl-gluster-integration'],
    self.parameters
)


def run(self):
services = ["collectd"]
return service_utils.stop_service(services, self.parameters)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@anmolsachan anmolsachan force-pushed the master branch 3 times, most recently from 2047775 to 280cef2 Compare May 30, 2018 08:57
)
return False
time.sleep(5)
finished = True
Copy link
Member

Choose a reason for hiding this comment

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

Recent changes from @GowthamShanmugam for failed vs finished jobs to be taken care as if one of the child jobs fail, we should not straightway fail the parent job. We should still wait for all the child jobs to finish/fail and then only parent job should be marked.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

Copy link
Member

Choose a reason for hiding this comment

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

Below code at L#114 still checks for finished state only. I feel if its finished or failed, in both cases we should break the loop. @GowthamShanmugam ?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes there also he has to change like job.status in ["finished", "failed"]

child_job = NS.tendrl.objects.Job(
job_id=child_job_id
).load()
if child_job.status != "finished":
Copy link
Member

Choose a reason for hiding this comment

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

I feel this can be as below

if child_job.status not in ['finished', 'failed']

@GowthamShanmugam ^^^ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will make the change

@anmolsachan
Copy link
Member Author

anmolsachan commented May 30, 2018

@shtripat @r0h4n Made the recommended changed. Also verified the pr. Please review

Copy link
Member

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

Over all looks fine. One small minor comment.
Make sure all the scenario are tested well and back to back import + unmanage + import is tested well.

)
return False
time.sleep(5)
finished = True
Copy link
Member

Choose a reason for hiding this comment

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

Below code at L#114 still checks for finished state only. I feel if its finished or failed, in both cases we should break the loop. @GowthamShanmugam ?

@anmolsachan
Copy link
Member Author

Updated And Verified.

@r0h4n
Copy link
Contributor

r0h4n commented Jun 6, 2018

@shtripat please complete your reviews on this

@r0h4n
Copy link
Contributor

r0h4n commented Jun 13, 2018

@shtripat @GowthamShanmugam Please finish reviewing this

Copy link
Member

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,55 @@
""" This utility can be used to handle(start, stop, etc.) tendrl services.
Copy link
Contributor

Choose a reason for hiding this comment

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

@shtripat @GowthamShanmugam Why we need another service util or did you guys miss this during review?

Could you help @anmolsachan with re-using and modifying below for this PR

https://github.com/Tendrl/commons/blob/master/tendrl/commons/utils/service.py

Copy link
Member

Choose a reason for hiding this comment

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

It does disabling of service as well so thought of writing new one. But I feel at least the code can move to https://github.com/Tendrl/commons/blob/master/tendrl/commons/utils/service.py

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Will make the change

… via tendrl/monitor

tendrl-bug-id: Tendrl#841
bugzilla: 1583590
Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
tendrl-bug-id: Tendrl#841
bugzilla: 1583590
Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
tendrl-bug-id: Tendrl#841
bugzilla: 1583590
Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
tendrl-bug-id: Tendrl#841
bugzilla: 1583590
Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
tendrl-bug-id: Tendrl#841
bugzilla: 1583590
Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
@anmolsachan
Copy link
Member Author

Closing thing for now, It will require a lot of change because of recent merges. Will raise a new PR if required, and will link to this one.

@anmolsachan anmolsachan closed this Jul 3, 2018
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.

7 participants