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

docs: Improvement regarding accel on windows #119

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

ciarancourtney
Copy link
Contributor

Some docs improvments related to accel arg, particularly on windows hosts

@ciarancourtney ciarancourtney requested a review from a team as a code owner January 24, 2023 13:43
@hashicorp-cla
Copy link

hashicorp-cla commented Jan 24, 2023

CLA assistant check
All committers have signed the CLA.

@ciarancourtney ciarancourtney changed the title Qemu win32 accel docs: Improvement regarding accel on windows Jan 24, 2023
@vheon
Copy link

vheon commented Jan 24, 2023

why is setting the qemuargs directly is better then setting:

machine_type = "q35"
accelerator = "hvf:kvm:whpx:tcg"

??

@ciarancourtney
Copy link
Contributor Author

why is setting the qemuargs directly is better then setting:

machine_type = "q35"
accelerator = "hvf:kvm:whpx:tcg"

??

Ultimately that would be better but its not supported in the current version, you can only set one accelerator. I had thought about submitting a PR to fallback to all possible accelerators and let qemu take the lead but thought it would introduce too much magic.

@vheon
Copy link

vheon commented Jan 26, 2023

@ciarancourtney I didn't tried and only now I see this code here

if _, ok := accels[c.Accelerator]; !ok {
errs = packersdk.MultiErrorAppend(
errs, errors.New("invalid accelerator, only 'kvm', 'tcg', 'xen', 'hax', 'hvf', 'whpx', or 'none' are allowed"))
}

maybe if we do a simple split on the passed string and check that each section should be one of the supported one could work. Something like:

for _, accelerator := range strings.Split(c.Accelerator, ":") {
		if _, ok := accels[accelerator]; !ok {
			errs = packersdk.MultiErrorAppend(
			errs, errors.New("invalid accelerator, only 'kvm', 'tcg', 'xen', 'hax', 'hvf', 'whpx', or 'none' are allowed"))
		}
	}

probably none should be handled differently...

@nywilken
Copy link
Contributor

@lbajolet-hashicorp when you get a second could you review and validate the documentation changes.

@vheon I don't enough to comment directly on your thoughts to improve the accelerator config settings. Maybe Lucas has thoughts. I recommend opening a separate issue for it so that it can be discussed or a PR to see how things would work.

@nywilken nywilken added the docs label Apr 28, 2023
@@ -235,9 +235,13 @@ type Config struct {
// add [ "-global", "virtio-pci.disable-modern=on" ] to `qemuargs` depending on the
// guest operating system.
//
// ~> For `whpx`, note that [Stefan Weil's QEMU for Windows distribution](https://qemu.weilnetz.de/w64/)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp Apr 28, 2023

Choose a reason for hiding this comment

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

According to the commit that changes this, WHPX is supported by Stefan Weil's Windows qemu distribution since 2019, so in that sense I tend to agree that this can be removed from our docs.
I cannot test this however since I don't have a Windows machine on hand

@nywilken
Copy link
Contributor

This change also requires the execution of go generate ./... to update the generated docs.

@lbajolet-hashicorp
Copy link
Contributor

lbajolet-hashicorp commented Apr 28, 2023

Regarding the acceleration methods, there's two alternatives that come to mind:

  • Either we do as @vheon proposed, and allow the : syntax and validate that each are supported.
  • We add a new attribute (accelerators for example), which will let us define multiple in order of preference, and pass it to qemu as a string with : in between each provided accelerator.

I agree with @nywilken though, this should probably be tracked in a separate issue.

Regarding none, as it stands, it's essentially to explicitely not define the accelerator attribute, which amounts to qemu's defualt behaviour, i.e. tcg.
When specifying a series of accelerators then, none should not be a valid choice, and should be rejected (or at worst ignored with a warning specifying why).

ciarancourtney and others added 4 commits October 5, 2023 15:00
- per https://www.qemu.org/docs/master/system/invocation.html#hxtool-0
- Note that qemu devs plan on deprecating colon syntax in order to apply
  individual accel options, but solution will be similar
  https://mail.gnu.org/archive/html/qemu-discuss/2019-11/msg00118.html
The HAXM deprecation notice was only exposed as a "NOTE", where it
should be a warning, and the tip for accelerator priority changes was
exposed as a warning, where it should have been an info box.
Since the doc changes for the accelerator on the builder, we should add
the newer, versioned docs to the repository in order for the upstream
docs to be updated as well.
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Hi @ciarancourtney,

Thanks for opening this, and sorry it was left open for so long.

I've taken a new look at the code, rebased it, and re-generated the docs from the changes in the code.
For future reference, if you want to suggest more changes to the documentation later, plase run make generate so the partials are up-to-date, otherwise we have some actions that will fail.

I'll merge this once tests go green, and we can keep an issue open for the accelerator choices. As pointed out in your commit, the : notation is now deprecated (refer to this thread for more information), so we should probably consider using multiple -accel options if/when we want to support this feature.

This being said, thanks again for opening this one @ciarancourtney!

@lbajolet-hashicorp lbajolet-hashicorp merged commit 75955ef into hashicorp:main Oct 5, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants