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

Improve cross platform support of QEMU machine #21252

Closed
wants to merge 1 commit into from

Conversation

arixmkii
Copy link
Contributor

@arixmkii arixmkii commented Jan 13, 2024

This is a subset of bugfixes and technical changes from #17473 as the PR in question is really struggling to get merged and will probably have some more rebase iteration. Adding this commit with technical changes will allow to reduce the PR in question to actual functional changes w/o bugfixes.

Recap of changes:

  • SendQuit function promoted to public API as it has potential to be useful outside of the module
  • more magic values extracted to consts
  • Process ping and process termination utilities refactored to be cross platform compatible
  • Usage of unix specific routines in shared code part removed (instead per platform utilities are used)
  • Failed deletion of pid file now results in warning logged instead of error return as there is legit reason for it to fail, because owning process could terminate faster and remove file before this code is executed. Also podman cli process could lack rights to remove file belonging to another process
  • gvproxy is now stopped with SIGTERM instead of SIGKILL to allow it to do the cleanup instead of aborting
  • there is a cutoff now to how long process will wait for the VM to terminate and a warning is logged on failure
  • on Windows npipe part of the connectionInfo will be populated
  • Fallback UID for machine provided on Windows
  • minor fixes in comments

Does this PR introduce a user-facing change?

None

[NO NEW TESTS NEEDED]

Copy link
Contributor

openshift-ci bot commented Jan 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: arixmkii
Once this PR has been reviewed and has the lgtm label, please assign giuseppe for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@arixmkii
Copy link
Contributor Author

@n1hility @baude Could you take a look? You reviewed these changes as part of the original PR, you might be the most suitable reviewers here.

@arixmkii arixmkii force-pushed the cross-platform-qemu-fixes branch 2 times, most recently from bec9053 to 576db31 Compare January 14, 2024 15:37
@mheon
Copy link
Member

mheon commented Jan 16, 2024

LGTM

pkg/machine/e2e/README.md Outdated Show resolved Hide resolved
pkg/machine/qemu/machine.go Outdated Show resolved Hide resolved
pkg/machine/qemu/machine_unix.go Outdated Show resolved Hide resolved
@@ -1101,18 +1115,18 @@ func getDiskSize(path string) (uint64, error) {

// startHostNetworking runs a binary on the host system that allows users
// to set up port forwarding to the podman virtual machine
func (v *MachineVM) startHostNetworking() (string, machine.APIForwardingState, error) {
func (v *MachineVM) startHostNetworking(vlanSocket *define.VMFile) (string, machine.APIForwardingState, *os.Process, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Why are we passing in the qmp socket into the function if we already have access to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have implementation, which supports UNIX socket VLAN from newer QEMU QAPI, which is compatible also with Windows OS supporting AF_UNIX. In this case it is impossible to use hack with reusing QMP address and need to provide dedicated VLAN socket address as we need both in the same command line arixmkii@9e3e20f#diff-4a3677ed5171641eba40e911f19bbf5970550a9e1ce75a30959e6c8032b2e39cR524

}
return forwardSock, state, nil
return forwardSock, state, c.Process, nil
Copy link
Member

Choose a reason for hiding this comment

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

What was the decision behind returning the os.Process? it currently isn't being used by the caller

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have implementation based of UNIX socket VLAN based which checks the pid of this process to understand if we have the process alive arixmkii@9e3e20f#diff-4a3677ed5171641eba40e911f19bbf5970550a9e1ce75a30959e6c8032b2e39cR542

@jakecorrenti
Copy link
Member

I would like to make sure we get a nod from @baude before this goes through

@baude
Copy link
Member

baude commented Jan 16, 2024

@arixmkii there is a large refactor going on rn for this code in question ... here would be my offer ... I'm working on QEMU and should have that done soonish. It is the worst because it is the first. That PR will go to a dev branch. Once that PR is reviewed and merged, lets work to bring your qemu stuff in at that point and on the dev branch where the machine refactoring is going on. then it should go in smoothly, ok?

@arixmkii
Copy link
Contributor Author

@baude sounds reasonable to me 👍 Thank you!

@arixmkii arixmkii force-pushed the cross-platform-qemu-fixes branch from 576db31 to 48aa60b Compare January 16, 2024 18:47
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2024
@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@arixmkii
Copy link
Contributor Author

arixmkii commented Feb 9, 2024

Will be continued in #21594

@arixmkii arixmkii closed this Feb 9, 2024
@arixmkii arixmkii deleted the cross-platform-qemu-fixes branch March 1, 2024 13:58
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 31, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants