blob: 13df472fa2eb3c3671d9f526774f2f6ad72d8957 (
plain)
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
|
From 1d51e3e9f14199854cc2d586651c5809345aee18 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Wed, 8 May 2024 14:48:47 +0800
Subject: [PATCH 82/85] fix shim controller set incorrect sandbox status state
Signed-off-by: jikai <jikai11@huawei.com>
---
src/daemon/sandbox/controller/controller.h | 3 +++
src/daemon/sandbox/controller/shim/shim_controller.cc | 6 ++++--
src/daemon/sandbox/sandbox.cc | 3 ---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/daemon/sandbox/controller/controller.h b/src/daemon/sandbox/controller/controller.h
index f479a0ac..9ad45855 100644
--- a/src/daemon/sandbox/controller/controller.h
+++ b/src/daemon/sandbox/controller/controller.h
@@ -27,6 +27,9 @@
namespace sandbox {
+#define SANDBOX_READY_STATE_STR "SANDBOX_READY"
+#define SANDBOX_NOTREADY_STATE_STR "SANDBOX_NOTREADY"
+
struct ControllerMountInfo {
std::string source;
std::string destination;
diff --git a/src/daemon/sandbox/controller/shim/shim_controller.cc b/src/daemon/sandbox/controller/shim/shim_controller.cc
index 4da637c7..ce09c076 100644
--- a/src/daemon/sandbox/controller/shim/shim_controller.cc
+++ b/src/daemon/sandbox/controller/shim/shim_controller.cc
@@ -446,8 +446,10 @@ void ShimController::InspectResponseToSandboxStatus(container_inspect *inspect,
sandboxStatus.id = inspect->id;
if (inspect->state != nullptr) {
sandboxStatus.pid = inspect->state->pid;
- if (inspect->state->status != nullptr) {
- sandboxStatus.state = std::string(inspect->state->status);
+ if (inspect->state->running) {
+ sandboxStatus.state = std::string(SANDBOX_READY_STATE_STR);
+ } else {
+ sandboxStatus.state = std::string(SANDBOX_NOTREADY_STATE_STR);
}
}
diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
index 279bf628..d44abb99 100644
--- a/src/daemon/sandbox/sandbox.cc
+++ b/src/daemon/sandbox/sandbox.cc
@@ -39,9 +39,6 @@
#include "utils_timestamp.h"
#include "mailbox.h"
-#define SANDBOX_READY_STATE_STR "SANDBOX_READY"
-#define SANDBOX_NOTREADY_STATE_STR "SANDBOX_NOTREADY"
-
namespace sandbox {
const std::string SHM_MOUNT_POINT = "/dev/shm";
--
2.34.1
|