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

NAS-128601 / 25.04 / Fixes the process to assign GPUs to VMs when creating or editing #10838

Merged
merged 15 commits into from
Oct 11, 2024

Conversation

RehanY147
Copy link
Contributor

Changes:

Uses new API end points and filtering process to get the right data to be passed to the middleware endpoints

Testing:

Create a VM with one or more GPUs.
Edit a VM by removing GPUs and changing them.

Test on the system mentioned in the ticket comments.

@RehanY147 RehanY147 requested a review from a team as a code owner October 10, 2024 01:56
@RehanY147 RehanY147 requested review from undsoft and removed request for a team October 10, 2024 01:56
@bugclerk bugclerk changed the title Fixes the process to assign GPUs to VMs when creating or editing NAS-128601 / 25.04 / Fixes the process to assign GPUs to VMs when creating or editing Oct 10, 2024
@bugclerk
Copy link
Contributor

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.56%. Comparing base (4d07d3f) to head (0bdb8a1).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10838      +/-   ##
==========================================
+ Coverage   81.55%   81.56%   +0.01%     
==========================================
  Files        1579     1585       +6     
  Lines       54012    54136     +124     
  Branches     5792     5814      +22     
==========================================
+ Hits        44050    44158     +108     
- Misses       9962     9978      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@undsoft undsoft left a comment

Choose a reason for hiding this comment

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

When testing on the machine in question, creating or editing a VM takes a lot of time to the point where I start to think that it's frozen. Please verify that we are calling endpoints correctly here.

@@ -8,9 +8,11 @@ import { MapOption, Option } from 'app/interfaces/option.interface';
* Convert choices to options
* @returns Option[]
*/
export function choicesToOptions(): OperatorFunction<Choices, Option[]> {
export function choicesToOptions(reverseValueAndLabels = false): OperatorFunction<Choices, Option[]> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is obscure. It's better to create a new function for this local to vms module, like in GpuService.

switchMap(() => {
return forkJoin([
this.vmGpuService.updateVmGpus(vm, gpusIds),
this.gpuService.addIsolatedGpuPciIds(gpusIds),
Copy link
Collaborator

Choose a reason for hiding this comment

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

So you call system.advanced.update_gpu_pci_ids and then you call addIsolatedGpuPciIds which also calls the same endpoint.

@RehanY147 RehanY147 requested a review from undsoft October 10, 2024 23:20
Copy link
Collaborator

@undsoft undsoft left a comment

Choose a reason for hiding this comment

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

Looks good. Adding / removing gpus from a vm appears to be working correctly.

updateVmRequest$ = this.gpuService.getIsolatedGpuPciIds().pipe(
take(1),
switchMap((isolatedPciIds) => {
const gpuPciIds = new Set([...isolatedPciIds, ...gpusIds]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like code inside of addIsolatedGpuPciIds.

isLoading = false;
timeOptions$ = of(mapToOptions(vmTimeNames, this.translate));
bootloaderOptions$ = this.ws.call('vm.bootloader_options').pipe(choicesToOptions());
cpuModeOptions$ = of(mapToOptions(vmCpuModeLabels, this.translate));
cpuModelOptions$ = this.ws.call('vm.cpu_model_choices').pipe(choicesToOptions());
gpuOptions$ = this.gpuService.getGpuOptions();
gpuOptions$ = this.ws.call('system.advanced.get_gpu_pci_choices').pipe(
Copy link
Collaborator

Choose a reason for hiding this comment

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

getGpuOptions in GpuService is now unused and could hold this code.

@RehanY147 RehanY147 enabled auto-merge (squash) October 11, 2024 10:12
@RehanY147 RehanY147 merged commit da35a60 into master Oct 11, 2024
9 checks passed
@RehanY147 RehanY147 deleted the NAS-128601 branch October 11, 2024 11:02
@bugclerk
Copy link
Contributor

JIRA ticket https://ixsystems.atlassian.net/browse/NAS-128601 is targeted to the following versions which have not received their corresponding PRs: 24.10.0

@bugclerk
Copy link
Contributor

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Oct 11, 2024
@undsoft
Copy link
Collaborator

undsoft commented Oct 11, 2024

backport

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants