Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f2ac024
[daemon] added the lxd deprecation warning for multipass list command.
georgeliao Apr 3, 2025
9d5354c
[daemon] improve the template parameters name
georgeliao Apr 3, 2025
25d5a65
[daemon] extended the warning to libvirt.
georgeliao Apr 3, 2025
200b974
[daemon] added the deprecation warning to launch command.
georgeliao Apr 4, 2025
b8e5958
[daemon] added warning message to find command.
georgeliao Apr 4, 2025
2e172b0
[set] added the warning to setting the driver to lxd or libvirt
georgeliao Apr 4, 2025
691f4df
[daemon] added the warning message to the info command.
georgeliao Apr 4, 2025
e4fd637
Revert "[daemon] added warning message to find command."
georgeliao Apr 4, 2025
6276dc7
[daemon][set cmd] move the deprecation_warning_template central place…
georgeliao Apr 4, 2025
2adbf60
[unit test] fix the linter.
georgeliao Apr 4, 2025
2233847
[daemon] rename the warning message name.
georgeliao Apr 7, 2025
1644495
[constants] refined the warning message for driver deprecation.
georgeliao Apr 9, 2025
b6ea000
Update include/multipass/constants.h
georgeliao Apr 11, 2025
2958ee9
[constants] improve the text based on review comments.
georgeliao Apr 11, 2025
f0dff69
[constants] refined the warning message.
georgeliao Apr 14, 2025
858be3c
[unit test] changing return empty string to qemu string for future pr…
georgeliao Apr 22, 2025
7b8f7ac
[daemon][set] recompose the deprecation message and refactor the cod…
georgeliao Apr 22, 2025
5f4f5d4
[utils] polished the deprecation warning message.
georgeliao Apr 23, 2025
728a754
[utils] added space between the * and the message.
georgeliao Apr 30, 2025
e55a34a
Update src/client/cli/cmd/set.cpp
georgeliao May 6, 2025
4c44ff7
Update src/utils/utils.cpp
georgeliao May 6, 2025
9c57114
Update src/utils/utils.cpp
georgeliao May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/multipass/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
#include <filesystem>
#include <functional>
#include <future>
#include <sstream>
#include <string>
#include <thread>
#include <vector>

#include <QDir>
Expand Down Expand Up @@ -321,4 +319,6 @@ std::string multipass::utils::qenum_to_string(RegisteredQtEnum val)
return qenum_to_qstring(val).toStdString();
}

std::string deprecation_warning_message_driver_concatenated(
const QString driver_name); // TODO lxd and libvirt migration, remove
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no "migration" in this case, but we get the idea...

#endif // MULTIPASS_UTILS_H
8 changes: 8 additions & 0 deletions src/client/cli/cmd/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@
{
key = keyval.at(0);
val = keyval.at(1);

#ifdef MULTIPASS_PLATFORM_LINUX
// TODO lxd and libvirt migration, remove
if (key == mp::driver_key && (val == "lxd" || val == "libvirt"))
{
std::cout << deprecation_warning_message_driver_concatenated(val);

Check warning on line 104 in src/client/cli/cmd/set.cpp

View check run for this annotation

Codecov / codecov/patch

src/client/cli/cmd/set.cpp#L104

Added line #L104 was not covered by tests
}
#endif
}
else
{
Expand Down
18 changes: 18 additions & 0 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,21 @@

populate_snapshot_fundamentals(snapshot, fundamentals);
}

template <typename Reply, typename Request>
void lxd_and_libvirt_deprecation_warning(
grpc::ServerReaderWriterInterface<Reply, Request>& server) // TODO lxd and libvirt migration, remove
{
#ifdef MULTIPASS_PLATFORM_LINUX
const auto current_driver = MP_SETTINGS.get(mp::driver_key);
if (current_driver == "lxd" || current_driver == "libvirt")
{
Reply reply{};
reply.set_log_line(deprecation_warning_message_driver_concatenated(current_driver));
server.Write(reply);

Check warning on line 1299 in src/daemon/daemon.cpp

View check run for this annotation

Codecov / codecov/patch

src/daemon/daemon.cpp#L1297-L1299

Added lines #L1297 - L1299 were not covered by tests
}
#endif
}
} // namespace

