diff --git a/web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts b/web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts index 75b06cad10..668e26d0ca 100644 --- a/web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts +++ b/web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts @@ -19,6 +19,7 @@ type MockInternalBootSelection = { }; type InternalBootVm = { + poolMode: 'dedicated' | 'hybrid'; getDeviceSelectItems: (index: number) => Array<{ value: string; label: string; disabled?: boolean }>; }; @@ -239,7 +240,7 @@ describe('OnboardingInternalBootStep', () => { { id: 'SMALL-1', device: '/dev/sde', - size: gib(6), + size: gib(5), serialNum: 'SMALL-1', interfaceType: DiskInterfaceType.SATA, }, @@ -433,7 +434,7 @@ describe('OnboardingInternalBootStep', () => { { id: 'SMALL-1', device: '/dev/sdb', - size: gib(6), + size: gib(5), serialNum: 'SMALL-1', interfaceType: DiskInterfaceType.SATA, }, @@ -481,6 +482,48 @@ describe('OnboardingInternalBootStep', () => { expect(wrapper.find('[data-testid="brand-button"]').attributes('disabled')).toBeUndefined(); }); + it('allows 6 GiB devices in dedicated mode but not hybrid mode', async () => { + draftStore.bootMode = 'storage'; + contextResult.value = buildContext({ + assignableDisks: [ + { + id: 'DEDICATED-6GIB', + device: '/dev/sda', + size: gib(6), + serialNum: 'DEDICATED-6GIB', + interfaceType: DiskInterfaceType.SATA, + }, + { + id: 'LARGER-DRIVE', + device: '/dev/sdb', + size: gib(32), + serialNum: 'LARGER-DRIVE', + interfaceType: DiskInterfaceType.SATA, + }, + ], + }); + + const wrapper = mountComponent(); + await flushPromises(); + + const vm = wrapper.vm as unknown as InternalBootVm; + expect(vm.poolMode).toBe('dedicated'); + expect(vm.getDeviceSelectItems(0)).toEqual( + expect.arrayContaining([expect.objectContaining({ value: 'DEDICATED-6GIB' })]) + ); + + vm.poolMode = 'hybrid'; + await flushPromises(); + + expect(vm.getDeviceSelectItems(0)).not.toEqual( + expect.arrayContaining([expect.objectContaining({ value: 'DEDICATED-6GIB' })]) + ); + await wrapper.get('[data-testid="internal-boot-eligibility-toggle"]').trigger('click'); + await flushPromises(); + expect(wrapper.text()).toContain('DEDICATED-6GIB - 6.4 GB (sda)'); + expect(wrapper.text()).toContain('TOO_SMALL'); + }); + it('treats disks present in devs.ini as assignable', async () => { draftStore.bootMode = 'storage'; contextResult.value = buildContext({ diff --git a/web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue b/web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue index 2c8e9cc28d..fa75ffc1d7 100644 --- a/web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue +++ b/web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue @@ -74,7 +74,8 @@ type InternalBootDiskWarningCode = 'HAS_INTERNAL_BOOT_PARTITIONS'; type InternalBootDiskIssueCode = InternalBootDiskEligibilityCode | InternalBootDiskWarningCode; const MIN_BOOT_SIZE_MIB = 4096; -const MIN_ELIGIBLE_DEVICE_SIZE_MIB = MIN_BOOT_SIZE_MIB * 2; +const MIN_DEDICATED_DEVICE_SIZE_MIB = 6144; +const MIN_HYBRID_DEVICE_SIZE_MIB = MIN_BOOT_SIZE_MIB * 2; const DEFAULT_BOOT_SIZE_MIB = 16384; const BOOT_SIZE_PRESETS_MIB = [16384, 32768, 65536, 131072]; const SYSTEM_ELIGIBILITY_MESSAGE_KEYS: Record = { @@ -170,8 +171,10 @@ const templateData = computed(() => { const sizeMiB = toSizeMiB(sizeBytes); const ineligibilityCodes: InternalBootDiskEligibilityCode[] = []; const warningCodes: InternalBootDiskWarningCode[] = []; + const minEligibleDeviceSizeMiB = + poolMode.value === 'dedicated' ? MIN_DEDICATED_DEVICE_SIZE_MIB : MIN_HYBRID_DEVICE_SIZE_MIB; - if (sizeMiB !== null && sizeMiB < MIN_ELIGIBLE_DEVICE_SIZE_MIB) { + if (sizeMiB !== null && sizeMiB < minEligibleDeviceSizeMiB) { ineligibilityCodes.push('TOO_SMALL'); }