From a883b34db2ca8d17261b0a2dd154f12487ddebfa Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Mon, 10 Feb 2025 09:37:26 +0800
Subject: [PATCH 187/198] remove uncalled functions in cri v1

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 src/daemon/common/cri/v1/v1_cri_helpers.cc    | 67 -------------------
 src/daemon/common/cri/v1/v1_cri_helpers.h     |  8 ---
 src/daemon/common/cri/v1/v1_naming.cc         | 30 ---------
 src/daemon/common/cri/v1/v1_naming.h          |  3 -
 .../v1/v1_cri_container_manager_service.cc    | 27 --------
 .../cri/v1/v1_cri_container_manager_service.h |  1 -
 .../v1/v1_cri_pod_sandbox_manager_service.cc  | 63 -----------------
 .../v1/v1_cri_pod_sandbox_manager_service.h   |  7 --
 .../entry/cri/v1alpha/v1alpha_cri_helpers.cc  | 21 ------
 .../entry/cri/v1alpha/v1alpha_cri_helpers.h   |  3 -
 src/daemon/sandbox/controller_manager.cc      |  5 --
 src/daemon/sandbox/controller_manager.h       |  1 -
 src/daemon/sandbox/sandbox.cc                 |  5 --
 src/daemon/sandbox/sandbox.h                  |  1 -
 src/daemon/sandbox/sandbox_manager.cc         |  6 --
 src/daemon/sandbox/sandbox_manager.h          |  1 -
 16 files changed, 249 deletions(-)

diff --git a/src/daemon/common/cri/v1/v1_cri_helpers.cc b/src/daemon/common/cri/v1/v1_cri_helpers.cc
index dfe14ade..d71e3681 100644
--- a/src/daemon/common/cri/v1/v1_cri_helpers.cc
+++ b/src/daemon/common/cri/v1/v1_cri_helpers.cc
@@ -57,27 +57,6 @@ auto ContainerStatusToRuntime(Container_Status status) -> runtime::v1::Container
     }
 }
 
-auto CheckpointToSandbox(const std::string &id, const CRI::PodSandboxCheckpoint &checkpoint)
--> std::unique_ptr<runtime::v1::PodSandbox>
-{
-    std::unique_ptr<runtime::v1::PodSandbox> result(new (std::nothrow) runtime::v1::PodSandbox);
-    if (result == nullptr) {
-        return nullptr;
-    }
-    runtime::v1::PodSandboxMetadata *metadata = new (std::nothrow) runtime::v1::PodSandboxMetadata;
-    if (metadata == nullptr) {
-        return nullptr;
-    }
-
-    metadata->set_name(checkpoint.GetName());
-    metadata->set_namespace_(checkpoint.GetNamespace());
-    result->set_allocated_metadata(metadata);
-    result->set_id(id);
-    result->set_state(runtime::v1::SANDBOX_NOTREADY);
-
-    return result;
-}
-
 void UpdateCreateConfig(container_config *createConfig, host_config *hc,
                         const runtime::v1::ContainerConfig &config, const std::string &podSandboxID,
                         Errors &error)
@@ -199,24 +178,6 @@ auto GenerateEnvList(const ::google::protobuf::RepeatedPtrField<::runtime::v1::K
     return vect;
 }
 
