Skip to content

baremetal: add network_data to Node interface#2154

Merged
jtopjian merged 1 commit intogophercloud:masterfrom
zaneb:baremetal-node-network_data
May 11, 2021
Merged

baremetal: add network_data to Node interface#2154
jtopjian merged 1 commit intogophercloud:masterfrom
zaneb:baremetal-node-network_data

Conversation

@zaneb
Copy link
Copy Markdown
Contributor

@zaneb zaneb commented May 7, 2021

This field was added in microversion 1.66 and appears in the Victoria release.

For #2153

Links to the line numbers/files in the OpenStack source code that support the
code in this PR:

https://opendev.org/openstack/ironic/src/branch/master/ironic/api/controllers/v1/node.py#L161-L165
https://review.opendev.org/c/openstack/ironic/+/687910/

@coveralls
Copy link
Copy Markdown

coveralls commented May 7, 2021

Coverage Status

Coverage remained the same at 79.867% when pulling d59284b on zaneb:baremetal-node-network_data into 0fc2c97 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented May 7, 2021

Build failed.

@zaneb
Copy link
Copy Markdown
Contributor Author

zaneb commented May 7, 2021

recheck

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented May 7, 2021

Build failed.

@zaneb
Copy link
Copy Markdown
Contributor Author

zaneb commented May 7, 2021

Opened #2155 to report the (pre-existing) test failure.

This field was added in microversion 1.66 and appears in the Victoria
release.

Depends-On: theopenlab/openlab-zuul-jobs#1147
@zaneb zaneb force-pushed the baremetal-node-network_data branch from 2c7f4fa to d59284b Compare May 7, 2021 20:10
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented May 7, 2021

Build failed.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

@zaneb Thanks for submitting this. Just two comments that may not require any changes.

Owner string `json:"owner,omitempty"`

// Static network configuration to use during deployment and cleaning.
NetworkData map[string]interface{} `json:"network_data,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To confirm: this is just an arbitrary/generic map/dict/hash that will accept any data?

https://github.com/openstack/ironic/blob/462969c68f2978b4b250ba99ef491ef6858437fe/ironic/objects/node.py#L168

Normally if a field was added from a microversion, it should be a pointer so that the field is omitted from the boddy if it isn't set. But it looks like Ironic is accounting for having this field set when the microversion is less than 1.35: https://github.com/openstack/ironic/blob/462969c68f2978b4b250ba99ef491ef6858437fe/ironic/objects/node.py#L554

Because of this, I'm okay with leaving it as map[string]interface{}, but if you wanted to change it to *map[string]interface{}, go for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To confirm: this is just an arbitrary/generic map/dict/hash that will accept any data?

https://github.com/openstack/ironic/blob/462969c68f2978b4b250ba99ef491ef6858437fe/ironic/objects/node.py#L168

For these purposes, I think we have to treat it as that. Ironic does do json schema validation on it, by default to check that it matches the Nova network_data.json format. However, that format could theoretically change over time, and there's also a config option to allow the operator to specify a different schema (which is how I actually want to use this).

Normally if a field was added from a microversion, it should be a pointer so that the field is omitted from the boddy if it isn't set. But it looks like Ironic is accounting for having this field set when the microversion is less than 1.35: https://github.com/openstack/ironic/blob/462969c68f2978b4b250ba99ef491ef6858437fe/ironic/objects/node.py#L554

Because of this, I'm okay with leaving it as map[string]interface{}, but if you wanted to change it to *map[string]interface{}, go for it.

If you're OK with it I think I'd prefer to leave it, because there's no useful distinction between the field being empty vs. not set.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you're OK with it I think I'd prefer to leave it, because there's no useful distinction between the field being empty vs. not set.

In this case, I agree. Usually it's because the API will return an error for an invalid field when the microversion isn't set correctly.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

LGTM. I think this is safe to merge even with the failing OpenLab tests.

@jtopjian jtopjian merged commit d49f498 into gophercloud:master May 11, 2021
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.

3 participants