Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
isula-build
提交
f553d725
I
isula-build
项目概览
openeuler
/
isula-build
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
isula-build
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f553d725
编写于
8月 03, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
8月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
!17 load: print log info in client
Merge pull request !17 from holyfei/master
上级
62b3f2d4
8497dc8e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
246 addition
and
145 deletion
+246
-145
api/services/control.pb.go
api/services/control.pb.go
+134
-96
api/services/control.proto
api/services/control.proto
+3
-3
cmd/cli/build_test.go
cmd/cli/build_test.go
+5
-0
cmd/cli/grpc_client_test.go
cmd/cli/grpc_client_test.go
+13
-2
cmd/cli/load.go
cmd/cli/load.go
+39
-22
cmd/cli/load_test.go
cmd/cli/load_test.go
+3
-3
daemon/load.go
daemon/load.go
+49
-19
未找到文件。
api/services/control.pb.go
浏览文件 @
f553d725
...
...
@@ -6,12 +6,13 @@ package isula_build_v1
import
(
context
"context"
fmt
"fmt"
math
"math"
proto
"github.com/gogo/protobuf/proto"
types
"github.com/gogo/protobuf/types"
grpc
"google.golang.org/grpc"
codes
"google.golang.org/grpc/codes"
status
"google.golang.org/grpc/status"
math
"math"
)
// Reference imports to suppress errors if they are not otherwise used.
...
...
@@ -1073,7 +1074,9 @@ func (m *LoadRequest) GetPath() string {
type
LoadResponse
struct
{
// imageID is the ID of loaded image
ImageID
string
`protobuf:"bytes,1,opt,name=imageID,proto3" json:"imageID,omitempty"`
ImageID
string
`protobuf:"bytes,1,opt,name=imageID,proto3" json:"imageID,omitempty"`
// log is the log sent to client
Log
string
`protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -1110,6 +1113,13 @@ func (m *LoadResponse) GetImageID() string {
return
""
}
func
(
m
*
LoadResponse
)
GetLog
()
string
{
if
m
!=
nil
{
return
m
.
Log
}
return
""
}
func
init
()
{
proto
.
RegisterEnum
(
"isula.build.v1.HealthCheckResponse_ServingStatus"
,
HealthCheckResponse_ServingStatus_name
,
HealthCheckResponse_ServingStatus_value
)
proto
.
RegisterType
((
*
BuildRequest
)(
nil
),
"isula.build.v1.BuildRequest"
)
...
...
@@ -1138,72 +1148,73 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"api/services/control.proto"
,
fileDescriptor_d71ef680555cb937
)
}
var
fileDescriptor_d71ef680555cb937
=
[]
byte
{
// 1034 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x8c
,
0x56
,
0x6d
,
0x6f
,
0xdc
,
0x44
,
0x10
,
0xc6
,
0xb9
,
0xc4
,
0x49
,
0xc6
,
0xb9
,
0x6b
,
0xb4
,
0x54
,
0x91
,
0xe5
,
0x84
,
0xf6
,
0x30
,
0x08
,
0x1d
,
0x20
,
0x39
,
0x6d
,
0xe0
,
0x03
,
0x45
,
0x2a
,
0x52
,
0x5e
,
0x4a
,
0x38
,
0x1a
,
0xae
,
0xc2
,
0x39
,
0xca
,
0x47
,
0xb4
,
0xb9
,
0xdb
,
0x38
,
0xab
,
0xda
,
0x5e
,
0xb3
,
0xbb
,
0x0e
,
0x3d
,
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x11
,
0x66
,
0xff
,
0xbf
,
0x36
,
0x13
,
0x3a
,
0x86
,
0x8d
,
0x72
,
0x92
,
0x77
,
0x3b
,
0x6f
,
0xc0
,
0x4b
,
0xf5
,
0x27
,
0xe1
,
0x3d
,
0x5e
,
0x0e
,
0xb0
,
0xbc
,
0x3a
,
0x26
,
0x60
,
0x17
,
0xb3
,
0xd5
,
0xcd
,
0xa8
,
0x35
,
0xc6
,
0xdd
,
0x8c
,
0xda
,
0x23
,
0xf9
,
0xc4
,
0x42
,
0xdf
,
0x81
,
0xd3
,
0x18
,
0x9d
,
0x3b
,
0x21
,
0x7d
,
0xf4
,
0x1e
,
0xf3
,
0x86
,
0x4e
,
0x61
,
0x5d
,
0x73
,
0xb5
,
0xdb
,
0xb0
,
0xe6
,
0xd0
,
0x74
,
0x1b
,
0xd6
,
0x26
,
0xf8
,
0x19
,
0xd8
,
0x05
,
0x17
,
0xd1
,
0x2a
,
0xc7
,
0x9a
,
0xde
,
0xdd
,
0xe4
,
0x96
,
0x28
,
0x7c
,
0x02
,
0x7d
,
0xc5
,
0xc3
,
0x15
,
0xcd
,
0xaa
,
0x09
,
0xbc
,
0xa2
,
0x59
,
0x0d
,
0xea
,
0x16
,
0xe4
,
0x29
,
0x5e
,
0xfd
,
0x2e
,
0x9a
,
0xd6
,
0x0f
,
0x45
,
0x17
,
0x4d
,
0xfb
,
0x67
,
0x61
,
0x6c
,
0xa1
,
0x67
,
0xfa
,
0x51
,
0x41
,
0xde
,
0xb2
,
0x63
,
0xfd
,
0x3a
,
0x7a
,
0x77
,
0x94
,
0xff
,
0xca
,
0xd6
,
0xf2
,
0x17
,
0xff
,
0x06
,
0x00
,
0x00
,
0xff
,
0xff
,
0x91
,
0x70
,
0xf4
,
0x02
,
0xa7
,
0x0a
,
0x00
,
0x00
,
}
// Reference imports to suppress errors if they are not otherwise used.
...
...
@@ -1235,7 +1246,7 @@ type ControlClient interface {
// Logout requests to logout registry and delete any credentials
Logout
(
ctx
context
.
Context
,
in
*
LogoutRequest
,
opts
...
grpc
.
CallOption
)
(
*
LogoutResponse
,
error
)
// Load requests an image tar load
Load
(
ctx
context
.
Context
,
in
*
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
*
LoadResponse
,
error
)
Load
(
ctx
context
.
Context
,
in
*
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
Control_LoadClient
,
error
)
// Import requests import a new image
Import
(
ctx
context
.
Context
,
opts
...
grpc
.
CallOption
)
(
Control_ImportClient
,
error
)
// Tag requests to tag an image
...
...
@@ -1391,17 +1402,40 @@ func (c *controlClient) Logout(ctx context.Context, in *LogoutRequest, opts ...g
return
out
,
nil
}
func
(
c
*
controlClient
)
Load
(
ctx
context
.
Context
,
in
*
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
*
LoadResponse
,
error
)
{
out
:=
new
(
LoadResponse
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
"/isula.build.v1.Control/Load"
,
in
,
out
,
opts
...
)
func
(
c
*
controlClient
)
Load
(
ctx
context
.
Context
,
in
*
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
Control_LoadClient
,
error
)
{
stream
,
err
:=
c
.
cc
.
NewStream
(
ctx
,
&
_Control_serviceDesc
.
Streams
[
3
],
"/isula.build.v1.Control/Load"
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
x
:=
&
controlLoadClient
{
stream
}
if
err
:=
x
.
ClientStream
.
SendMsg
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
err
:=
x
.
ClientStream
.
CloseSend
();
err
!=
nil
{
return
nil
,
err
}
return
x
,
nil
}
type
Control_LoadClient
interface
{
Recv
()
(
*
LoadResponse
,
error
)
grpc
.
ClientStream
}
type
controlLoadClient
struct
{
grpc
.
ClientStream
}
func
(
x
*
controlLoadClient
)
Recv
()
(
*
LoadResponse
,
error
)
{
m
:=
new
(
LoadResponse
)
if
err
:=
x
.
ClientStream
.
RecvMsg
(
m
);
err
!=
nil
{
return
nil
,
err
}
return
m
,
nil
}
func
(
c
*
controlClient
)
Import
(
ctx
context
.
Context
,
opts
...
grpc
.
CallOption
)
(
Control_ImportClient
,
error
)
{
stream
,
err
:=
c
.
cc
.
NewStream
(
ctx
,
&
_Control_serviceDesc
.
Streams
[
3
],
"/isula.build.v1.Control/Import"
,
opts
...
)
stream
,
err
:=
c
.
cc
.
NewStream
(
ctx
,
&
_Control_serviceDesc
.
Streams
[
4
],
"/isula.build.v1.Control/Import"
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -1462,7 +1496,7 @@ type ControlServer interface {
// Logout requests to logout registry and delete any credentials
Logout
(
context
.
Context
,
*
LogoutRequest
)
(
*
LogoutResponse
,
error
)
// Load requests an image tar load
Load
(
context
.
Context
,
*
LoadRequest
)
(
*
LoadResponse
,
error
)
Load
(
*
LoadRequest
,
Control_LoadServer
)
error
// Import requests import a new image
Import
(
Control_ImportServer
)
error
// Tag requests to tag an image
...
...
@@ -1497,8 +1531,8 @@ func (*UnimplementedControlServer) Login(ctx context.Context, req *LoginRequest)
func
(
*
UnimplementedControlServer
)
Logout
(
ctx
context
.
Context
,
req
*
LogoutRequest
)
(
*
LogoutResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Logout not implemented"
)
}
func
(
*
UnimplementedControlServer
)
Load
(
ctx
context
.
Context
,
req
*
LoadRequest
)
(
*
LoadResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Load not implemented"
)
func
(
*
UnimplementedControlServer
)
Load
(
req
*
LoadRequest
,
srv
Control_LoadServer
)
error
{
return
status
.
Errorf
(
codes
.
Unimplemented
,
"method Load not implemented"
)
}
func
(
*
UnimplementedControlServer
)
Import
(
srv
Control_ImportServer
)
error
{
return
status
.
Errorf
(
codes
.
Unimplemented
,
"method Import not implemented"
)
...
...
@@ -1664,22 +1698,25 @@ func _Control_Logout_Handler(srv interface{}, ctx context.Context, dec func(inte
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Control_Load_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
LoadRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
ControlServer
)
.
Load
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/isula.build.v1.Control/Load"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
ControlServer
)
.
Load
(
ctx
,
req
.
(
*
LoadRequest
))
func
_Control_Load_Handler
(
srv
interface
{},
stream
grpc
.
ServerStream
)
error
{
m
:=
new
(
LoadRequest
)
if
err
:=
stream
.
RecvMsg
(
m
);
err
!=
nil
{
return
err
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
return
srv
.
(
ControlServer
)
.
Load
(
m
,
&
controlLoadServer
{
stream
})
}
type
Control_LoadServer
interface
{
Send
(
*
LoadResponse
)
error
grpc
.
ServerStream
}
type
controlLoadServer
struct
{
grpc
.
ServerStream
}
func
(
x
*
controlLoadServer
)
Send
(
m
*
LoadResponse
)
error
{
return
x
.
ServerStream
.
SendMsg
(
m
)
}
func
_Control_Import_Handler
(
srv
interface
{},
stream
grpc
.
ServerStream
)
error
{
...
...
@@ -1750,10 +1787,6 @@ var _Control_serviceDesc = grpc.ServiceDesc{
MethodName
:
"Logout"
,
Handler
:
_Control_Logout_Handler
,
},
{
MethodName
:
"Load"
,
Handler
:
_Control_Load_Handler
,
},
{
MethodName
:
"tag"
,
Handler
:
_Control_Tag_Handler
,
...
...
@@ -1775,6 +1808,11 @@ var _Control_serviceDesc = grpc.ServiceDesc{
Handler
:
_Control_Remove_Handler
,
ServerStreams
:
true
,
},
{
StreamName
:
"Load"
,
Handler
:
_Control_Load_Handler
,
ServerStreams
:
true
,
},
{
StreamName
:
"Import"
,
Handler
:
_Control_Import_Handler
,
...
...
api/services/control.proto
浏览文件 @
f553d725
...
...
@@ -35,7 +35,7 @@ service Control {
// Logout requests to logout registry and delete any credentials
rpc
Logout
(
LogoutRequest
)
returns
(
LogoutResponse
);
// Load requests an image tar load
rpc
Load
(
LoadRequest
)
returns
(
LoadResponse
);
rpc
Load
(
LoadRequest
)
returns
(
stream
LoadResponse
);
// Import requests import a new image
rpc
Import
(
stream
ImportRequest
)
returns
(
ImportResponse
);
// Tag requests to tag an image
...
...
@@ -196,6 +196,6 @@ message LoadRequest {
}
message
LoadResponse
{
//
imageID is the ID of loaded image
string
imageID
=
1
;
//
log is the log sent to client
string
log
=
1
;
}
cmd/cli/build_test.go
浏览文件 @
f553d725
...
...
@@ -68,6 +68,11 @@ func (f *mockDaemon) importImage(_ context.Context, opts ...grpc.CallOption) (pb
return
&
mockImportClient
{},
nil
}
func
(
f
*
mockDaemon
)
load
(
_
context
.
Context
,
in
*
pb
.
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
pb
.
Control_LoadClient
,
error
)
{
f
.
loadReq
=
in
return
&
mockLoadClient
{},
nil
}
func
(
f
*
mockDaemon
)
build
(
_
context
.
Context
,
in
*
pb
.
BuildRequest
,
opts
...
grpc
.
CallOption
)
(
pb
.
Control_BuildClient
,
error
)
{
f
.
buildReq
=
in
return
&
mockBuildClient
{},
nil
...
...
cmd/cli/grpc_client_test.go
浏览文件 @
f553d725
...
...
@@ -39,7 +39,7 @@ type mockGrpcClient struct {
healthCheckFunc
func
(
ctx
context
.
Context
,
in
*
types
.
Empty
,
opts
...
grpc
.
CallOption
)
(
*
pb
.
HealthCheckResponse
,
error
)
loginFunc
func
(
ctx
context
.
Context
,
in
*
pb
.
LoginRequest
,
opts
...
grpc
.
CallOption
)
(
*
pb
.
LoginResponse
,
error
)
logoutFunc
func
(
ctx
context
.
Context
,
in
*
pb
.
LogoutRequest
,
opts
...
grpc
.
CallOption
)
(
*
pb
.
LogoutResponse
,
error
)
loadFunc
func
(
ctx
context
.
Context
,
in
*
pb
.
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
*
pb
.
LoadResponse
,
error
)
loadFunc
func
(
ctx
context
.
Context
,
in
*
pb
.
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
pb
.
Control_LoadClient
,
error
)
importFunc
func
(
ctx
context
.
Context
,
opts
...
grpc
.
CallOption
)
(
pb
.
Control_ImportClient
,
error
)
}
...
...
@@ -118,7 +118,7 @@ func (gcli *mockGrpcClient) Logout(ctx context.Context, in *pb.LogoutRequest, op
return
&
pb
.
LogoutResponse
{
Result
:
"Success Logout"
},
nil
}
func
(
gcli
*
mockGrpcClient
)
Load
(
ctx
context
.
Context
,
in
*
pb
.
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
*
pb
.
LoadResponse
,
error
)
{
func
(
gcli
*
mockGrpcClient
)
Load
(
ctx
context
.
Context
,
in
*
pb
.
LoadRequest
,
opts
...
grpc
.
CallOption
)
(
pb
.
Control_LoadClient
,
error
)
{
if
gcli
.
loadFunc
!=
nil
{
return
gcli
.
loadFunc
(
ctx
,
in
,
opts
...
)
}
...
...
@@ -142,6 +142,10 @@ type mockRemoveClient struct {
grpc
.
ClientStream
}
type
mockLoadClient
struct
{
grpc
.
ClientStream
}
func
(
bcli
*
mockBuildClient
)
Recv
()
(
*
pb
.
BuildResponse
,
error
)
{
resp
:=
&
pb
.
BuildResponse
{
ImageID
:
imageID
,
...
...
@@ -178,6 +182,13 @@ func (rcli *mockRemoveClient) Recv() (*pb.RemoveResponse, error) {
return
resp
,
io
.
EOF
}
func
(
lcli
*
mockLoadClient
)
Recv
()
(
*
pb
.
LoadResponse
,
error
)
{
resp
:=
&
pb
.
LoadResponse
{
Log
:
"Getting image source signatures"
,
}
return
resp
,
io
.
EOF
}
func
TestGetStartTimeout
(
t
*
testing
.
T
)
{
type
args
struct
{
timeout
string
...
...
cmd/cli/load.go
浏览文件 @
f553d725
...
...
@@ -18,6 +18,7 @@ package main
import
(
"context"
"fmt"
"io"
"os"
"path/filepath"
...
...
@@ -44,6 +45,7 @@ func NewLoadCmd() *cobra.Command {
Use
:
"load"
,
Short
:
"Load images"
,
Example
:
loadExample
,
Args
:
util
.
NoArgs
,
RunE
:
loadCommand
,
}
...
...
@@ -59,28 +61,13 @@ func loadCommand(cmd *cobra.Command, args []string) error {
return
err
}
return
runLoad
(
ctx
,
cli
,
args
)
return
runLoad
(
ctx
,
cli
)
}
func
runLoad
(
ctx
context
.
Context
,
cli
Cli
,
args
[]
string
)
error
{
if
len
(
args
)
>
0
{
return
errors
.
New
(
"load accepts no arguments"
)
}
// check input
if
len
(
loadOpts
.
path
)
==
0
{
return
errors
.
New
(
"tarball path should not be empty"
)
}
if
!
filepath
.
IsAbs
(
loadOpts
.
path
)
{
pwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
return
errors
.
New
(
"get current path failed"
)
}
loadOpts
.
path
=
util
.
MakeAbsolute
(
loadOpts
.
path
,
pwd
)
}
func
runLoad
(
ctx
context
.
Context
,
cli
Cli
)
error
{
var
err
error
if
err
:=
util
.
CheckLoadFile
(
loadOpts
.
path
);
err
!=
nil
{
if
loadOpts
.
path
,
err
=
resolveLoadPath
(
loadOpts
.
path
);
err
!=
nil
{
return
err
}
...
...
@@ -91,9 +78,39 @@ func runLoad(ctx context.Context, cli Cli, args []string) error {
return
err
}
if
resp
!=
nil
{
fmt
.
Printf
(
"Imported image as %v
\n
"
,
resp
.
ImageID
)
for
{
msg
,
rerr
:=
resp
.
Recv
()
if
msg
!=
nil
{
fmt
.
Print
(
msg
.
Log
)
}
if
rerr
!=
nil
{
if
rerr
!=
io
.
EOF
{
err
=
rerr
}
break
}
}
return
err
}
func
resolveLoadPath
(
path
string
)
(
string
,
error
)
{
// check input
if
path
==
""
{
return
""
,
errors
.
New
(
"tarball path should not be empty"
)
}
if
!
filepath
.
IsAbs
(
path
)
{
pwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
return
""
,
errors
.
Wrap
(
err
,
"get current path failed while loading image"
)
}
path
=
util
.
MakeAbsolute
(
path
,
pwd
)
}
if
err
:=
util
.
CheckLoadFile
(
path
);
err
!=
nil
{
return
""
,
err
}
return
nil
return
path
,
nil
}
cmd/cli/load_test.go
浏览文件 @
f553d725
...
...
@@ -25,9 +25,9 @@ import (
)
func
TestRunLoad
(
t
*
testing
.
T
)
{
args
:=
make
([]
string
,
0
,
0
)
ctx
:=
context
.
Background
()
cli
:=
newMockClient
(
&
mockGrpcClient
{})
mockDaemon
:=
newMockDaemon
()
cli
:=
newMockClient
(
&
mockGrpcClient
{
loadFunc
:
mockDaemon
.
load
})
fileEmpty
:=
"empty.tar"
fileNormal
:=
"test.tar"
...
...
@@ -67,7 +67,7 @@ func TestRunLoad(t *testing.T) {
for
_
,
tc
:=
range
testcases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
loadOpts
.
path
=
tc
.
path
err
:=
runLoad
(
ctx
,
&
cli
,
args
)
err
:=
runLoad
(
ctx
,
&
cli
)
assert
.
Equal
(
t
,
err
!=
nil
,
tc
.
isErr
,
"Failed at [%s], err: %v"
,
tc
.
name
,
err
)
if
err
!=
nil
{
assert
.
ErrorContains
(
t
,
err
,
tc
.
errString
)
...
...
daemon/load.go
浏览文件 @
f553d725
...
...
@@ -16,11 +16,13 @@
package
daemon
import
(
"
context
"
"
path/filepath
"
"github.com/containers/image/v5/docker/tarfile"
"github.com/containers/storage"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
constant
"isula.org/isula-build"
pb
"isula.org/isula-build/api/services"
...
...
@@ -30,37 +32,65 @@ import (
)
// Load loads the image
func
(
b
*
Backend
)
Load
(
ctx
context
.
Context
,
req
*
pb
.
LoadRequest
)
(
*
pb
.
LoadResponse
,
error
)
{
func
(
b
*
Backend
)
Load
(
req
*
pb
.
LoadRequest
,
stream
pb
.
Control_LoadServer
)
error
{
var
si
*
storage
.
Image
logrus
.
Info
(
"LoadRequest received"
)
if
err
:=
util
.
CheckLoadFile
(
req
.
Path
);
err
!=
nil
{
return
&
pb
.
LoadResponse
{},
err
return
err
}
tarfileSource
,
err
:=
tarfile
.
NewSourceFromFile
(
req
.
Path
)
// tmp dir will be removed after NewSourceFromFileWithContext
tmpDir
:=
filepath
.
Join
(
b
.
daemon
.
opts
.
DataRoot
,
"tmp"
)
systemContext
:=
image
.
GetSystemContext
()
systemContext
.
BigFilesTemporaryDir
=
tmpDir
tarfileSource
,
err
:=
tarfile
.
NewSourceFromFileWithContext
(
systemContext
,
req
.
Path
)
if
err
!=
nil
{
return
&
pb
.
LoadResponse
{},
errors
.
Wrapf
(
err
,
"failed to get the source of loading tar file"
)
return
errors
.
Wrapf
(
err
,
"failed to get the source of loading tar file"
)
}
topLevelImageManifest
,
err
:=
tarfileSource
.
LoadTarManifest
()
if
err
!=
nil
||
len
(
topLevelImageManifest
)
==
0
{
return
&
pb
.
LoadResponse
{},
errors
.
Wrapf
(
err
,
"failed to get the top level image manifest"
)
return
errors
.
Wrapf
(
err
,
"failed to get the top level image manifest"
)
}
_
,
si
,
err
:=
image
.
ResolveFromImage
(
&
image
.
PrepareImageOptions
{
Ctx
:
ctx
,
FromImage
:
"docker-archive:"
+
req
.
Path
,
SystemContext
:
image
.
GetSystemContext
(),
Store
:
b
.
daemon
.
localStore
,
Reporter
:
logger
.
NewCliLogger
(
constant
.
CliLogBufferLen
),
log
:=
logger
.
NewCliLogger
(
constant
.
CliLogBufferLen
)
eg
,
ctx
:=
errgroup
.
WithContext
(
stream
.
Context
())
eg
.
Go
(
func
()
error
{
for
c
:=
range
log
.
GetContent
()
{
if
serr
:=
stream
.
Send
(
&
pb
.
LoadResponse
{
Log
:
c
,
});
serr
!=
nil
{
return
serr
}
}
return
nil
})
eg
.
Go
(
func
()
error
{
defer
log
.
CloseContent
()
_
,
si
,
err
=
image
.
ResolveFromImage
(
&
image
.
PrepareImageOptions
{
Ctx
:
ctx
,
FromImage
:
"docker-archive:"
+
req
.
Path
,
SystemContext
:
image
.
GetSystemContext
(),
Store
:
b
.
daemon
.
localStore
,
Reporter
:
log
,
})
if
err
!=
nil
{
return
err
}
if
serr
:=
b
.
daemon
.
localStore
.
SetNames
(
si
.
ID
,
topLevelImageManifest
[
0
]
.
RepoTags
);
serr
!=
nil
{
return
serr
}
log
.
Print
(
"Loaded image as %s
\n
"
,
si
.
ID
)
return
nil
})
if
err
!=
nil
{
return
nil
,
err
}
if
err
:=
b
.
daemon
.
localStore
.
SetNames
(
si
.
ID
,
topLevelImageManifest
[
0
]
.
RepoTags
);
err
!=
nil
{
return
nil
,
err
if
werr
:=
eg
.
Wait
();
w
err
!=
nil
{
return
w
err
}
logrus
.
Infof
(
"Loaded image as %
v
"
,
si
.
ID
)
return
&
pb
.
LoadResponse
{
ImageID
:
si
.
ID
},
nil
logrus
.
Infof
(
"Loaded image as %
s
"
,
si
.
ID
)
return
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录