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

kvm-test: add the option to "overwrite" an existing installation without recreating the disk from scratch #2093

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Sep 25, 2024

When running kvm-test with --install, we currently have two options related to the target disk:

  • Abort if the target already exists, This is the default behavior.
  • If the --overwrite option (or -o) is passed, we instead recreate the target image from scratch.

This makes us unable to supply an already partitioned disk to kvm-test, which is a bit of a shame considering the use-cases we have currently.

This change adds 3 new options (well, only one is truly new):

  • --preserve-target which is an explicit way to abort if the target image already exists (this is the default behavior)
  • --recreate-target which mimics what -o / --overwrite does.
  • --reuse-target which is the new one. When the option is supplied, we will reuse the disk without recreating it (if it already exists).

When we install to an existing disk with --reuse-target, we need to ask the firmware to boot from the installation media (or it will prefer booting from the disk if there is something installed to it). In BIOS mode, this means adding the -boot order=d option. However, in UEFI mode, it is more difficult to do. For now, I've added a note to stderr to tell how to proceed with UEFI (i.e., mashing ESC and then selecting Boot Manager -> UEFI QEMU DVD-ROM). Suggestions welcome :)

kvm-test has three new options (with only the third one being really
new).

* `--preserve-target` which is an explicit way to abort if the target
  image already exists (this is the default behavior)
* `--recreate-target` which mimics what `-o` / `--overwrite` does (i.e.,
  recreating the target image even if it already exists).
* `--reuse-target` which is the new one. When the option is supplied, we
  will reuse the disk without recreating it (if it already exists).

When using the --reuse-target option, the firmware will try to boot from
the disk. To work around the issue, quickly hit ESC and select
`Boot Manager -> UEFI QEMU DVD-ROM`.

Signed-off-by: Olivier Gayot <[email protected]>
Copy link
Contributor

@Chris-Peterson444 Chris-Peterson444 left a comment

Choose a reason for hiding this comment

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

Thanks for this, LGTM. I think the only way we can fix this for UEFI is to either specify the cdrom or firmware as a full device and use bootindex or something like that.

For now we could add -boot menu=on to make the ESC mashing easier?

@ogayot
Copy link
Member Author

ogayot commented Oct 8, 2024

Thanks for this, LGTM. I think the only way we can fix this for UEFI is to either specify the cdrom or firmware as a full device and use bootindex or something like that.

For now we could add -boot menu=on to make the ESC mashing easier?

Good point, TIL -boot menu=on, thanks!

@ogayot ogayot merged commit 8f6b50d into canonical:main Oct 17, 2024
11 of 12 checks passed
@ogayot ogayot deleted the kvm-test-reuse-target branch October 17, 2024 09:13
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.

3 participants