-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add notifications for leases #134
Conversation
One question: is it possible for the Lease payload to include the Ironic Node payload? At the minimum, we probably want to have the node name and uuid and maybe the power state and provisioning state. |
Yes, I can add them into lease payload. |
ae7a636
to
360ffdc
Compare
3e7a470
to
e8246e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! A few comments.
I made changes to the code according to the comments. I will test it on demo server sometime tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Some rather scattered comments, plus a bigger concern about the setting of resource information.
self._node_name = None | ||
self._provision_state = None | ||
self._power_state = None | ||
self._node_properties = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - notifications won't work on dummy/fake nodes unless they have these values as well, correct? I'm not sure we want to set these values however; adding a comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Notification only works on ironic nodes currently.
c391c15
to
8753b62
Compare
I created a new class LeaseResourceEvent to pass in notification emit method. The new changes has been tested in demo server. A message json body looks like this:
|
|
||
|
||
@versioned_objects_base.VersionedObjectRegistry.register | ||
class LeaseResourceEvent(base.ESILEAPObject): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at the Ironic code, and I'm pretty sure that what's done here can simply be done in LeaseCRUDPayload (which makes sense to me because otherwise that class isn't used all that much). Take a look at the Payloads in ironic/objects/node.py
; they set values similar to what you do here. If you agree, then you can just move the logic in this class into LeaseCRUDPayload, and instantiate Payloads instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes updated.
add unit tests Move emit notification to objects layer add lease_resource_event object
Update: tested on demo server. The notification message is
|
Looks good - thanks! |
In progress