Skip to content

NAS-135491 / 25.10 / Allow specifying image OS for virt VMs in UI #11938

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AlexKarpov98
Copy link
Contributor

Testing:
See ticket.

Quick preview:

Screen.Recording.2025-04-29.at.18.22.52.mov

Downstream

Affects Reasoning
Documentation New Field for ISO Volume

@AlexKarpov98 AlexKarpov98 self-assigned this Apr 29, 2025
@AlexKarpov98 AlexKarpov98 requested a review from a team as a code owner April 29, 2025 15:33
@AlexKarpov98 AlexKarpov98 requested review from undsoft and removed request for a team April 29, 2025 15:33
@bugclerk
Copy link
Contributor

@bugclerk bugclerk changed the title NAS-135491: Allow specifying image OS for virt VMs in UI NAS-135491 / 25.10 / Allow specifying image OS for virt VMs in UI Apr 29, 2025
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 86.48649% with 5 lines in your changes missing coverage. Please review.

Project coverage is 83.68%. Comparing base (e0fc77d) to head (fb15ece).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ms/components/ix-combobox/ix-combobox.component.ts 0.00% 4 Missing ⚠️
...nents/instance-wizard/instance-wizard.component.ts 94.11% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11938   +/-   ##
=======================================
  Coverage   83.67%   83.68%           
=======================================
  Files        1687     1687           
  Lines       59678    59712   +34     
  Branches     6613     6620    +7     
=======================================
+ Hits        49938    49968   +30     
- Misses       9740     9744    +4     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 👍🏼

[ImageOs.Linux, 'Linux'],
[ImageOs.FreeBsd, 'FreeBSD'],
[ImageOs.Windows, 'Windows'],
[ImageOs.ArchLinux, 'Arch Linux'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is Arch Linux included as a separate entry? Isn't it just linux?

@@ -86,6 +87,7 @@ export interface CreateVirtualizationInstance {
zvol_path?: string | null;
storage_pool: string | null;
volume?: string | null;
image_os?: ImageOs | null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

also a string.

if (!existingOption && this.allowCustomValue()) {
existingOption = { label: this.value as string, value: this.value };
}
this.selectedOption = { ...existingOption };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be good to add a test case for changes in core components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds reasonable.

@@ -1,6 +1,20 @@
import { marker as T } from '@biesbjerg/ngx-translate-extract-marker';
import { iconMarker } from 'app/modules/ix-icon/icon-marker.util';

export enum ImageOs {
Linux = 'LINUX',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Values don't have to be uppercase, since this is not a real enum, just a preset for the user.

Copy link
Contributor Author

@AlexKarpov98 AlexKarpov98 Apr 30, 2025

Choose a reason for hiding this comment

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

@undsoft - I checked the docs for image_os, and there I found these enums:

Screenshot 2025-04-30 at 12 36 42

@@ -177,6 +186,7 @@ export class InstanceEditFormComponent {

if (this.isVm) {
payload.secure_boot = values.secure_boot;
payload.image_os = values.image_os;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check with Rehan from MW if we need to send Linux when user selects Use a Linux image (linuxcontainers.org).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@undsoft - I tried it, and it says that it should be sent only with ISO volume.


osImage: {
tooltip: T('Optionally specify the operating system for VM-based instances.\
Common options are Windows, Linux, FreeBSD, or Arch Linux, but you can also enter a custom value.\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. Not sure why Arch Linux is special.

Also include this text:

When creating a Windows VM, make sure to set the this field to Windows.
Doing so will tell us to expect Windows to be running inside of the virtual machine and to tweak behavior accordingly.

@@ -776,4 +790,27 @@ export class InstanceWizardComponent implements OnInit {
}
});
}

private detectImageOs(value: string | null | undefined): ImageOs | null {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to add a test case for this.

@if (form.value.volume_type === VolumeContentType.Iso) {
<ix-combobox
formControlName="image_os"
[label]="'OS Image' | translate"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's call it OS Type here and in edit form.

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

Successfully merging this pull request may close these issues.

3 participants