canonical / multipass

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

Make snapshot and restore track the instance id #3446

Closed georgeliao closed 2 months ago

georgeliao commented 3 months ago

A few things are done in this PR.

  1. Removed make_cloud_init_meta_config and make_cloud_init_network_config in daemon.cpp which is the rebase fix forgotten to apply before.
  2. Made all the cloudinit free functions into singleton and established the unit test mocking framework for that.
  3. Toggle instance-id scheme was changed back to the simple appending "_e" since snapshot_restore will restore the instance-id so we will not have the long appending "_e" chain.
  4. Added add_extra_interface_to_cloud_init utility function into CloudInitFileOps, so it can be used by base_virtual_machine::add_network_interface and be mocked easily.
  5. apply_extra_interfaces_to_cloud_init function lxd part was removed for now because this utility function is only used in restore_snapshot and lxd does not support that yet.
  6. apply_extra_interfaces_to_cloud_init call from daemon is removed and each backend add_network_interface implementation is appended with a add_extra_interface_to_instance_cloud_init call.
  7. At last and the most important, the tracking instance id code in basesnapshot is added, including data member and get_instance_id function.
codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 88.92%. Comparing base (19f8477) to head (91049eb).

Files Patch % Lines
src/platform/backends/lxd/lxd_virtual_machine.h 0.00% 2 Missing :warning:
src/utils/yaml_node_utils.cpp 96.87% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3446 +/- ## ========================================== + Coverage 88.89% 88.92% +0.02% ========================================== Files 254 255 +1 Lines 14084 14112 +28 ========================================== + Hits 12520 12549 +29 + Misses 1564 1563 -1 ```

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

georgeliao commented 3 months ago

@ricab @luis4a0 , the public side of the PR is ready for review, please read the intro comment to have an overview of what has been done.

georgeliao commented 2 months ago

@luis4a0 , I think all the comments are addressed. Maybe you can have a look of the private side.