diff --git a/engine/virt/image.go b/engine/virt/image.go index 4baaf25b1..ab79b8073 100644 --- a/engine/virt/image.go +++ b/engine/virt/image.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "io" + "strings" virttypes "github.com/projecteru2/libyavirt/types" @@ -50,7 +51,21 @@ func (v *Virt) ImagesPrune(ctx context.Context) (err error) { // ImagePull pulls an image to local virt-node. func (v *Virt) ImagePull(ctx context.Context, ref string, all bool) (rc io.ReadCloser, err error) { - return + // ref is a simple image name without username for now + _, imgName, err := splitUserImage(ref) + if err != nil { + return nil, err + } + + msg, err := v.client.PullImage(ctx, imgName, all) + if err != nil { + return nil, err + } + + rc = io.NopCloser(strings.NewReader(msg)) + defer rc.Close() + + return rc, err } // ImagePush pushes to central image registry. diff --git a/go.mod b/go.mod index 9677278a1..c5034de1a 100644 --- a/go.mod +++ b/go.mod @@ -52,3 +52,7 @@ require ( google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) + +replace ( + github.com/projecteru2/libyavirt => github.com/aceralon/libyavirt v0.0.0-20211214081924-914bb8e63e63 +) diff --git a/go.sum b/go.sum index 98b21ebe4..754e99252 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,10 @@ github.com/Microsoft/hcsshim v0.8.11 h1:qs8+XI1mFA1H/zhXT9qVG/lcJO18p1yCsICIrCjV github.com/Microsoft/hcsshim v0.8.11/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/aceralon/libyavirt v0.0.0-20211213100554-b2a6833f0bca h1:BqZvJm7xfsaN4avybNioNbjivAyTXa51/57Ld+W9xW8= +github.com/aceralon/libyavirt v0.0.0-20211213100554-b2a6833f0bca/go.mod h1:FOc+hWBMLsMrmx5p3/moizKeSomedZPNwB6LhS+kEnE= +github.com/aceralon/libyavirt v0.0.0-20211214081924-914bb8e63e63 h1:P6qlWoAZSszKRb5WElhtSda4r4jXoj3NmD+HSc+s6gg= +github.com/aceralon/libyavirt v0.0.0-20211214081924-914bb8e63e63/go.mod h1:FOc+hWBMLsMrmx5p3/moizKeSomedZPNwB6LhS+kEnE= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=