[vsock] Add ssh coordinates - #5070
Conversation
331cbd5 to
499d507
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new SSHCoordinates interface (backed by the RPC proto) to centralize SSH connection parameters for creating SSHSessions, as groundwork for future VSOCK-based sessions. It refactors VM, daemon, CLI/GUI clients, and tests to use the new coordinates object rather than separate host/port/username/key fields.
Changes:
- Adds
SSHCoordinatesto the RPC API and updates daemon/client code paths to usessh_coordinatesmaps inSSHInfoReply. - Refactors
PlainSSHSession,SSHClient,SFTPClient, andSFTPUtilsto acceptSSHCoordinates. - Updates VM backends/tests to provide
ssh_coordinates()and switches SSH port types touint32_t.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_sshfsmount.cpp | Builds PlainSSHSession using SSHCoordinates in mount tests |
| tests/unit/test_sshfs_mount_handler.cpp | Updates expectations to use ssh_coordinates() |
| tests/unit/test_ssh_process.cpp | Updates session creation to use SSHCoordinates helper |
| tests/unit/test_ssh_client.cpp | Refactors tests to construct SSHClient via SSHCoordinates |
| tests/unit/test_sftpserver.cpp | Updates SFTP server tests to use SSHCoordinates |
| tests/unit/test_sftp_client.cpp | Updates SFTP client tests to use SSHCoordinates |
| tests/unit/test_plain_ssh_session.cpp | Updates plain session tests to pass SSHCoordinates |
| tests/unit/test_cli_client.cpp | Updates CLI client tests to use ssh_coordinates reply map |
| tests/unit/test_base_virtual_machine.cpp | Adjusts stub ssh_port() return type to uint32_t |
| tests/unit/stub_virtual_machine.h | Adds stub ssh_coordinates() implementation |
| tests/unit/qemu/test_qemu_backend.cpp | Updates backend tests to read hostname via ssh_coordinates().tcp_host() |
| tests/unit/mock_virtual_machine.h | Adds mock ssh_coordinates() and updates ssh port mock type |
| tests/unit/mock_sftp_utils.h | Updates mock make_SFTPClient signature to take SSHCoordinates |
| src/sshfs_mount/sshfs_server.cpp | Constructs SSHCoordinates and passes to PlainSSHSession |
| src/sshfs_mount/sshfs_mount_handler.cpp | Uses ssh_coordinates() for username/host/port population |
| src/ssh/ssh_client.cpp | Replaces ctor taking host/port/user/key with SSHCoordinates |
| src/ssh/ssh_client_key_provider.cpp | Fixes ssh_key initialization before import |
| src/ssh/sftp_utils.cpp | Updates factory to create SFTPClient from SSHCoordinates |
| src/ssh/sftp_client.cpp | Refactors ctor to accept SSHCoordinates |
| src/ssh/plain_ssh_session.cpp | Refactors session setup/auth to use SSHCoordinates fields |
| src/rpc/multipass.proto | Replaces SSHInfo with SSHCoordinates and updates reply map field |
| src/platform/backends/virtualbox/virtualbox_virtual_machine.h | Moves ssh accessors to new signatures/types |
| src/platform/backends/virtualbox/virtualbox_virtual_machine.cpp | Updates ssh_port() return type |
| src/platform/backends/shared/base_virtual_machine.h | Adds ssh_coordinates() override |
| src/platform/backends/shared/base_virtual_machine.cpp | Implements ssh_coordinates() and updates session creation sites |
| src/platform/backends/qemu/qemu_virtual_machine.h | Updates ssh accessors signatures/types |
| src/platform/backends/qemu/qemu_virtual_machine.cpp | Updates ssh_port() return type |
| src/platform/backends/hyperv/hyperv_virtual_machine.h | Updates ssh accessors signatures/types |
| src/platform/backends/hyperv/hyperv_virtual_machine.cpp | Refactors remote IP lookup to accept SSHCoordinates |
| src/platform/backends/hyperv_api/hcs_virtual_machine.h | Updates ssh accessors signatures/types |
| src/platform/backends/hyperv_api/hcs_virtual_machine.cpp | Updates ssh_port() return type |
| src/platform/backends/applevz/applevz_virtual_machine.h | Updates ssh accessors signatures/types |
| src/platform/backends/applevz/applevz_virtual_machine.cpp | Updates ssh_port() return type |
| src/daemon/daemon.cpp | Populates SSHInfoReply via ssh_coordinates map |
| src/client/gui/lib/vm_details/terminal.dart | Switches GUI terminal isolate wiring to SSHCoordinates |
| src/client/gui/lib/grpc_client.dart | Updates GUI RPC logging and sshInfo() accessor to use sshCoordinates |
| src/client/cli/cmd/transfer.cpp | Uses SSHCoordinates to construct SFTP client via utils |
| src/client/cli/cmd/shell.cpp | Uses SSHCoordinates to construct SSHClient |
| src/client/cli/cmd/exec.cpp | Uses SSHCoordinates to construct SSHClient and for sudo username |
| include/multipass/virtual_machine.h | Adds ssh_coordinates() to VM interface and updates access levels/types |
| include/multipass/ssh/ssh_client.h | Updates SSHClient public ctor to accept SSHCoordinates |
| include/multipass/ssh/sftp_utils.h | Updates SFTP utils API to accept SSHCoordinates |
| include/multipass/ssh/sftp_client.h | Updates SFTPClient ctor to accept SSHCoordinates |
| include/multipass/ssh/plain_ssh_session.h | Updates PlainSSHSession ctor to accept SSHCoordinates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## vsock #5070 +/- ##
========================================
Coverage ? 73.41%
========================================
Files ? 332
Lines ? 17923
Branches ? 0
========================================
Hits ? 13156
Misses ? 4767
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
407b469 to
0a10137
Compare
99a5486 to
271f75d
Compare
Stack garbage would populate the variable and cause a SIGSEGV when freed, if the libssh function failed to parse the key.
The method does the same thing in all backends
Now fulfilled through ssh_coordinates
34b7d0a to
b047aaa
Compare
e2dda41 to
347624d
Compare
45ccdac to
ee0643e
Compare
Description
Testing
Checklist
MULTI-2742