Skip to content

Conversation

@glekner
Copy link
Contributor

@glekner glekner commented Dec 18, 2019

Add CPU Pinning modal and functionality

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 18, 2019
@openshift-ci-robot openshift-ci-robot added the component/kubevirt Related to kubevirt-plugin label Dec 18, 2019
@glekner glekner force-pushed the cpu-pinning-modal branch 3 times, most recently from 33565bd to e12c553 Compare December 18, 2019 16:03
@glekner
Copy link
Contributor Author

glekner commented Dec 19, 2019

---- in Overview -----
Screen Shot 2019-12-19 at 14 33 20

---- Modal -----

Screen Shot 2019-12-19 at 14 33 15

Some screenshots @Ranelim @matthewcarleton . thoughts?
Also, what should we display in case of no changes to the VM (e.g. the checkbox is unchecked)? just a blank space?

@suomiy @mareklibra @yaacov please review

Copy link
Member

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 ?

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Ref: #3803

@matthewcarleton
Copy link
Contributor

@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.
If we go that route then the empty state could be "No resource scheduling applied" or something similar.

Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Member

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 -

Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

like the yaml name?

Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Member

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

Copy link
Member

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

@jelkosz @matthewcarleton

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree @suomiy but I think @jelkosz felt like this is more advanced than flavor. @Ranelim have an effort this sprint to look at topology and how it could align with this approach.

Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you elaborate?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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?

Copy link
Contributor Author

@glekner glekner Dec 22, 2019

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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is span acceptable here?

Copy link
Contributor

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.

Copy link
Contributor

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}?

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

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

like the yaml name?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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

@glekner
Copy link
Contributor Author

glekner commented Jan 5, 2020

@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?

@atiratree
Copy link
Member

atiratree commented Jan 6, 2020

@suomiy I fixed your comments.

#3805 (comment) still needs some attention

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?

I think it should be okay performance-wise since we would be fetching just the nodes inside the modal.
I guess it is not a hard requirement but a warning could be nice to have, IMO.

@glekner glekner force-pushed the cpu-pinning-modal branch from 36933d8 to 2b74cbf Compare January 7, 2020 12:58
@glekner
Copy link
Contributor Author

glekner commented Jan 7, 2020

@suomiy sorry I was pushing changes to the wrong branch.

@glekner glekner force-pushed the cpu-pinning-modal branch 2 times, most recently from fa5f021 to bc7443d Compare January 7, 2020 13:00
Copy link
Contributor Author

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?

Copy link
Member

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.

@glekner
Copy link
Contributor Author

glekner commented Jan 15, 2020

  • Patch now considers spec.domain.resources.[requests/limits].cpu
  • Added an Alert to the modal with the cpumanager=true warning.

Screen Shot 2020-01-15 at 12 07 18

@matthewcarleton @Ranelim are we ok with this for now? @suomiy please review.

@glekner glekner force-pushed the cpu-pinning-modal branch 2 times, most recently from e2ea0e2 to 7fbb9a9 Compare January 15, 2020 10:18
@matthewcarleton
Copy link
Contributor

@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.
Also, nit: A node with the cpumanager=true label is required. I also wonder if we should highlight the label. @andybraren do you know if in the console anywhere we treat labels differently when they are inline like this?

@glekner
Copy link
Contributor Author

glekner commented Jan 15, 2020

@matthewcarleton changed alert to info
Screen Shot 2020-01-15 at 17 33 18

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@atiratree
Copy link
Member

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
Copy link
Member

Choose a reason for hiding this comment

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

missing a type

@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultValue?: undefined,
defaultValue?: string,

Copy link
Contributor

@rawagner rawagner Jan 21, 2020

Choose a reason for hiding this comment

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

can be

Suggested change
const ResourceModal = withHandlePromise(
const ResourceModal = withHandlePromise<ResourceModalProps>(

and you wont have to specify that props type is ResourceModalProps a few lines below

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
onChange={(flag) => setIsPinned(flag)}
onChange={setIsPinned}

Copy link
Contributor

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

Copy link
Contributor

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).

Copy link
Contributor

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

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 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)}>

Copy link
Contributor

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

Copy link
Contributor

@rawagner rawagner Jan 21, 2020

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}



Copy link
Contributor

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

Suggested change
) => {
): Patch[] => {

Copy link
Contributor

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

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@rawagner
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@openshift-ci-robot
Copy link
Contributor

[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

Details 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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2020
@rawagner rawagner mentioned this pull request Jan 21, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@spadgett
Copy link
Member

/hold
the merge queue is blocked

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 21, 2020
@spadgett
Copy link
Member

/hold cancel
/retest

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 22, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 342c6a3 into openshift:master Jan 22, 2020
@openshift-ci-robot
Copy link
Contributor

@glekner: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-console ffca7fc link /test e2e-gcp-console

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.

Details

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.

@spadgett spadgett added this to the v4.4 milestone Jan 27, 2020
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. component/core Related to console core functionality component/kubevirt Related to kubevirt-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.