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

CASMTRIAGE-1900: Add jinja render to rootfs_provider_passthrough to support iSCSI #265

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

annapoorna-s-alt
Copy link
Contributor

@annapoorna-s-alt annapoorna-s-alt commented Sep 19, 2024

Reviewer: Annapoorna

Summary and Scope

In order to suport iSCSI in CSM 1.6. jinja rendering of the rootfs_provider_passthrough value is necessary. Hence the functionality to render the value has been added.
For both UAN & Compute support has been added for the input yaml to be handled.

Issues and Related PRs

Testing

List the environments in which these changes were tested.

Tested on:

  • <Gamora>

Test description:

The modified input yaml file consisting of both iSCSI and DVS was considered for testing sat bootprep to create the session templates. It successfully was able to create all the type of templates.

Risks and Mitigations

minimal

Pull Request Checklist

  • Version number(s) incremented, if applicable
  • Copyrights updated
  • License file intact
  • Target branch correct
  • CHANGELOG.md updated
  • Testing is appropriate and complete, if applicable
  • HPC Product Announcement prepared, if applicable

@shivaprasad-metimath shivaprasad-metimath force-pushed the CASMTRIAGE-1900 branch 15 times, most recently from ee616ba to 4103f75 Compare September 23, 2024 13:14
@shivaprasad-metimath
Copy link
Contributor

@shivaprasad-metimath shivaprasad-metimath changed the title CASMTRIAGE-1900 CASMTRIAGE-1900: Add jinja render to rotfs_provider_passthrough to support iSCSI Sep 23, 2024
@shivaprasad-metimath shivaprasad-metimath force-pushed the CASMTRIAGE-1900 branch 5 times, most recently from d2a9eeb to 49583c6 Compare September 23, 2024 16:16
Copy link
Contributor Author

@annapoorna-s-alt annapoorna-s-alt left a comment

Choose a reason for hiding this comment

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

Looks good with the code changes and testing from session template. Approved!

…rough

IM:CASMTRIAGE-1900
Reviewer:Annapoorna
@annapoorna-s-alt annapoorna-s-alt changed the title CASMTRIAGE-1900: Add jinja render to rotfs_provider_passthrough to support iSCSI CASMTRIAGE-1900: Add jinja render to rootfs_provider_passthrough to support iSCSI Sep 27, 2024
@annapoorna-s-alt annapoorna-s-alt merged commit e7b8cda into main Sep 27, 2024
3 checks passed
@annapoorna-s-alt annapoorna-s-alt deleted the CASMTRIAGE-1900 branch September 27, 2024 15:18
Copy link
Contributor

@haasken-hpe haasken-hpe left a comment

Choose a reason for hiding this comment

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

I think it would be good to fix my comments. I opened CRAYSAT-1917 and pushed a branch with a possible fix.

@@ -242,6 +242,11 @@ def name(self):
# items that inherit from BaseInputItem.
return self.data['name']

@property
def boot_set(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was a boot_set property added on the BaseInputItem? This parent class applies to CFS configurations and BOS session templates in the input file, so it's not appropriate to add here. There is also already a boot_sets property on the InputSessionTemplate class where you needed to use it. Can we just use that one?

boot_sets = self.boot_set
# Render the rootfs_provider_passthrough using Jinja2
rendered_rootfs = self.jinja_env.from_string(
boot_sets[boot_set_name]['rootfs_provider_passthrough']).render(self.data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we pass in self.data to this? From what I can tell from the Jira, it is not required to allow it to render fields with arbitrary data from the session template. I think there's a way we can just modify and use the jinja_rendered decorator instead.

I think passing in self.data as the context when rendering is going to lead to some weird behavior and possibly hard-to-fix bugs, and then it will be hard to remove the ability to use the data if people start using it that way. I would suggest we not add this unless it's explicitly requested.

boot_sets = self.boot_set
# Render the rootfs_provider_passthrough using Jinja2
rendered_rootfs = self.jinja_env.from_string(
boot_sets[boot_set_name]['rootfs_provider_passthrough']).render(self.data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Exceptions also aren't caught here which will lead to tracebacks (e.g. if a variable used in a Jinja expression is not set).

}
bos_payload_bootsets[boot_set_name] = {
'node_roles_groups': ['Compute'],
'rootfs_provider_passthrough': "dvs:api-gw-service-nmn.local:300:hsn0,nmn0:0",
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to add a test where the rootfs_provider_passthrough has a variable that needs to be rendered with Jinja2

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.

5 participants