Skip to content

Commit

Permalink
Disable the virtiofs mount type
Browse files Browse the repository at this point in the history
Testing with virtiofs on Linux has wiped out the HOME directory on
the host, and a recent Lima issue claims that they experienced data
loss with virtiofs on macOS as well.

Signed-off-by: Jan Dubois <[email protected]>
  • Loading branch information
jandubois committed Mar 7, 2024
1 parent 48dcb76 commit 5fc0f94
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
5 changes: 2 additions & 3 deletions pkg/rancher-desktop/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ virtualMachine:
none: none
virtiofs:
label: virtiofs
description: Exposes the filesystem by using an Apple Virtualization framework shared directory device.
description: This option is unavailable in this release.
proxy:
legend: WSL Proxy
label: Enable the proxy used by rancher-desktop
Expand Down Expand Up @@ -2673,8 +2673,7 @@ prefs:
experimental: Experimental
onlyFromVentura_x64: This setting requires macOS 13.0 (Ventura) or later.
onlyFromVentura_arm64: This setting requires macOS 13.3 (Ventura) or later.
onlyWithVZ_x64: This setting requires using the VZ emulation mode. VZ is only available on macOS 13.0 (Ventura) or later.
onlyWithVZ_arm64: This setting requires using the VZ emulation mode. VZ is only available on macOS 13.3 (Ventura) or later.
virtiofsDisabled: This setting has been temporarily removed to investigate a potential bug that could lead to data loss on the host.

principal:
loading: Loading&hellip;
Expand Down
14 changes: 3 additions & 11 deletions pkg/rancher-desktop/components/MountTypeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ export default (Vue as VueConstructor<Vue & VuexBindings>).extend({
return this.preferences.experimental.virtualMachine.mount.type === MountType.NINEP;
},
virtIoFsDisabled(): boolean {
// virtiofs should only be disabled on macOS WITHOUT the possibility to select the VM type VZ. VZ doesn't need to
// be selected, yet. We're going to show a warning banner in that case.
return os.platform() === 'darwin' &&
(semver.lt(this.macOsVersion.version, '13.0.0') || (this.isArm && semver.lt(this.macOsVersion.version, '13.3.0')));
// virtiofs is unavailable in the 1.13 release of Rancher Desktop
return true;
},
arch(): string {
return this.isArm ? 'arm64' : 'x64';
Expand Down Expand Up @@ -110,13 +108,7 @@ export default (Vue as VueConstructor<Vue & VuexBindings>).extend({
this.$emit('update', property, value);
},
disabledVirtIoFsTooltip(disabled: boolean): { content: string } | Record<string, never> {
let tooltip = {};
if (disabled) {
tooltip = { content: this.t(`prefs.onlyWithVZ_${ this.arch }`) };
}
return tooltip;
return { content: this.t('prefs.virtiofsDisabled') };
},
getCompatiblePrefs(mountType: MountType): CompatiblePrefs | [] {
const compatiblePrefs: CompatiblePrefs = [];
Expand Down
6 changes: 5 additions & 1 deletion pkg/rancher-desktop/config/settingsImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import _ from 'lodash';

import {
CURRENT_SETTINGS_VERSION, defaultSettings, DeploymentProfileType,
LockedSettingsType, Settings, SettingsError,
LockedSettingsType, MountType, Settings, SettingsError,
} from '@pkg/config/settings';
import { PathManagementStrategy } from '@pkg/integrations/pathManager';
import clone from '@pkg/utils/clone';
Expand Down Expand Up @@ -470,6 +470,10 @@ export const updateTable: Record<number, (settings: any, locked : boolean) => vo
}
},
10: (settings, locked) => {
// virtiofs is not supported in Rancher Desktop 1.13.0
if (settings.experimental.virtualMachine.mount.type === MountType.VIRTIOFS) {
settings.experimental.virtualMachine.mount.type = MountType.REVERSE_SSHFS;
}
// Migrating from an older locked profile automatically locks newer features (wasm support).
if (locked && !_.has(settings, 'experimental.containerEngine.webAssembly.enabled')) {
_.set(settings, 'experimental.containerEngine.webAssembly.enabled', false);
Expand Down
21 changes: 3 additions & 18 deletions pkg/rancher-desktop/main/commandServer/settingsValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,7 @@ export default class SettingsValidator {
if (mergedSettings.experimental.virtualMachine.mount.type === MountType.NINEP) {
errors.push(
`Setting ${ fqname } to "${ VMType.VZ }" requires that experimental.virtual-machine.mount.type is ` +
`"${ MountType.REVERSE_SSHFS }" or "${ MountType.VIRTIOFS }".`);

return false;
}
}
if (desiredValue === VMType.QEMU) {
if (mergedSettings.experimental.virtualMachine.mount.type === MountType.VIRTIOFS && os.platform() === 'darwin') {
errors.push(
`Setting ${ fqname } to "${ VMType.QEMU }" requires that experimental.virtual-machine.mount.type is ` +
`"${ MountType.REVERSE_SSHFS }" or "${ MountType.NINEP }".`);
`"${ MountType.REVERSE_SSHFS }".`);

return false;
}
Expand All @@ -350,14 +341,8 @@ export default class SettingsValidator {
}

protected checkMountType(mergedSettings: Settings, currentValue: string, desiredValue: string, errors: string[], fqname: string): boolean {
if (desiredValue === MountType.VIRTIOFS && mergedSettings.experimental.virtualMachine.type !== VMType.VZ && os.platform() === 'darwin') {
errors.push(`Setting ${ fqname } to "${ MountType.VIRTIOFS }" requires that experimental.virtual-machine.type is "${ VMType.VZ }".`);
this.isFatal = true;

return false;
}
if (desiredValue === MountType.VIRTIOFS && mergedSettings.experimental.virtualMachine.type !== VMType.QEMU && os.platform() === 'linux') {
errors.push(`Setting ${ fqname } to "${ MountType.VIRTIOFS }" requires that experimental.virtual-machine.type is "${ VMType.QEMU }".`);
if (desiredValue === MountType.VIRTIOFS) {
errors.push(`Setting ${ fqname } to "${ MountType.VIRTIOFS }" is not supported in this version of Rancher Desktop.`);
this.isFatal = true;

return false;
Expand Down

0 comments on commit 5fc0f94

Please sign in to comment.