-
Notifications
You must be signed in to change notification settings - Fork 670
Add CPU Pinning modal and functionality #3805
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 CPU Pinning modal and functionality #3805
Conversation
33565bd to
e12c553
Compare
|
---- Modal ----- Some screenshots @Ranelim @matthewcarleton . thoughts? @suomiy @mareklibra @yaacov please review |
frontend/.vscode/settings.json
Outdated
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.
nice, but should it be in this PR ?
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.
this was automatically changed by VS Code..everytime i revert the changes it creates the patch again immediately. does it happen to anyone else?
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.
Ref: #3803
|
@glekner I'd like @Ranelim to weigh in here but I think this should be called "Resource scheduling" It's more descriptive and I don't think we want to use the term "Device" here. It will conflict with virtual hardware. |
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.
Do you need this wrapping div?
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.
we should not discard other CPU attributes with this operation.
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.
maybe better to call patch on just dedicatedCpuPlacement ? and create a new default entry if the CPU and resources.requests.cpu is missing -
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.
can we keep the naming the same? - easier to distinguish what this selector does
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.
How would you name it?
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.
like the yaml name?
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.
vm is passed in the (vm) => patches function so you don't have to call asVM in the beggining
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.
asVM is for the getCPU
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'm going one level deeper, patching just dedicatedCpuPlacement so no need for cpu parsing
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.
this will not work if the cpu field is missing
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.
we should take resources.requests.cpu into account when making the patches: please see https://kubevirt.io/user-guide/docs/latest/creating-virtual-machines/dedicated-cpu.html
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.
cpu pinning is tied together with number of cpus/cores/sockets. We probably should edit these attributes and the pinning at once.
There is a significant overlap with the flavor modal - it would probably make sense to unite these
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.
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.
we probably should check the nodes if there are some with cpumanager=true label before we start offering the pinning. Or maybe some warning?
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.
can you elaborate?
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.
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.
why is this necessary? can't we just use the errorMessage?
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.
This is the new modal footer, took example from boot-order-modal@122
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.
It doesn't look like this working properly. I'm seeing an h1 which we should avoid because we already have an h1 for the title of the modal.
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.
is span acceptable here?
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'd stick to using headings. You could use an h2.
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 like the alignment of the footer is a bit off. I'm seeing a wrapping div around the footer which shouldn't be needed.
Do we need footer={footer}?
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, custom actions and loading animations. ill fix the left padding
e12c553 to
36933d8
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.
like the yaml name?
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.
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.
this will not work if the cpu field is missing
|
@suomiy I fixed your comments. regarding this section https://kubevirt.io/user-guide/docs/latest/creating-virtual-machines/dedicated-cpu.html#identifying-nodes-with-a-running-cpu-manager does this label check require us to search inside all nodes for that specific label? wouldn't it hurt performance? |
#3805 (comment) still needs some attention
I think it should be okay performance-wise since we would be fetching just the nodes inside the modal. |
36933d8 to
2b74cbf
Compare
|
@suomiy sorry I was pushing changes to the wrong branch. |
fa5f021 to
bc7443d
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.
@suomiy in case cpu is not available, do we even want to give an option to patch dedicatedCpuPlacement?
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 don't see a reason why not. We should just ensure there is no overlap between resources.requests.cpu and domain.cpu and have CPUs in just one place.
bc7443d to
5dcc307
Compare
|
e2ea0e2 to
7fbb9a9
Compare
|
@glekner is this a warning or info alert? As a warning it feels like I'm being warned that it isn't going to happen, Info seems more accurate if I'm understanding this correctly. |
7fbb9a9 to
824c6f7
Compare
|
@matthewcarleton changed alert to info |
|
/lgtm cancel |
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.
missing a type
49990f8 to
76fba54
Compare
|
/lgtm |
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.
| defaultValue?: undefined, | |
| defaultValue?: string, |
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.
can be
| const ResourceModal = withHandlePromise( | |
| const ResourceModal = withHandlePromise<ResourceModalProps>( |
and you wont have to specify that props type is ResourceModalProps a few lines below
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.
| onChange={(flag) => setIsPinned(flag)} | |
| onChange={setIsPinned} |
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.
no need to disable this rule
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.
it seems that its better to pass onClose which wont take any parameter as input as you always call setOpen(false).
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.
actually pass the name should be close as defined in ModalComponentProps
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.
it would be better to use classNames('co-m-btn-bar modal-footer kubevirt-create-nic-modal__buttons', className) for the footer and leave className prop empty.
<footer className={classNames('co-m-btn-bar modal-footer kubevirt-create-nic-modal__buttons', className)}>
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.
why all the null and false values as defaults ? you can keep the these props empty and the result will be the same and the function declaration more tidy
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.
as metioned above, it would be better to pass onClose callback
const onClose = React.useCallback(() => setDedicatedResourcesModalOpen(false), []);
...
<DedicatedResourcesModal
vmLikeEntity={template}
isOpen={isDedicatedResourcesModalOpen}
onClose={onClose}
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.
its better to add return type to have clear function contract
| ) => { | |
| ): Patch[] => { |
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.
you can use TS 3.7 optional chaining for all _.get usages
76fba54 to
ffca7fc
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: glekner, rawagner, suomiy The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/hold |
|
/hold cancel |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@glekner: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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. |




Add CPU Pinning modal and functionality