Skip to content

Commit

Permalink
feat: connect guest to a specific extra network. (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
anrs authored Aug 21, 2020
1 parent 333f861 commit 7768da2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 14 additions & 2 deletions engine/virt/virt.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,20 @@ func (v *Virt) ExecResize(ctx context.Context, execID string, height, width uint
}

// NetworkConnect connects to a network.
func (v *Virt) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) (subnet []string, err error) {
log.Warnf("NetworkConnect does not implement")
func (v *Virt) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) (cidrs []string, err error) {
req := virttypes.ConnectNetworkReq{
Network: network,
IPv4: ipv4,
}
req.ID = target

var cidr string
if cidr, err = v.client.ConnectNetwork(ctx, req); err != nil {
return
}

cidrs = append(cidrs, cidr)

return
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/opencontainers/runc v0.1.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c
github.com/projecteru2/libyavirt v0.0.0-20200821065010-ea41aa314ef3
github.com/prometheus/client_golang v1.7.1
github.com/sanity-io/litter v1.3.0
github.com/sirupsen/logrus v1.6.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c h1:I9i6hagi+VJ3sSJsSULYkml3xhJp8HRV9qdBml9NW14=
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c/go.mod h1:9/SNmdphwl12ubwihkRa9YtOozM6liYLDxsricra1mY=
github.com/projecteru2/libyavirt v0.0.0-20200821023248-f3b5f25499a6 h1:0khPPFC/mDwa4bLRCJp+m+EzzigK/sHV/nQ1eqn1FJU=
github.com/projecteru2/libyavirt v0.0.0-20200821023248-f3b5f25499a6/go.mod h1:9/SNmdphwl12ubwihkRa9YtOozM6liYLDxsricra1mY=
github.com/projecteru2/libyavirt v0.0.0-20200821065010-ea41aa314ef3 h1:P8K+3LbU4cf3DXsLL+6/RavsJ9GWUVv3W36gi/Yv9dY=
github.com/projecteru2/libyavirt v0.0.0-20200821065010-ea41aa314ef3/go.mod h1:9/SNmdphwl12ubwihkRa9YtOozM6liYLDxsricra1mY=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
Expand Down

0 comments on commit 7768da2

Please sign in to comment.