diff --git a/pkg/rancher-desktop/config/settings.ts b/pkg/rancher-desktop/config/settings.ts index fa9f271ca04..191403eb2d2 100644 --- a/pkg/rancher-desktop/config/settings.ts +++ b/pkg/rancher-desktop/config/settings.ts @@ -43,6 +43,7 @@ export const ContainerEngineNames: Record = { export enum MountType { NINEP = '9p', REVERSE_SSHFS = 'reverse-sshfs', + VIRTIOFS = 'virtiofs', } export enum ProtocolVersion { diff --git a/pkg/rancher-desktop/main/commandServer/settingsValidator.ts b/pkg/rancher-desktop/main/commandServer/settingsValidator.ts index f434a6e2445..febe6983db1 100644 --- a/pkg/rancher-desktop/main/commandServer/settingsValidator.ts +++ b/pkg/rancher-desktop/main/commandServer/settingsValidator.ts @@ -4,7 +4,14 @@ import Electron from 'electron'; import _ from 'lodash'; import { - CacheMode, defaultSettings, LockedSettingsType, MountType, ProtocolVersion, SecurityModel, Settings, VMType, + CacheMode, + defaultSettings, + LockedSettingsType, + MountType, + ProtocolVersion, + SecurityModel, + Settings, + VMType, } from '@pkg/config/settings'; import { NavItemName, navItemNames, TransientSettings } from '@pkg/config/transientSettings'; import { PathManagementStrategy } from '@pkg/integrations/pathManager'; @@ -92,7 +99,10 @@ export default class SettingsValidator { experimental: { virtualMachine: { mount: { - type: this.checkLima(this.checkEnum(...Object.values(MountType))), + type: this.checkLima(this.checkMulti( + this.checkEnum(...Object.values(MountType)), + this.checkMountType), + ), '9p': { securityModel: this.checkLima(this.check9P(this.checkEnum(...Object.values(SecurityModel)))), protocolVersion: this.checkLima(this.check9P(this.checkEnum(...Object.values(ProtocolVersion)))), @@ -287,6 +297,16 @@ export default class SettingsValidator { return currentValue !== desiredValue; } + protected checkMountType(mergedSettings: Settings, currentValue: string, desiredValue: string, errors: string[], fqname: string): boolean { + if (desiredValue === MountType.VIRTIOFS && mergedSettings.experimental.virtualMachine.type !== VMType.VZ) { + errors.push(`Setting ${ fqname } to "${ MountType.VIRTIOFS }" requires that experimental.virtual-machine.vm-type is "${ VMType.VZ }".`); + + return false; + } + + return currentValue !== desiredValue; + } + protected checkPlatform(platform: NodeJS.Platform, validator: ValidatorFunc) { return (mergedSettings: Settings, currentValue: C, desiredValue: D, errors: string[], fqname: string) => { if (!_.isEqual(currentValue, desiredValue)) {