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

Added ttl for node status. #624

Merged
merged 2 commits into from
Sep 26, 2017
Merged

Conversation

nnDarshan
Copy link
Contributor

This patch adds heartbeat updation during node sync.
If the node goes down due to any reason, the heart
beat object will vanish after some time. Thus API
layer can get to know that node is down and mark it
accordingly.

tendrl-bug-id: #592
Signed-off-by: nnDarshan darshan.n.2024@gmail.com

@nnDarshan
Copy link
Contributor Author

@r0h4n @shtripat @anivargi @nthomas-redhat Please review

@nnDarshan
Copy link
Contributor Author

nnDarshan commented Sep 18, 2017

NOTE: This patch is dependent on: Tendrl/commons#738. So please merge this only after merging above patch

@nnDarshan nnDarshan changed the title Added heartbeat updation during node sync. Added ttl for node status. Sep 18, 2017
@@ -29,12 +29,12 @@ def _run(self):
current_tags += ["tendrl/node_%s" % NS.node_context.node_id]
NS.node_context.tags = list(set(current_tags))
NS.node_context.save()

SYNC_TTL = int(NS.config.data.get("sync_interval", 10)) + 250
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest you add 100 instead of 250

Also, SYNC_TTL should be _sync_ttl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack


sync_disks_thread = gevent.spawn(disk_sync.sync)
sync_disks_thread.join()

sync_networks_thread = gevent.spawn(network_sync.sync)
sync_networks_thread.join()

if "tendrl/monitor" in NS.node_context.tags:
update_node_status_thread = gevent.spawn(
node_status_update.update)
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of node_status_update.update

call it "check_all_managed_nodes_status.run()"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

NS._int.client.read(
"/nodes/{0}/NodeContext/status".format(node_id)
)
except etcd.EtcdKeyNotFound:
Copy link
Contributor

Choose a reason for hiding this comment

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

This read and then write is not atomic

use

NS._int.wclient.write(integration_index_key,

instead of reading and then writing, catch etcd.EtcdAlreadyExist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

This patch adds ttl fol node status . If the node goes
down due to any reason, the status attribute will vanish
after some time. Thus API layer can get to know that
node is down and mark it accordingly.

tendrl-bug-id: Tendrl#592
Signed-off-by: nnDarshan <darshan.n.2024@gmail.com>
@r0h4n r0h4n merged commit 9753c32 into Tendrl:master Sep 26, 2017
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.

None yet

2 participants