-auto ValidateCheckpointKey(const std::string &key, Errors &error) -> bool
-{
-    const std::string PATTERN { "^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$" };
-
-    if (key.empty()) {
-        goto err_out;
-    }
-
-    if (key.size() <= CRIHelpers::Constants::MAX_CHECKPOINT_KEY_LEN &&
-        util_reg_match(PATTERN.c_str(), key.c_str()) == 0) {
-        return true;
-    }
-
-err_out:
-    error.Errorf("invalid key: %s", key.c_str());
-    return false;
-}
-
 auto ToIsuladContainerStatus(const runtime::v1::ContainerStateValue &state) -> std::string
 {
     if (state.state() == runtime::v1::CONTAINER_CREATED) {
@@ -362,34 +323,6 @@ void AddSecurityOptsToHostConfig(std::vector<std::string> &securityOpts, host_co
     }
 
 }
-void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID,
-                           Errors &error)
-{
-    std::string PodID;
-    container_inspect *info = CRIHelpers::InspectContainer(containerID, error, false);
-    if (error.NotEmpty()) {
-        error.Errorf("Failed to inspect container %s: %s", containerID.c_str(), error.GetCMessage());
-        return;
-    }
-
-    // TODO: Refactor after adding the ability to use sandbox manager for sandboxid query
-    if (info->config != nullptr && info->config->labels != nullptr) {
-        for (size_t j = 0; j < info->config->labels->len; j++) {
-            if (strcmp(info->config->labels->keys[j], CRIHelpers::Constants::SANDBOX_ID_LABEL_KEY.c_str()) == 0
-                && strcmp(info->config->labels->values[j], "") != 0) {
-                PodID = info->config->labels->values[j];
-                break;
-            }
-        }
-    }
-
-    if (PodID.empty()) {
-        error.Errorf("Failed to get sandbox id for container %s", containerID.c_str());
-    } else {
-        sandboxID = PodID;
-    }
-    realContainerID = info->id;
-}
 
 #ifdef ENABLE_SANDBOXER
 std::string CRISandboxerConvert(const std::string &runtime)
