Skip to content

Conversation

@adamviktora
Copy link
Member

📝 Description

Fixes advanced search by CPU and Memory for stopped InstanceType VMs.

I don't like the fact that the useVMExpandSpecMap hook is refetching everything whenever the vms array change, if you have any ideas how to make it more efficient, yet simple, let me know.

🎥 Demo

Before:

Screen.Recording.2025-05-28.at.16.47.43.mov

After:

Screen.Recording.2025-05-28.at.16.41.19.mov

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented May 28, 2025

@adamviktora: This pull request references CNV-62665 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.20.0" version, but no target version was set.

In response to this:

📝 Description

Fixes advanced search by CPU and Memory for stopped InstanceType VMs.

I don't like the fact that the useVMExpandSpecMap hook is refetching everything whenever the vms array change, if you have any ideas how to make it more efficient, yet simple, let me know.

🎥 Demo

Before:

Screen.Recording.2025-05-28.at.16.47.43.mov

After:

Screen.Recording.2025-05-28.at.16.41.19.mov

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from rszwajko and upalatucci May 28, 2025 14:52
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adamviktora

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 This issue is something we want to fix label May 28, 2025
@adamviktora
Copy link
Member Author

/retest

tempMap[namespace] = {};
}

const url = getInstanceTypeExpandSpecURL(vm);
Copy link
Member

Choose a reason for hiding this comment

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

take a look if it's possible to reuse:

  1. const useInstanceTypeExpandSpec: UseInstanceTypeExpandSpec = (vm) => {
  2. useK8sWatchResources hook provided by the plugin API

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. I think the useInstanceTypeExpandSpec hook can't be used, it can be used only per single VM, the only part I used from that is the url to fetch.

  2. If there would be a way to use useK8sWatchResources on the expanded V1VirtualMachine that would be ideal. So have some options of the WatchK8sResource type that would return objects that can be fetched from this url:

`api/kubernetes/apis/subresources.${VirtualMachineModel.apiGroup}/${
    VirtualMachineModel.apiVersion
  }/namespaces/${getNamespace(vm)}/${VirtualMachineModel.plural}/${getName(vm)}/expand-spec`

Copy link
Member

Choose a reason for hiding this comment

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

sadly you are right - the expand-spec is not a separate resource and useInstanceTypeExpandSpec is probably to heavy to be used for group of VMs. However this reveals the true problem - scalability. Will continue that thread at top level.

Copy link
Member

@rszwajko rszwajko left a comment

Choose a reason for hiding this comment

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

We might hit performance problems when building vmExpandSpecMap. The worst case scenario is that all VMs need to be expanded - so we get 1 request per VM. Clearly we need API from the backend to get that information in one request.

@lyarwood
Copy link

I've written up https://issues.redhat.com/browse/CNV-63726 for the backend to provide this in the status of all VMs.

@adamviktora adamviktora marked this pull request as draft June 20, 2025 08:23
@adamviktora adamviktora changed the title CNV-62665: fix search by CPU and Memory for stopped InstanceType VMs WIP: CNV-62665: fix search by CPU and Memory for stopped InstanceType VMs Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants