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

image_to_vm: add support for hyperv_vhdx format #1791

Merged
merged 1 commit into from Apr 9, 2024

Conversation

ader1990
Copy link
Contributor

@ader1990 ader1990 commented Mar 25, 2024

Add support for Gen 2 Hyper-V VMs.

See: flatcar/Flatcar#1009

./image_to_vm tool has now a new supported format: hyperv_vhdx, that produces .vhdx dynamic disks.

How to use

 ./image_to_vm.sh --from ../build/images/amd64-usr/developer-latest/ --format hyperv_vhdx

Testing done

[Describe the testing you have done before submitting this PR. Please include both the commands you issued as well as the output you got.]

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@ader1990 ader1990 force-pushed the ader1990/hyperv-vhdx-support branch from 1f98104 to 7264cc9 Compare March 25, 2024 16:00
@ader1990 ader1990 changed the title image_to_vm: add support for hyper-v vhdx format image_to_vm: add support for hyperv_vhdx format Mar 25, 2024
@jepio
Copy link
Member

jepio commented Mar 26, 2024

Images have been produced: https://bincache.flatcar-linux.net/images/amd64/3916.0.0+vhdx/.

I don't like that the images end up being called flatcar_production_hyperv_vhdx_image.vhdx.bz2 (double vhdx).

Copy link

github-actions bot commented Mar 26, 2024

Build action triggered: https://github.com/flatcar/scripts/actions/runs/8564352706

@ader1990
Copy link
Contributor Author

Images have been produced: https://bincache.flatcar-linux.net/images/amd64/3916.0.0+vhdx/.

I don't like that the images end up being called flatcar_production_hyperv_vhdx_image.vhdx.bz2 (double vhdx).

It is the same naming convention for rackspace and cloudstack. Adding gen2 in the naming would be wrong, and only multiplexing the hyperv image format to create two images .vhd and .vhdx would make sense, but then, it will break the convention I saw in the current implementation, to create only one image file per format.

@ader1990
Copy link
Contributor Author

Images have been produced: https://bincache.flatcar-linux.net/images/amd64/3916.0.0+vhdx/.

I don't like that the images end up being called flatcar_production_hyperv_vhdx_image.vhdx.bz2 (double vhdx).

@jepio I tested the image on a gen 2 vm, and the image does not properly boot with the initrd stage error: hv_utils kernel module not found. Investigation required.

@ader1990
Copy link
Contributor Author

Images have been produced: https://bincache.flatcar-linux.net/images/amd64/3916.0.0+vhdx/.
I don't like that the images end up being called flatcar_production_hyperv_vhdx_image.vhdx.bz2 (double vhdx).

@jepio I tested the image on a gen 2 vm, and the image does not properly boot with the initrd stage error: hv_utils kernel module not found. Investigation required.

Code is failing here: https://github.com/coreos/ignition/blob/v2.18.0/internal/providers/hyperv/kvp.go#L50.
Flatcar kernel is built with hv_utils kernel module, but the module is not present in the /lib/module. Do you know why this happens?

@jepio @pothos

@ader1990
Copy link
Contributor Author

Images have been produced: https://bincache.flatcar-linux.net/images/amd64/3916.0.0+vhdx/.
I don't like that the images end up being called flatcar_production_hyperv_vhdx_image.vhdx.bz2 (double vhdx).

@jepio I tested the image on a gen 2 vm, and the image does not properly boot with the initrd stage error: hv_utils kernel module not found. Investigation required.

Code is failing here: https://github.com/coreos/ignition/blob/v2.18.0/internal/providers/hyperv/kvp.go#L50. Flatcar kernel is built with hv_utils kernel module, but the module is not present in the /lib/module. Do you know why this happens?

@jepio @pothos

Okay, I think I know why, because we are not using the upstream initrd generation for ignition, https://github.com/coreos/ignition/blob/d304850c3d3696822bc05e0833ee4b27df9d7a38/dracut/30ignition/module-setup.sh.

This PR requires a bootengine PR to add that module.

@ader1990
Copy link
Contributor Author

Test results look good, bootengine PR was merged with commit id updated, changelog was added.

@ader1990
Copy link
Contributor Author

Note that the VHDX image file after decompression has 1.1GB in file size.

@ader1990
Copy link
Contributor Author

Bootengine commit was removed, as the flatcar/scripts main is already using the newest bootengine HEAD.

@pothos
Copy link
Member

pothos commented Mar 27, 2024

Bootengine commit was removed, as the flatcar/scripts main is already using the newest bootengine HEAD.

Almost^^ I had to push a fix as it was the repo's HEAD.

@ader1990
Copy link
Contributor Author

Bootengine commit was removed, as the flatcar/scripts main is already using the newest bootengine HEAD.

Almost^^ I had to push a fix as it was the repo's HEAD.

I ll have to rebase on f04ba66, thought the commit was already in at that moment.

@pothos
Copy link
Member

pothos commented Apr 5, 2024

A new build is running (.11) and should show up under https://bincache.flatcar-linux.net/images/amd64/9999.9.11+ader1990-hyperv-vhdx-support/

@ader1990 ader1990 requested a review from pothos April 8, 2024 17:16
Add support for Gen 2 Hyper-V VMs.

`./image_to_vm` tool has now a new supported format: `hyperv_vhdx`,
that produces .vhdx dynamic disks.

How to use:

```bash
 ./image_to_vm.sh --from ../build/images/amd64-usr/developer-latest/ --format hyperv_vhdx
```

See: flatcar/Flatcar#1009

Uses PR: flatcar/bootengine#92

Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
@ader1990 ader1990 force-pushed the ader1990/hyperv-vhdx-support branch from ad1f305 to 7d4917d Compare April 9, 2024 07:52
@ader1990 ader1990 merged commit 385b929 into main Apr 9, 2024
1 check was waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
4 participants