Skip to content

Commit

Permalink
Pass vm object to the network setup
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed Jun 8, 2018
1 parent 6edf692 commit d3e11d0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/virt-launcher/virtwrap/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (l *LibvirtDomainManager) preStartHook(vm *v1.VirtualMachine, domain *api.D
}

// setup networking
err = network.SetupPodNetwork(domain)
err = network.SetupPodNetwork(vm, domain)
if err != nil {
return domain, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/virt-launcher/virtwrap/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@ func newVM(namespace string, name string) *v1.VirtualMachine {
}

func StubOutNetworkForTest() {
network.SetupPodNetwork = func(domain *api.Domain) error { return nil }
network.SetupPodNetwork = func(vm *v1.VirtualMachine, domain *api.Domain) error { return nil }
}
16 changes: 0 additions & 16 deletions pkg/virt-launcher/virtwrap/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ var _ = Describe("Network", func() {
mockNetworkInterface.EXPECT().Plug(iface, defaultNet, domain)
err := SetupNetworkInterfaces(vm, domain)
Expect(err).To(BeNil())
Expect(len(domain.Spec.Devices.Interfaces)).To(Equal(1))
})
It("should fail when no network is specified", func() {
domain := &api.Domain{}
Expand All @@ -74,18 +73,3 @@ var _ = Describe("Network", func() {
})
})
})

func NewDomainWithPodNetwork() *api.Domain {

domain := &api.Domain{}
domain.Spec.Devices.Interfaces = []api.Interface{{
Model: &api.Model{
Type: "virtio",
},
Type: "bridge",
Source: api.InterfaceSource{
Bridge: api.DefaultBridgeName,
}},
}
return domain
}

0 comments on commit d3e11d0

Please sign in to comment.