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

Support for reset/image/load activation profiles #499

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

andy-maier
Copy link
Member

@andy-maier andy-maier commented Oct 27, 2023

Ready for review.
Has been tested on A65.
To try this PR yourself, run make install after checking out the branch, in order to install the updated "zhmcclient" package.

@andy-maier andy-maier self-assigned this Oct 27, 2023
@andy-maier andy-maier added this to the 1.10.0 milestone Oct 27, 2023
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch 2 times, most recently from 20e5bf5 to 84bd01d Compare October 28, 2023 05:00
@coveralls
Copy link

coveralls commented Oct 28, 2023

Coverage Status

coverage: 36.876% (+2.5%) from 34.352%
when pulling 8222fae on andy/add-activation-profiles
into 4d5d7a5 on master.

@andy-maier andy-maier linked an issue Oct 31, 2023 that may be closed by this pull request
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch 3 times, most recently from 725c2a8 to 9838732 Compare November 5, 2023 09:15
@andy-maier andy-maier changed the title Support for image/load activation profiles [WIP] Support for image/load activation profiles Nov 5, 2023
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch 2 times, most recently from f242df9 to cf472aa Compare November 11, 2023 08:05
@andy-maier andy-maier changed the title [WIP] Support for image/load activation profiles [WIP] Support for reset/image/load activation profiles Nov 11, 2023
@andy-maier andy-maier changed the title [WIP] Support for reset/image/load activation profiles Support for reset/image/load activation profiles Nov 11, 2023
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch 3 times, most recently from 9a5a93a to e3782f4 Compare November 11, 2023 17:01
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch from e3782f4 to 58d14be Compare November 16, 2023 13:17
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch 2 times, most recently from d116ffe to 492d93f Compare November 16, 2023 15:59
Copy link
Contributor

@EdGue42 EdGue42 left a comment

Choose a reason for hiding this comment

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

Note: this is so much code that I just scrolled over some parts.
I think you could significantly reduce line count just by introducing helper methods for a lot of repeated structures, that do always the same, only using different property name strings for example.

zhmccli/_cmd_imageprofile.py Outdated Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Outdated Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Outdated Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Outdated Show resolved Hide resolved
zhmccli/_cmd_imageprofile.py Outdated Show resolved Hide resolved
@andy-maier
Copy link
Member Author

I have introduced helper functions for the setting of properties from specially handled options. Please re-review.

@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch from fad7ba3 to 347b56b Compare November 23, 2023 14:30
Copy link
Contributor

@EdGue42 EdGue42 left a comment

Choose a reason for hiding this comment

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

Looks better now.

}

org_options = original_options(options)
if org_options['copy-name'] is not None:
Copy link
Member Author

@andy-maier andy-maier Nov 23, 2023

Choose a reason for hiding this comment

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

I wonder whether it is a good idea to copy the properties from the default profile ourselves (i.e. on the client side) as opposed to letting that be done by the HMC. I think my motivation to copy it on the client side was that we would be on the safe side given that we are not representing all resource properties 1:1 as command options, but I don't think initializing the properties from the default profile is necessary for that to work.

Also, since the HMC uses the profile named "DEFAULT" when --copy-name is not specified, it is inconsistent to copy the profile when --copy-name is specified, but not to copy the "DEFAULT" profile when it is not specified.

Overall, I suggest that we do not initialize the properties from the default profile, and let the HMC do that.

Applies to all three activation profile types.

Copy link
Member Author

@andy-maier andy-maier Nov 23, 2023

Choose a reason for hiding this comment

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

I removed the client-side copying.

Please review that approach.
@EdGue42

@andy-maier
Copy link
Member Author

andy-maier commented Nov 23, 2023

I looked again at the find_...() functions and whether they take cpc_name or cpc_or_name as an argument. All of them take cpc_or_name as an argument, except the three new ones for the activation profiles. But none of them uses the ability for Cpc as a resource object, it was just passed through, but never actually called that way.

So we could remove the support for a Cpc resource object in the find_:::() functions and reduce that to just always the CPC name. That would eliminate some other portions of duplicated code.

I'll do that in a separate PR.

Update: That became PR #525

zhmccli/_helper.py Outdated Show resolved Hide resolved
Details:

* Added command group 'resetprofile' for operations on reset activation
  profiles in classic mode CPCs.

* Added command group 'imageprofile' for operations on image activation
  profiles in classic mode CPCs.

* Added command group 'loadprofile' for operations on load activation
  profiles in classic mode CPCs.

Signed-off-by: Andreas Maier <[email protected]>
@andy-maier andy-maier force-pushed the andy/add-activation-profiles branch from 98fdf7a to 8222fae Compare November 27, 2023 10:57
@andy-maier andy-maier merged commit e7a373a into master Nov 27, 2023
12 checks passed
@andy-maier andy-maier deleted the andy/add-activation-profiles branch November 27, 2023 11:31
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.

Support for managing image and load activation profiles
3 participants