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

RFR: Using Ironic vendor passthru for heartbeat #66

Merged
merged 17 commits into from
Mar 19, 2014

Conversation

joshgachnang
Copy link
Contributor

This will be broken until I get the py26 fixes in.

@joshgachnang joshgachnang changed the title WIP: Using Ironic vendor passthru for heartbeat RFR: Using Ironic vendor passthru for heartbeat Mar 18, 2014
path = '/{api_version}/agents/{mac_addr}/configuration'.format(
api_version=self.api_version,
mac_addr=mac_addr)
def get_configuration(self, mac_addrs, ipaddr, hardware_info, mode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename this to something like lookup_node()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, drop the mode and version arguments (IMO it makes sense to pass those in the heartbeat, and maybe we can put the version in a User-Agent header in a different PR, but not needed here).

Also, doesn't hardware_info include the MAC addresses?

@@ -143,6 +142,12 @@ def get_status(self):
def get_agent_mac_addr(self):
return self.hardware.get_primary_mac_address()

def get_all_mac_addrs(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

You can kill this method now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any need for get_agent_mac_addr any more? The vendor passthru takes all the MACs and finds the matching nodes and ensures they're the same node.

Copy link
Contributor

Choose a reason for hiding this comment

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

No. Once this is merged, do a separate PR that kills get_agent_mac_addr and get_primary_mac_addr.

The driver won't be able to save anything during the first node lookup, so
sending the URL then won't be useful.
self.listen_address = listen_address
self.ipaddr = ipaddr
self.port = port
Copy link
Contributor

Choose a reason for hiding this comment

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

For silly reasons listen_address is actually already a tuple of (listen_host, listen_port)

@@ -143,6 +141,9 @@ def get_status(self):
def get_agent_mac_addr(self):
return self.hardware.get_primary_mac_address()

def get_node_uuid(self):
return self.node['uuid']
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably check if self.node is None first, in case we manage to heartbeat before the node is looked up (or lookup fails).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If lookup fails, it'd throw an uncaught exception. But still a worthwhile check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, yeah, that's what I want to avoid :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. lookup_node should probably be run in a loop with a timeout or something then, instead of the one shot or throw exception it has right now.

@joshgachnang
Copy link
Contributor Author

I still need to write something to deal with lookup_node throwing an exception or not being able to hit the Ironic API. Probably a loop with a timeout and/or put it inside the TeethAgentHeartbeater right before do_heartbeat().

'commands to. This is different than '
'listen-host because Docker will have a '
'different internal IP than the host IP that '
'Ironic will be communicating with.'))
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this shouldn't be Docker-specific. There are any number of reasons that the public IP might not match the listen IP.

Copy link
Contributor

Choose a reason for hiding this comment

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

And there are lots of reasons it would be different than the listen IP as well, such as NAT.

@jayofdoom
Copy link
Contributor

Other than docs comment, LGTM


return TeethAgent(api_url=api_url,
advertise_address=(advertise_host, advertise_port),
listen_address=(listen_host, listen_port))
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're going to call these as keyword args here, can we also make them keyword args in the function definition? (or vice versa, of course, make them positional args here)

@jimrollenhagen
Copy link
Contributor

Other than my nitpick there, lgtm.

joshgachnang pushed a commit that referenced this pull request Mar 19, 2014
Using Ironic vendor passthru for heartbeat
@joshgachnang joshgachnang merged commit 6e36652 into master Mar 19, 2014
@joshgachnang joshgachnang deleted the JoshNang/heartbeat branch March 19, 2014 22:46
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

4 participants