canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.52k stars 631 forks source link

Parallelize info intra vm #3465

Closed ricab closed 2 months ago

ricab commented 3 months ago

Introduce the parallelization of the SSH commands that are used for info within VMs with multiple cores.

With the exception of the command to fetch IPs (which follows a different scheme that is used also for list), all the necessary commands are combined into a single one and executed in one go on the instane over SSH. Two versions of this single combined command are derived: one sequential and one parallel. The parallel version is used when the VM has multiple cores. On single-core VMs, the sequential version is used.

For organization, and to avoid polluting the unnamed namespace in daemon.cpp any further, the code is now in a new helper class: RuntimeInstanceInfoHelper.

Credit goes to @andrei-toterman for the idea implemented here. Thanks!

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 24.32432% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 88.82%. Comparing base (7473d6b) to head (ebb3b0a).

Files Patch % Lines
src/daemon/runtime_instance_info_helper.cpp 25.00% 21 Missing :warning:
src/utils/utils.cpp 16.66% 5 Missing :warning:
src/daemon/daemon.cpp 33.33% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3465 +/- ## ========================================== - Coverage 88.87% 88.82% -0.06% ========================================== Files 253 254 +1 Lines 14104 14115 +11 ========================================== + Hits 12535 12537 +2 - Misses 1569 1578 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

townsend2010 commented 2 months ago

Hey @ricab,

Could you please rebase and fix the conflicts here at your earliest convenience? I'm ready to functionally test this and get it in! Thanks!

ricab commented 2 months ago

Hey @townsend2010, just to let you know I've rebased.