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

kola/qemuexec: allow changing guest network #3645

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Oct 13, 2023

This is useful when you're nesting VMs and you want the first VM to
be able to access the host. The default host address that QEMU assigns
(e.g. 10.0.2.2, modifiable via the host=... netdev knob) doesn't
always work because it's not actually an IP address owned by the host,
but proxied by QEMU itself.

So the source appears to come from localhost, but in some contexts (e.g.
iSCSI), we need the host and the guest to agree that the same IP refers
to the host.

With this, one can start the first VM as usual (e.g. cosa run) and the
second VM within with e.g. cosa run --usernet-addr 10.0.3.0/24 and be
able to talk back to the outer VM via the valid address 10.0.2.15.

To be clear, this can all be done with passthrough QEMU args, so this is
just about making it more convenient.

For local testing, it's useful to have an easy way to netboot a system.
Enable this by exposing QEMU's builtin support for TFTP serving and
BOOTP option.

For iPXE, one can just directly pass the iPXE script. For PXELINUX/GRUB,
you'll likely want to prepare a netboot directory with your artifacts.

Probably this should be streamlined more in the future, and also deduped
more with the related bits in `metal.go`. But anyway, for now this is
immediately useful in helping to test root on iSCSI locally (via iPXE's
`sanboot` option).
This is useful when you're nesting VMs and you want the first VM to
be able to access the host. The default host address that QEMU assigns
(e.g. 10.0.2.2, modifiable via the `host=...` netdev knob) doesn't
always work because it's not actually an IP address owned by the host,
but proxied by QEMU itself.

So the source appears to come from localhost, but in some contexts (e.g.
iSCSI), we need the host and the guest to agree that the same IP refers
to the host.

With this, one can start the first VM as usual (e.g. `cosa run`) and the
second VM within with e.g. `cosa run --usernet-addr 10.0.3.0/24` and be
able to talk back to the outer VM via the valid address 10.0.2.15.

To be clear, this can all be done with passthrough QEMU args, so this is
just about making it more convenient.
@jlebon
Copy link
Member Author

jlebon commented Oct 13, 2023

Requires #3644 (for conflicts, not conceptually).

Copy link
Contributor

@jbtrystram jbtrystram left a comment

Choose a reason for hiding this comment

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

LGTM

@jlebon jlebon merged commit fd7a277 into coreos:main Oct 17, 2023
5 checks passed
@jlebon jlebon deleted the pr/usernet-addr branch October 17, 2023 13:10
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.

None yet

2 participants