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

OCPBUGS-22933: [release-4.12]: vsphere: fix validation of CPUS and CoresPerSocket #7677

Conversation

r4f4
Copy link
Contributor

@r4f4 r4f4 commented Nov 3, 2023

I think the original intention behind the validation was to check that, in case CoresPerSocket was not set by the user, it would be checked against a default value (currently set to 4). However, that's not what is happening in practice, and both the check against the user-inputed value and the default were being performed.

That means that using CPUS=2 and CoresPerSocket=2 as exemplified in the official docs [1] would result in a validation error:

failed to create install config: invalid "install-config.yaml" file: controlPlane.platform.vsphere.cpus:
Invalid value: 2: numCPUs specified should be a multiple of cores per socket which is by default 4]

even though it's a valid configuration (albeit a pretty tiny compute node).

I'm changing the code a bit to make it more clear what the defaults values are representing and fixing the checks so they are made only once with the correct values for CPUs and CoresPerSocket.

[1] https://docs.openshift.com/container-platform/4.11/installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.html#installation-installer-provisioned-vsphere-config-yaml_installing-vsphere-installer-provisioned-customizations

I think the original intention behind the validation was to check that,
in case `CoresPerSocket` was not set by the user, it would be checked
against a default value (currently set to 4). However, that's not what
is happening in practice, and both the check against the user-inputed
value and the default were being performed.

That means that using CPUS=2 and CoresPerSocket=2 as exemplified in the
official docs [1] would result in a validation error:
```
failed to create install config: invalid "install-config.yaml" file: controlPlane.platform.vsphere.cpus:
Invalid value: 2: numCPUs specified should be a multiple of cores per socket which is by default 4]
```
even though it's a valid configuration (albeit a pretty tiny compute
node).

I'm changing the code a bit to make it more clear what the defaults
values are representing and fixing the checks so they are made only once
with the correct values for CPUs and CoresPerSocket.

[1] https://docs.openshift.com/container-platform/4.11/installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.html#installation-installer-provisioned-vsphere-config-yaml_installing-vsphere-installer-provisioned-customizations
@r4f4
Copy link
Contributor Author

r4f4 commented Nov 3, 2023

/jira cherrypick OCPBUGS-6919

@openshift-ci-robot
Copy link
Contributor

@r4f4: Jira Issue OCPBUGS-6919 has been cloned as Jira Issue OCPBUGS-22933. Will retitle bug to link to clone.
/retitle OCPBUGS-22933: [release-4.12]: vsphere: fix validation of CPUS and CoresPerSocket

In response to this:

/jira cherrypick OCPBUGS-6919

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot changed the title [release-4.12]: vsphere: fix validation of CPUS and CoresPerSocket OCPBUGS-22933: [release-4.12]: vsphere: fix validation of CPUS and CoresPerSocket Nov 3, 2023
@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Nov 3, 2023
@openshift-ci-robot
Copy link
Contributor

@r4f4: This pull request references Jira Issue OCPBUGS-22933, which is valid. The bug has been moved to the POST state.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.12.z) matches configured target version for branch (4.12.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • dependent bug Jira Issue OCPBUGS-6919 is in the state Closed (Done), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-6919 targets the "4.13.0" version, which is one of the valid target versions: 4.13.0, 4.13.z
  • bug has dependents

Requesting review from QA contact:
/cc @gpei

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

I think the original intention behind the validation was to check that, in case CoresPerSocket was not set by the user, it would be checked against a default value (currently set to 4). However, that's not what is happening in practice, and both the check against the user-inputed value and the default were being performed.

That means that using CPUS=2 and CoresPerSocket=2 as exemplified in the official docs [1] would result in a validation error:

failed to create install config: invalid "install-config.yaml" file: controlPlane.platform.vsphere.cpus:
Invalid value: 2: numCPUs specified should be a multiple of cores per socket which is by default 4]

even though it's a valid configuration (albeit a pretty tiny compute node).

I'm changing the code a bit to make it more clear what the defaults values are representing and fixing the checks so they are made only once with the correct values for CPUs and CoresPerSocket.