diff --git a/src/daemon/common/cri/v1/v1_cri_helpers.h b/src/daemon/common/cri/v1/v1_cri_helpers.h
index 22cffd0d..6a848581 100644
--- a/src/daemon/common/cri/v1/v1_cri_helpers.h
+++ b/src/daemon/common/cri/v1/v1_cri_helpers.h
@@ -42,9 +42,6 @@ struct commonSecurityContext {
 
 auto ContainerStatusToRuntime(Container_Status status) -> runtime::v1::ContainerState;
 
-auto CheckpointToSandbox(const std::string &id, const CRI::PodSandboxCheckpoint &checkpoint)
--> std::unique_ptr<runtime::v1::PodSandbox>;
-
 void UpdateCreateConfig(container_config *createConfig, host_config *hc,
                         const runtime::v1::ContainerConfig &config, const std::string &podSandboxID,
                         Errors &error);
@@ -55,8 +52,6 @@ void GenerateMountBindings(const google::protobuf::RepeatedPtrField<runtime::v1:
 auto GenerateEnvList(const ::google::protobuf::RepeatedPtrField<::runtime::v1::KeyValue> &envs)
 -> std::vector<std::string>;
 
-auto ValidateCheckpointKey(const std::string &key, Errors &error) -> bool;
-
 auto ToIsuladContainerStatus(const runtime::v1::ContainerStateValue &state) -> std::string;
 
 auto GetSeccompSecurityOpts(const bool hasSeccomp, const ::runtime::v1::SecurityProfile &seccomp,
@@ -72,9 +67,6 @@ auto GetSecurityOpts(const commonSecurityContext &context, const char &separator
 
 void AddSecurityOptsToHostConfig(std::vector<std::string> &securityOpts, host_config *hostconfig, Errors &error);
 
-void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID,
-                           Errors &error);
-
 std::string CRISandboxerConvert(const std::string &runtime);
 
 void ApplySandboxSecurityContextToHostConfig(const runtime::v1::LinuxSandboxSecurityContext &context, host_config *hc,
diff --git a/src/daemon/common/cri/v1/v1_naming.cc b/src/daemon/common/cri/v1/v1_naming.cc
index 1a1ebb0d..2a5b972c 100644
--- a/src/daemon/common/cri/v1/v1_naming.cc
+++ b/src/daemon/common/cri/v1/v1_naming.cc
@@ -44,36 +44,6 @@ std::string MakeSandboxName(const runtime::v1::PodSandboxMetadata &metadata)
     return sname;
 }
 
-void ParseSandboxName(const google::protobuf::Map<std::string, std::string> &annotations,
-                      runtime::v1::PodSandboxMetadata &metadata, Errors &err)
-{
-    if (annotations.count(CRIHelpers::Constants::SANDBOX_NAME_ANNOTATION_KEY) == 0) {
-        err.Errorf("annotation don't contains the sandbox name, failed to parse it");
-        return;
-    }
-
-    if (annotations.count(CRIHelpers::Constants::SANDBOX_NAMESPACE_ANNOTATION_KEY) == 0) {
-        err.Errorf("annotation don't contains the sandbox namespace, failed to parse it");
-        return;
-    }
-
-    if (annotations.count(CRIHelpers::Constants::SANDBOX_UID_ANNOTATION_KEY) == 0) {
-        err.Errorf("annotation don't contains the sandbox uid, failed to parse it");
-        return;
-    }
-
-    if (annotations.count(CRIHelpers::Constants::SANDBOX_ATTEMPT_ANNOTATION_KEY) == 0) {
-        err.Errorf("annotation don't contains the sandbox attempt, failed to parse it");
-        return;
-    }
-
-    metadata.set_name(annotations.at(CRIHelpers::Constants::SANDBOX_NAME_ANNOTATION_KEY));
-    metadata.set_namespace_(annotations.at(CRIHelpers::Constants::SANDBOX_NAMESPACE_ANNOTATION_KEY));
-    metadata.set_uid(annotations.at(CRIHelpers::Constants::SANDBOX_UID_ANNOTATION_KEY));
-    auto sandboxAttempt = annotations.at(CRIHelpers::Constants::SANDBOX_ATTEMPT_ANNOTATION_KEY);
-    metadata.set_attempt(static_cast<google::protobuf::uint32>(std::stoul(sandboxAttempt)));
-}
-
 std::string MakeContainerName(const runtime::v1::PodSandboxConfig &s, const runtime::v1::ContainerConfig &c)
 {
     std::string sname;
diff --git a/src/daemon/common/cri/v1/v1_naming.h b/src/daemon/common/cri/v1/v1_naming.h
index d0862077..364f17c9 100644
--- a/src/daemon/common/cri/v1/v1_naming.h
+++ b/src/daemon/common/cri/v1/v1_naming.h
@@ -26,9 +26,6 @@ std::string MakeSandboxName(const runtime::v1::PodSandboxMetadata &metadata);
 std::string MakeContainerName(const runtime::v1::PodSandboxConfig &s,
                               const runtime::v1::ContainerConfig &c);
 
-void ParseSandboxName(const google::protobuf::Map<std::string, std::string> &annotations,
-                      runtime::v1::PodSandboxMetadata &metadata, Errors &err);
-
 void ParseContainerName(const google::protobuf::Map<std::string, std::string> &annotations,
                         runtime::v1::ContainerMetadata *metadata, Errors &err);
 } // namespace CRINamingV1
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
index 1e84d14c..e8dcd699 100644
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
@@ -33,33 +33,6 @@
 #endif
 
 namespace CRIV1 {
-auto ContainerManagerService::GetContainerOrSandboxRuntime(const std::string &realID, Errors &error) -> std::string
-{
-    std::string runtime;
-    if (m_cb == nullptr || m_cb->container.get_runtime == nullptr) {
-        error.SetError("Unimplemented callback");
-        return runtime;
-    }
-    container_get_runtime_response *response { nullptr };
-
-    if (m_cb->container.get_runtime(realID.c_str(), &response) != 0) {
-        if (response != nullptr && response->errmsg != nullptr) {
-            error.SetError(response->errmsg);
-        } else {
-            error.SetError("Failed to call get id callback");
-        }
-        goto cleanup;
-    }
-
-    if (response->runtime != nullptr) {
-        runtime = response->runtime;
-    }
-
-cleanup:
-    free_container_get_runtime_response(response);
-    return runtime;
-}
-
 auto ContainerManagerService::PackCreateContainerHostConfigDevices(
     const runtime::v1::ContainerConfig &containerConfig, host_config *hostconfig, Errors &error) -> int
 {
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.h b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.h
index 50f5ed69..1153b79c 100644
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.h
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.h
@@ -73,7 +73,6 @@ public:
     void Attach(const runtime::v1::AttachRequest &req, runtime::v1::AttachResponse *resp, Errors &error);
 
 private:
-    auto GetContainerOrSandboxRuntime(const std::string &realID, Errors &error) -> std::string;
     auto GenerateCreateContainerRequest(sandbox::Sandbox &sandbox,
                                         const runtime::v1::ContainerConfig &containerConfig,
                                         const runtime::v1::PodSandboxConfig &podSandboxConfig,
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
index a5f98619..43705853 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
@@ -491,17 +491,6 @@ void PodSandboxManagerService::ClearCniNetwork(const std::shared_ptr<sandbox::Sa
     }
 }
 
-auto PodSandboxManagerService::GetSandboxKey(const container_inspect *inspect_data) -> std::string
-{
-    if (inspect_data == nullptr || inspect_data->network_settings == nullptr ||
-        inspect_data->network_settings->sandbox_key == nullptr) {
-        ERROR("Inspect data does not have network settings");
-        return std::string("");
-    }
-
-    return std::string(inspect_data->network_settings->sandbox_key);
-}
-
 auto PodSandboxManagerService::GetContainerListResponse(const std::string &readSandboxID,
                                                         std::vector<std::string> &errors) -> std::unique_ptr<CStructWrapper<container_list_response>>
 {
@@ -589,21 +578,6 @@ auto PodSandboxManagerService::StopAllContainersInSandbox(const std::string &rea
     return ret;
 }
 
-auto PodSandboxManagerService::GetNetworkReady(const std::string &podSandboxID, Errors &error) -> bool
-{
-    std::lock_guard<std::mutex> lockGuard(m_networkReadyLock);
-
-    bool ready { false };
-    auto iter = m_networkReady.find(podSandboxID);
-    if (iter != m_networkReady.end()) {
-        ready = iter->second;
-    } else {
-        error.Errorf("Do not find network: %s", podSandboxID.c_str());
-    }
-
-    return ready;
-}
-
 void PodSandboxManagerService::StopPodSandbox(const std::string &podSandboxID, Errors &error)
 {
     if (m_cb == nullptr || m_cb->container.stop == nullptr) {
@@ -674,16 +648,6 @@ void PodSandboxManagerService::RemoveAllContainersInSandbox(const std::string &r
     }
 }
 
-void PodSandboxManagerService::ClearNetworkReady(const std::string &podSandboxID)
-{
-    std::lock_guard<std::mutex> lockGuard(m_networkReadyLock);
-
-    auto iter = m_networkReady.find(podSandboxID);
-    if (iter != m_networkReady.end()) {
-        m_networkReady.erase(iter);
-    }
-}
-
 void PodSandboxManagerService::RemovePodSandbox(const std::string &podSandboxID, Errors &error)
 {
     std::vector<std::string> errors;
@@ -766,33 +730,6 @@ void PodSandboxManagerService::RemovePodSandbox(const std::string &podSandboxID,
 #endif
 }
 
-auto PodSandboxManagerService::SharesHostNetwork(const container_inspect *inspect) -> runtime::v1::NamespaceMode
-{
-    if (inspect != nullptr && inspect->host_config != nullptr && (inspect->host_config->network_mode != nullptr) &&
-        std::string(inspect->host_config->network_mode) == CRI::Constants::namespaceModeHost) {
-        return runtime::v1::NamespaceMode::NODE;
-    }
-    return runtime::v1::NamespaceMode::POD;
-}
-
-auto PodSandboxManagerService::SharesHostPid(const container_inspect *inspect) -> runtime::v1::NamespaceMode
-{
-    if (inspect != nullptr && inspect->host_config != nullptr && (inspect->host_config->pid_mode != nullptr) &&
-        std::string(inspect->host_config->pid_mode) == CRI::Constants::namespaceModeHost) {
-        return runtime::v1::NamespaceMode::NODE;
-    }
-    return runtime::v1::NamespaceMode::CONTAINER;
-}
-
-auto PodSandboxManagerService::SharesHostIpc(const container_inspect *inspect) -> runtime::v1::NamespaceMode
-{
-    if (inspect != nullptr && inspect->host_config != nullptr && (inspect->host_config->ipc_mode != nullptr) &&
-        std::string(inspect->host_config->ipc_mode) == CRI::Constants::namespaceModeHost) {
-        return runtime::v1::NamespaceMode::NODE;
-    }
-    return runtime::v1::NamespaceMode::POD;
-}
-
 void PodSandboxManagerService::GetIPs(std::shared_ptr<sandbox::Sandbox> sandbox, std::vector<std::string> &ips)
 {
     const auto id = sandbox->GetId();
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.h b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.h
index d5c0cf91..b02216c0 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.h
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.h
@@ -93,12 +93,7 @@ private:
     auto GetContainerListResponse(const std::string &readSandboxID,
                                   std::vector<std::string> &errors) -> std::unique_ptr<CStructWrapper<container_list_response>>;
     auto StopAllContainersInSandbox(const std::string &readSandboxID, Errors &error) -> int;
-    auto GetNetworkReady(const std::string &podSandboxID, Errors &error) -> bool;
     void RemoveAllContainersInSandbox(const std::string &readSandboxID, std::vector<std::string> &errors);
-    void ClearNetworkReady(const std::string &podSandboxID);
-    auto SharesHostNetwork(const container_inspect *inspect) -> runtime::v1::NamespaceMode;
-    auto SharesHostPid(const container_inspect *inspect) -> runtime::v1::NamespaceMode;
-    auto SharesHostIpc(const container_inspect *inspect) -> runtime::v1::NamespaceMode;
     void SetSandboxStatusNetwork(std::shared_ptr<sandbox::Sandbox> sandbox,
                                  std::unique_ptr<runtime::v1::PodSandboxStatus> &podStatus);
     void GetIPs(std::shared_ptr<sandbox::Sandbox> sandbox, std::vector<std::string> &ips);
@@ -108,7 +103,6 @@ private:
     auto GetAvailableBytes(const uint64_t &memoryLimit, const uint64_t &workingSetBytes) -> uint64_t;
     void GetPodSandboxCgroupMetrics(const std::string &cgroupParent, cgroup_metrics_t &cgroupMetrics,
                                     Errors &error);
-    auto GetSandboxKey(const container_inspect *inspect_data) -> std::string;
     void GetPodSandboxNetworkMetrics(const std::string &netnsPath,
                                      std::map<std::string, std::string> &annotations,
                                      std::vector<Network::NetworkInterfaceStats> &netMetrics, Errors &error);
@@ -138,7 +132,6 @@ private:
 private:
     std::string m_podSandboxImage;
     std::mutex m_networkReadyLock;
-    std::map<std::string, bool> m_networkReady;
     service_executor_t *m_cb { nullptr };
     std::shared_ptr<Network::PluginManager> m_pluginManager { nullptr };
     bool m_enablePodEvents;
diff --git a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
index 0afea06a..3974add5 100644
--- a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
+++ b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
@@ -53,27 +53,6 @@ auto ContainerStatusToRuntime(Container_Status status) -> runtime::v1alpha2::Con
     }
 }
 
-auto CheckpointToSandbox(const std::string &id, const CRI::PodSandboxCheckpoint &checkpoint)
--> std::unique_ptr<runtime::v1alpha2::PodSandbox>
-{
-    std::unique_ptr<runtime::v1alpha2::PodSandbox> result(new (std::nothrow) runtime::v1alpha2::PodSandbox);
-    if (result == nullptr) {
-        return nullptr;
-    }
-    runtime::v1alpha2::PodSandboxMetadata *metadata = new (std::nothrow) runtime::v1alpha2::PodSandboxMetadata;
-    if (metadata == nullptr) {
-        return nullptr;
-    }
-
-    metadata->set_name(checkpoint.GetName());
-    metadata->set_namespace_(checkpoint.GetNamespace());
-    result->set_allocated_metadata(metadata);
-    result->set_id(id);
-    result->set_state(runtime::v1alpha2::SANDBOX_NOTREADY);
-
-    return result;
-}
-
 void UpdateCreateConfig(container_config *createConfig, host_config *hc,
                         const runtime::v1alpha2::ContainerConfig &config, const std::string &podSandboxID,
                         Errors &error)
diff --git a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.h b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.h
index 6bca8169..f3331421 100644
--- a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.h
+++ b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.h
@@ -40,9 +40,6 @@ struct commonSecurityContext {
 
 auto ContainerStatusToRuntime(Container_Status status) -> runtime::v1alpha2::ContainerState;
 
-auto CheckpointToSandbox(const std::string &id, const CRI::PodSandboxCheckpoint &checkpoint)
--> std::unique_ptr<runtime::v1alpha2::PodSandbox>;
-
 void UpdateCreateConfig(container_config *createConfig, host_config *hc,
                         const runtime::v1alpha2::ContainerConfig &config, const std::string &podSandboxID,
                         Errors &error);
diff --git a/src/daemon/sandbox/controller_manager.cc b/src/daemon/sandbox/controller_manager.cc
index 947f2d19..ae01fefe 100644
--- a/src/daemon/sandbox/controller_manager.cc
+++ b/src/daemon/sandbox/controller_manager.cc
@@ -55,11 +55,6 @@ bool ControllerManager::Init(Errors &error)
     return true;
 }
 
-bool ControllerManager::Cleanup(Errors &error)
-{
-    return true;
-}
-
 auto ControllerManager::RegisterShimController(Errors &error) -> bool
 {
     if (m_controllers.find(SHIM_CONTROLLER_NAME) != m_controllers.end()) {
diff --git a/src/daemon/sandbox/controller_manager.h b/src/daemon/sandbox/controller_manager.h
index 3fd547cf..c8febffb 100644
--- a/src/daemon/sandbox/controller_manager.h
+++ b/src/daemon/sandbox/controller_manager.h
@@ -27,7 +27,6 @@ public:
     static auto GetInstance() -> ControllerManager*;
 
     auto Init(Errors &error) -> bool;
-    auto Cleanup(Errors &error) -> bool;
     auto GetController(const std::string &name) -> std::shared_ptr<Controller>;
 private:
     auto RegisterShimController(Errors &error) -> bool;
diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
index d105d71a..0ddbb9ce 100644
--- a/src/daemon/sandbox/sandbox.cc
+++ b/src/daemon/sandbox/sandbox.cc
@@ -210,11 +210,6 @@ auto Sandbox::GetPid() -> uint32_t
     return m_state.pid;
 }
 
-auto Sandbox::GetImage() -> const std::string &
-{
-    return m_image;
-}
-
 void Sandbox::DoUpdateExitedStatus(const ControllerExitInfo &exitInfo)
 {
     WriteGuard<RWMutex> lock(m_stateMutex);
diff --git a/src/daemon/sandbox/sandbox.h b/src/daemon/sandbox/sandbox.h
index 58d60ecb..aa9071ac 100644
--- a/src/daemon/sandbox/sandbox.h
+++ b/src/daemon/sandbox/sandbox.h
@@ -106,7 +106,6 @@ public:
     auto GetCreatedAt() -> uint64_t;
     auto GetPid() -> uint32_t;
     auto GetTaskAddress() const -> const std::string &;
-    auto GetImage() -> const std::string &;
     void SetNetMode(const std::string &mode);
     void SetController(std::shared_ptr<Controller> controller);
     void AddAnnotations(const std::string &key, const std::string &value);
diff --git a/src/daemon/sandbox/sandbox_manager.cc b/src/daemon/sandbox/sandbox_manager.cc
index a7908a60..d884902d 100644
--- a/src/daemon/sandbox/sandbox_manager.cc
+++ b/src/daemon/sandbox/sandbox_manager.cc
@@ -405,12 +405,6 @@ auto SandboxManager::NameIndexGet(const std::string &name) -> std::string
     return std::string();
 }
 
-auto SandboxManager::NameIndexGetAll(void) -> std::map<std::string, std::string>
-{
-    ReadGuard<RWMutex> lock(m_indexRWMutex);
-    return m_nameIndexMap;
-}
-
 auto SandboxManager::GetSandboxRootpath() -> std::string
 {
     __isula_auto_free char *root_path = NULL;
diff --git a/src/daemon/sandbox/sandbox_manager.h b/src/daemon/sandbox/sandbox_manager.h
index b6007ad8..a5fb702f 100644
--- a/src/daemon/sandbox/sandbox_manager.h
+++ b/src/daemon/sandbox/sandbox_manager.h
@@ -62,7 +62,6 @@ private:
     void NameIndexAdd(const std::string &name, const std::string &id);
     void NameIndexRemove(const std::string &name);
     auto NameIndexGet(const std::string &name) -> std::string;
-    auto NameIndexGetAll(void) -> std::map<std::string, std::string>;
 
     auto IDNameManagerRemoveEntry(const std::string &id, const std::string &name) -> bool;
     auto IDNameManagerNewEntry(std::string &id, const std::string &name) -> bool;
-- 
2.34.1

