From b0c5df60a0d1e98e45437a5c415085371462db7f Mon Sep 17 00:00:00 2001 From: Chris Townsend Date: Tue, 1 Mar 2022 04:29:44 -0500 Subject: [PATCH 1/2] [backends/qemu] Add plumbing for getting networks based on platform --- src/platform/backends/qemu/qemu_platform.h | 6 ++++++ src/platform/backends/qemu/qemu_virtual_machine_factory.cpp | 5 +++++ src/platform/backends/qemu/qemu_virtual_machine_factory.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/platform/backends/qemu/qemu_platform.h b/src/platform/backends/qemu/qemu_platform.h index 3a747da0f6..4b1731139f 100644 --- a/src/platform/backends/qemu/qemu_platform.h +++ b/src/platform/backends/qemu/qemu_platform.h @@ -19,7 +19,9 @@ #define MULTIPASS_QEMU_PLATFORM_H #include +#include #include +#include #include #include #include @@ -52,6 +54,10 @@ class QemuPlatform : private DisabledCopyMove { return {}; }; + virtual std::vector networks() + { + throw NotImplementedOnThisBackendException("networks"); + }; protected: explicit QemuPlatform() = default; diff --git a/src/platform/backends/qemu/qemu_virtual_machine_factory.cpp b/src/platform/backends/qemu/qemu_virtual_machine_factory.cpp index a5819fca7b..55b885dbfd 100644 --- a/src/platform/backends/qemu/qemu_virtual_machine_factory.cpp +++ b/src/platform/backends/qemu/qemu_virtual_machine_factory.cpp @@ -113,3 +113,8 @@ QString mp::QemuVirtualMachineFactory::get_backend_directory_name() { return qemu_platform->get_directory_name(); } + +auto mp::QemuVirtualMachineFactory::networks() const -> std::vector +{ + return qemu_platform->networks(); +} diff --git a/src/platform/backends/qemu/qemu_virtual_machine_factory.h b/src/platform/backends/qemu/qemu_virtual_machine_factory.h index d1bc6be974..7591e3d6a1 100644 --- a/src/platform/backends/qemu/qemu_virtual_machine_factory.h +++ b/src/platform/backends/qemu/qemu_virtual_machine_factory.h @@ -41,6 +41,7 @@ class QemuVirtualMachineFactory final : public BaseVirtualMachineFactory void hypervisor_health_check() override; QString get_backend_version_string() override; QString get_backend_directory_name() override; + std::vector networks() const override; private: QemuPlatform::UPtr qemu_platform; From 852d54710f3f80c0ef2b61e2ba1fdeb92d8c1193 Mon Sep 17 00:00:00 2001 From: Chris Townsend Date: Tue, 1 Mar 2022 05:17:50 -0500 Subject: [PATCH 2/2] [qemu/platform] networks() should be const --- src/platform/backends/qemu/qemu_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/backends/qemu/qemu_platform.h b/src/platform/backends/qemu/qemu_platform.h index 4b1731139f..ed696843c1 100644 --- a/src/platform/backends/qemu/qemu_platform.h +++ b/src/platform/backends/qemu/qemu_platform.h @@ -54,7 +54,7 @@ class QemuPlatform : private DisabledCopyMove { return {}; }; - virtual std::vector networks() + virtual std::vector networks() const { throw NotImplementedOnThisBackendException("networks"); };