[1] https://docs.openshift.com/container-platform/4.11/installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.html#installation-installer-provisioned-vsphere-config-yaml_installing-vsphere-installer-provisioned-customizations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@barbacbd barbacbd left a comment

Choose a reason for hiding this comment

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

/lgtm

"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/openshift/installer/pkg/types"

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can get rid of this extra line

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. labels Nov 6, 2023
numCoresPerSocket = defaultCoresPerSocket
}

if numCoresPerSocket > numCPUs {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the user specified numCPUs to be 2 and the did not specify numCoresPerSocket, it would be given a value of 4. Then this check will fail. I think that is incorrect behavior, imho. When only one of those values is specified, then the other should be made equal to that? That way we don't inadvertently break check in line 49. Related, is the user allowed to specify odd numbers for numCPUs or numCoresPerSocket?

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 you think that's a bug, it needs to be reported against master. I can't fix this in the backport.

}
if numCoresPerSocket <= 0 {
numCoresPerSocket = defaultCoresPerSocket
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Info message when a default value is in use esp when one value is specified by the user and the other is not.

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 you feel strongly about that, open a bug so we can fix in master first and then backport all the way.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 I see that this is a back-port.

@gpei
Copy link
Contributor

gpei commented Nov 9, 2023

/label cherry-pick-approved

@openshift-ci openshift-ci bot added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Nov 9, 2023
@sadasu
Copy link
Contributor

sadasu commented Nov 13, 2023

/retest-required

@sadasu
Copy link
Contributor

sadasu commented Nov 13, 2023

/approve

Copy link
Contributor

openshift-ci bot commented Nov 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sadasu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 13, 2023
Copy link
Contributor

openshift-ci bot commented Nov 14, 2023

@r4f4: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-disruptive c5810bd link false /test e2e-aws-ovn-disruptive

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 032045c and 2 for PR HEAD c5810bd in total

@openshift-merge-bot openshift-merge-bot bot merged commit 99a69e2 into openshift:release-4.12 Nov 14, 2023
23 of 24 checks passed
@openshift-ci-robot
Copy link
Contributor

@r4f4: Jira Issue OCPBUGS-22933: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-22933 has been moved to the MODIFIED state.

In response to this:

I think the original intention behind the validation was to check that, in case CoresPerSocket was not set by the user, it would be checked against a default value (currently set to 4). However, that's not what is happening in practice, and both the check against the user-inputed value and the default were being performed.

That means that using CPUS=2 and CoresPerSocket=2 as exemplified in the official docs [1] would result in a validation error:

failed to create install config: invalid "install-config.yaml" file: controlPlane.platform.vsphere.cpus:
Invalid value: 2: numCPUs specified should be a multiple of cores per socket which is by default 4]

even though it's a valid configuration (albeit a pretty tiny compute node).

I'm changing the code a bit to make it more clear what the defaults values are representing and fixing the checks so they are made only once with the correct values for CPUs and CoresPerSocket.

[1] https://docs.openshift.com/container-platform/4.11/installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.html#installation-installer-provisioned-vsphere-config-yaml_installing-vsphere-installer-provisioned-customizations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-installer-container-v4.12.0-202311140330.p0.g99a69e2.assembly.stream for distgit ose-installer.
All builds following this will include this PR.

@r4f4
Copy link
Contributor Author

r4f4 commented Nov 14, 2023

/cherry-pick release-4.11

@openshift-cherrypick-robot

@r4f4: #7677 failed to apply on top of branch "release-4.11":

Applying: vsphere: fix validation of CPUS and CoresPerSocket
Using index info to reconstruct a base tree...
M	pkg/types/vsphere/validation/machinepool.go
M	pkg/types/vsphere/validation/machinepool_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/types/vsphere/validation/machinepool_test.go
Auto-merging pkg/types/vsphere/validation/machinepool.go
CONFLICT (content): Merge conflict in pkg/types/vsphere/validation/machinepool.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 vsphere: fix validation of CPUS and CoresPerSocket
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.12.0-0.nightly-2023-11-14-120414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants