From 88f7b4093cf33a9e202066483de9cf1ed85ae77b Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Wed, 16 Oct 2024 15:22:37 +0200 Subject: [PATCH] chore(libsinsp): remove unused container manager method Signed-off-by: Leonardo Grasso --- userspace/libsinsp/container.cpp | 26 -------------------------- userspace/libsinsp/container.h | 9 --------- 2 files changed, 35 deletions(-) diff --git a/userspace/libsinsp/container.cpp b/userspace/libsinsp/container.cpp index 325bf6c92a..e113e84eea 100644 --- a/userspace/libsinsp/container.cpp +++ b/userspace/libsinsp/container.cpp @@ -548,7 +548,6 @@ void sinsp_container_manager::create_engines() { m_static_name, m_static_image); m_container_engines.push_back(engine); - m_container_engine_by_type[CT_STATIC] = engine; return; } #if !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__) @@ -556,65 +555,40 @@ void sinsp_container_manager::create_engines() { if(m_container_engine_mask & (1 << CT_PODMAN)) { auto podman_engine = std::make_shared(*this); m_container_engines.push_back(podman_engine); - m_container_engine_by_type[CT_PODMAN] = podman_engine; } if(m_container_engine_mask & (1 << CT_DOCKER)) { auto docker_engine = std::make_shared(*this); m_container_engines.push_back(docker_engine); - m_container_engine_by_type[CT_DOCKER] = docker_engine; } if(m_container_engine_mask & ((1 << CT_CRI) | (1 << CT_CRIO) | (1 << CT_CONTAINERD))) { auto cri_engine = std::make_shared(*this); m_container_engines.push_back(cri_engine); - m_container_engine_by_type[CT_CRI] = cri_engine; - m_container_engine_by_type[CT_CRIO] = cri_engine; - m_container_engine_by_type[CT_CONTAINERD] = cri_engine; } if(m_container_engine_mask & (1 << CT_LXC)) { auto lxc_engine = std::make_shared(*this); m_container_engines.push_back(lxc_engine); - m_container_engine_by_type[CT_LXC] = lxc_engine; } if(m_container_engine_mask & (1 << CT_LIBVIRT_LXC)) { auto libvirt_lxc_engine = std::make_shared(*this); m_container_engines.push_back(libvirt_lxc_engine); - m_container_engine_by_type[CT_LIBVIRT_LXC] = libvirt_lxc_engine; } if(m_container_engine_mask & (1 << CT_MESOS)) { auto mesos_engine = std::make_shared(*this); m_container_engines.push_back(mesos_engine); - m_container_engine_by_type[CT_MESOS] = mesos_engine; } if(m_container_engine_mask & (1 << CT_RKT)) { auto rkt_engine = std::make_shared(*this); m_container_engines.push_back(rkt_engine); - m_container_engine_by_type[CT_RKT] = rkt_engine; } if(m_container_engine_mask & (1 << CT_BPM)) { auto bpm_engine = std::make_shared(*this); m_container_engines.push_back(bpm_engine); - m_container_engine_by_type[CT_BPM] = bpm_engine; } #endif // _WIN32 #endif // MINIMAL_BUILD } -void sinsp_container_manager::update_container_with_size(sinsp_container_type type, - const std::string& container_id) { - auto found = m_container_engine_by_type.find(type); - if(found == m_container_engine_by_type.end()) { - libsinsp_logger()->format(sinsp_logger::SEV_ERROR, - "Container type %d not found when requesting size for %s", - type, - container_id.c_str()); - return; - } - - libsinsp_logger()->format(sinsp_logger::SEV_DEBUG, "Request size for %s", container_id.c_str()); - found->second->update_with_size(container_id); -} - void sinsp_container_manager::cleanup() { for(auto& eng : m_container_engines) { eng->cleanup(); diff --git a/userspace/libsinsp/container.h b/userspace/libsinsp/container.h index 17305c96d3..fdabe6591a 100644 --- a/userspace/libsinsp/container.h +++ b/userspace/libsinsp/container.h @@ -179,12 +179,6 @@ class sinsp_container_manager : public libsinsp::container_engine::container_cac void create_engines(); - /** - * Update the container_info associated with the given type and container_id - * to include the size of the container layer. This is not filled in the - * initial request because it can easily take seconds. - */ - void update_container_with_size(sinsp_container_type type, const std::string& container_id); void cleanup(); void set_docker_socket_path(std::string socket_path); @@ -254,9 +248,6 @@ class sinsp_container_manager : public libsinsp::container_engine::container_cac std::list> m_container_engines; - std::map> - m_container_engine_by_type; sinsp* m_inspector; std::shared_ptr m_sinsp_stats_v2;