Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 52648a4

Browse files
authored
Merge pull request #410 from xlgao-zju/change-response-code
change response code to -2, when we can not find the Pod
2 parents aec3085 + a825263 commit 52648a4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

daemon/rm.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,27 @@ import (
1111
"github.com/hyperhq/runv/hypervisor/types"
1212
)
1313

14+
const (
15+
E_NOT_FOUND = -2
16+
E_UNDER_OPERATION = -1
17+
E_OK = 0
18+
)
19+
1420
func (daemon *Daemon) CleanPod(podId string) (int, string, error) {
1521
var (
16-
code = 0
22+
code = E_OK
1723
cause = ""
1824
err error
1925
)
2026

2127
pod, ok := daemon.PodList.Get(podId)
2228
if !ok {
23-
return -1, "", fmt.Errorf("Can not find that Pod(%s)", podId)
29+
return E_NOT_FOUND, "", fmt.Errorf("Can not find that Pod(%s)", podId)
2430
}
2531

2632
if !pod.TransitionLock("rm") {
2733
glog.Errorf("Pod %s is under other operation", podId)
28-
return -1, "", fmt.Errorf("Pod %s is under other operation", podId)
34+
return E_UNDER_OPERATION, "", fmt.Errorf("Pod %s is under other operation", podId)
2935
}
3036
defer pod.TransitionUnlock("rm")
3137

0 commit comments

Comments
 (0)