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

Add experimental options for vm-type and use-rosetta #4063

Merged
merged 11 commits into from
Mar 11, 2023

Conversation

jandubois
Copy link
Member

@jandubois jandubois commented Feb 28, 2023

Add experimental.virtualMachine.type and experimental.virtualMachine.useRosetta options for use on macOS 13 (Ventura).

The persistent volume will be converted from QCOW2 to RAW format the first time the vm type is set to vz. It is possible to switch back to qemu while keeping the disk in RAW format.

Shutting down a vz VM takes an additional 3 minutes due to a crash in the bindings: lima-vm/lima#1381. Contrary to the Lima bug description, the delay is not always limited to the first stopping of the VM.

Fixes #3944

@jandubois jandubois force-pushed the vz branch 4 times, most recently from b00c6f3 to 4f4d8e8 Compare March 2, 2023 21:36
@jandubois jandubois force-pushed the vz branch 3 times, most recently from 3b30797 to f822bf7 Compare March 7, 2023 07:44
@jandubois jandubois marked this pull request as ready for review March 7, 2023 17:05
@jandubois jandubois requested review from mook-as and adamkpickering and removed request for mook-as March 7, 2023 17:05
adamkpickering
adamkpickering previously approved these changes Mar 8, 2023
Copy link
Member

@adamkpickering adamkpickering 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 as far as I can tell. We may want to consider the use of the new code from #4036, as mentioned in my comment.

I tested kubernetes reset and port changes, and things look alright there. However, I can't test the openVZ stuff since I don't have a mac. I've asked on team-rancher-desktop if someone else can test this part of the changes. We should probably wait to merge until that has been done.

}

protected checkVMType(mergedSettings: Settings, currentValue: string, desiredValue: string, errors: string[], fqname: string): boolean {
if (desiredValue === VMType.VZ && parseInt(os.release()) < 22) {
Copy link
Member

Choose a reason for hiding this comment

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

In #4036, a function is added in utils/osVersion.ts that gets the macOS (rather than darwin) version - it may be useful here. I'm not sure if we'd wait until #4036 is merged and then incorporate that change into this PR, or if we'd make that change in another PR, though.

@jandubois jandubois added this to the 1.8 milestone Mar 10, 2023
If the k8smanager.del() function needs the VM to be stopped, it
can do it by itself (and already did/does).

Signed-off-by: Jan Dubois <[email protected]>
We may still need to download even when adminAccess is true
(if the user declines to enter the admin password when needed),
but if we already know that we are not even going to ask, then
there is no need to generate a lima.yaml that references networks
that are not (yet) defined in _config/networks.yaml.

Signed-off-by: Jan Dubois <[email protected]>
Otherwise it will get stripped from limactl.ventura, breaking vz support.

Signed-off-by: Jan Dubois <[email protected]>
Also mount-type=virtiofs

Signed-off-by: Jan Dubois <[email protected]>
This will allow us to reuse the  implementation for other binaries
in the future.

Signed-off-by: Jan Dubois <[email protected]>
When starting VZ mode VM because it doesn't support qcow2. Need to
convert to a temporary file because in-place conversion drop the
partition table (so does not really convert at all).

Signed-off-by: Jan Dubois <[email protected]>
adamkpickering
adamkpickering previously approved these changes Mar 11, 2023
Copy link
Member

@adamkpickering adamkpickering left a comment

Choose a reason for hiding this comment

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

Sorry I didn't find these things on the first review. I don't think any of them are showstoppers though - I'll leave it up to you if you want to merge or not.

pkg/rancher-desktop/backend/lima.ts Show resolved Hide resolved
e2e/rdctl.e2e.spec.ts Show resolved Hide resolved
}

protected convertToRaw(fileName: string): Promise<void> {
return (async() => {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to be in an IIFE:

protected async convertToRaw(fileName: string): Promise<void> {
  const rawFileName = `${ fileName }.raw`;

  await this.spawnWithCapture(LimaBackend.qemuImg, 'convert', fileName, rawFileName);
  await fs.promises.unlink(fileName);
  await fs.promises.rename(rawFileName, fileName);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know, but given that the other methods are all wrapped like this, I guess it can't hurt.

type:
type: string
enum: ['qemu', 'vz']
x-rd-platforms: ['darwin']
Copy link
Member

Choose a reason for hiding this comment

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

nit; for consistency we should just remove the quotes: [darwin]

Nino-K
Nino-K previously approved these changes Mar 11, 2023
Copy link
Member

@Nino-K Nino-K left a comment

Choose a reason for hiding this comment

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

Reviewed the last commit and it looks fine, only left a small comment that can be addressed in future PRs too.

Nino-K
Nino-K previously approved these changes Mar 11, 2023
mook-as
mook-as previously approved these changes Mar 11, 2023
Copy link
Contributor

@mook-as mook-as left a comment

Choose a reason for hiding this comment

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

54ce4fa and 9a0bd22 look fine. (Otherwise carrying forwarding Nino's review previously.)

Signed-off-by: Jan Dubois <[email protected]>
@jandubois jandubois merged commit 1091a64 into rancher-sandbox:main Mar 11, 2023
@jandubois jandubois deleted the vz branch March 11, 2023 02:56
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.

Add experimental setting to enable VZ VM type instead of qemu
4 participants