mp::Daemon::Daemon(std::unique_ptr<const DaemonConfig> the_config)
Expand Down Expand Up @@ -1544,6 +1559,7 @@
std::promise<grpc::Status>* status_promise) // clang-format off
try // clang-format on
{
lxd_and_libvirt_deprecation_warning(*server); // TODO lxd and libvirt migration, remove
mpl::ClientLogger<LaunchReply, LaunchRequest> logger{mpl::level_from(request->verbosity_level()), *config->logger,
server};

Expand Down Expand Up @@ -1728,6 +1744,7 @@
std::promise<grpc::Status>* status_promise) // clang-format off
try // clang-format on
{
lxd_and_libvirt_deprecation_warning(*server); // TODO lxd and libvirt migration, remove
mpl::ClientLogger<InfoReply, InfoRequest> logger{mpl::level_from(request->verbosity_level()), *config->logger,
server};
InfoReply response;
Expand Down Expand Up @@ -1818,6 +1835,7 @@
std::promise<grpc::Status>* status_promise) // clang-format off
try // clang-format on
{
lxd_and_libvirt_deprecation_warning(*server); // TODO lxd and libvirt migration, remove
mpl::ClientLogger<ListReply, ListRequest> logger{mpl::level_from(request->verbosity_level()), *config->logger,
server};
ListReply response;
Expand Down
20 changes: 20 additions & 0 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,23 @@
});
return it == std::cend(networks) ? std::nullopt : std::make_optional(*it);
}

std::string deprecation_warning_message_driver_concatenated(

Check warning on line 587 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L587

Added line #L587 was not covered by tests
const QString driver_name) // TODO lxd and libvirt migration, remove
{
constexpr auto driver_deprecation_warning_template_common_part =

Check warning on line 590 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L590

Added line #L590 was not covered by tests
"*** Warning! The {0} driver is deprecated and will be removed in an future "
"release. ***\n\n";

constexpr auto driver_deprecation_warning_lxd_part = "Instances will no longer be available in Multipass then, "

Check warning on line 594 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L594

Added line #L594 was not covered by tests
"but they will remain in LXD.\n\n";

constexpr auto driver_deprecation_warning_libvirt_part =

Check warning on line 597 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L597

Added line #L597 was not covered by tests
"Instances will remain available with the QEMU driver.\n\n";

const std::string deprecation_warning_message_driver_specific_part =
driver_name == "lxd" ? driver_deprecation_warning_lxd_part : driver_deprecation_warning_libvirt_part;

Check warning on line 601 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L601

Added line #L601 was not covered by tests

return fmt::format(driver_deprecation_warning_template_common_part, driver_name) +
deprecation_warning_message_driver_specific_part;

Check warning on line 604 in src/utils/utils.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/utils.cpp#L603-L604

Added lines #L603 - L604 were not covered by tests
}
2 changes: 2 additions & 0 deletions tests/test_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ struct Daemon : public mpt::DaemonTestFixture
a few more tests for `false`, since there are different portions of code depending on it */
EXPECT_CALL(mock_settings, get(Eq(mp::winterm_key))).WillRepeatedly(Return("none"));
EXPECT_CALL(mock_settings, get(Eq(mp::bridged_interface_key))).WillRepeatedly(Return("eth8"));
EXPECT_CALL(mock_settings, get(Eq(mp::driver_key)))
.WillRepeatedly(Return("qemu")); // TODO lxd and libvirt migration, remove
}

mpt::MockUtils::GuardedMock mock_utils_injection{mpt::MockUtils::inject<NiceMock>()};
Expand Down
7 changes: 2 additions & 5 deletions tests/test_daemon_launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@
*/

#include "blueprint_test_lambdas.h"
#include "common.h"
#include "daemon_test_fixture.h"
#include "mock_image_host.h"
#include "mock_json_utils.h"
#include "mock_permission_utils.h"
#include "mock_platform.h"
#include "mock_server_reader_writer.h"
#include "mock_settings.h"
#include "mock_virtual_machine.h"
#include "mock_vm_blueprint_provider.h"
#include "mock_vm_image_vault.h"
#include "stub_virtual_machine.h"
#include "stub_vm_image_vault.h"

#include <src/daemon/daemon.h>

Expand All @@ -46,6 +41,8 @@ struct TestDaemonLaunch : public mpt::DaemonTestFixture
EXPECT_CALL(mock_settings, register_handler).WillRepeatedly(Return(nullptr));
EXPECT_CALL(mock_settings, unregister_handler).Times(AnyNumber());
EXPECT_CALL(mock_settings, get(Eq(mp::mounts_key))).WillRepeatedly(Return("true"));
EXPECT_CALL(mock_settings, get(Eq(mp::driver_key)))
.WillRepeatedly(Return("qemu")); // TODO lxd and libvirt migration, remove
}

mpt::MockPlatform::GuardedMock attr{mpt::MockPlatform::inject<NiceMock>()};
Expand Down
Loading