1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
From 3d8c6127161acbe35bf03fe495ac43e2b9242cbf Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Tue, 19 Dec 2023 18:31:30 +0800
Subject: [PATCH 65/71] fix stopp removes cont error & remove inspect error log
Signed-off-by: jikai <jikai11@huawei.com>
---
.../cri_pod_sandbox_manager_service.cc | 36 ++++++++-----------
.../container_cb/execution_information.c | 2 +-
2 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
index bc40cb06..4d1d19eb 100644
--- a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
@@ -703,30 +703,22 @@ auto PodSandboxManagerService::GetRealSandboxIDToStop(const std::string &podSand
std::map<std::string, std::string> &stdAnnos, Errors &error)
-> int
{
- Errors statusErr;
+ auto status = PodSandboxStatus(podSandboxID, error);
+ if (error.NotEmpty()) {
+ return -1;
+ }
- auto status = PodSandboxStatus(podSandboxID, statusErr);
- if (statusErr.Empty()) {
- if (status->linux().namespaces().has_options()) {
- hostNetwork = (status->linux().namespaces().options().network() == runtime::v1alpha2::NamespaceMode::NODE);
- }
- // if metadata is invalid, don't return -1 and continue stopping pod
- if (status->has_metadata()) {
- name = status->metadata().name();
- ns = status->metadata().namespace_();
- }
- realSandboxID = status->id();
- CRIHelpers::ProtobufAnnoMapToStd(status->annotations(), stdAnnos);
- } else {
- if (CRIHelpers::IsContainerNotFoundError(statusErr.GetMessage())) {
- WARN("Both sandbox container and checkpoint for id %s could not be found. "
- "Proceed without further sandbox information.",
- podSandboxID.c_str());
- } else {
- error.Errorf("failed to get sandbox status: %s", statusErr.GetCMessage());
- return -1;
- }
+ if (status->linux().namespaces().has_options()) {
+ hostNetwork = (status->linux().namespaces().options().network() == runtime::v1alpha2::NamespaceMode::NODE);
}
+ // if metadata is invalid, don't return -1 and continue stopping pod
+ if (status->has_metadata()) {
+ name = status->metadata().name();
+ ns = status->metadata().namespace_();
+ }
+ realSandboxID = status->id();
+ CRIHelpers::ProtobufAnnoMapToStd(status->annotations(), stdAnnos);
+
if (realSandboxID.empty()) {
realSandboxID = podSandboxID;
}
diff --git a/src/daemon/executor/container_cb/execution_information.c b/src/daemon/executor/container_cb/execution_information.c
index 420f08df..03fce848 100644
--- a/src/daemon/executor/container_cb/execution_information.c
+++ b/src/daemon/executor/container_cb/execution_information.c
@@ -914,7 +914,7 @@ static int inspect_container_helper(const char *id, int timeout, char **containe
inspect = inspect_container(id, timeout, true);
if (inspect == NULL) {
- ERROR("Failed to inspect container:%s", id);
+ DEBUG("Failed to inspect container:%s", id);
ret = -1;
goto out;
}
--
2.25.1
|