Skip to content

Commit

Permalink
container/kvm: use correct parent network device
Browse files Browse the repository at this point in the history
When rendering the kvm-template.xml configuration the same parent device
was being used for all interfaces. This is incorrect now that we are
using spaces and is fixed by selecting `ParentInterfaceName' from the
modelled network.

Fixes [LP:#1563853](https://bugs.launchpad.net/juju-core/+bug/1563853)
  • Loading branch information
Andrew McDermott committed Mar 30, 2016
1 parent 49395e5 commit a084e42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions container/kvm/kvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ func (s *KVMSuite) TestWriteTemplate(c *gc.C) {
Hostname: "foo-bar",
NetworkBridge: "br0",
Interfaces: []network.InterfaceInfo{
{MACAddress: "00:16:3e:20:b0:11"},
{
MACAddress: "00:16:3e:20:b0:11",
ParentInterfaceName: "br-eth0.10",
},
},
}
tempDir := c.MkDir()
Expand All @@ -122,7 +125,7 @@ func (s *KVMSuite) TestWriteTemplate(c *gc.C) {

c.Assert(template, jc.Contains, "<name>foo-bar</name>")
c.Assert(template, jc.Contains, "<mac address='00:16:3e:20:b0:11'/>")
c.Assert(template, jc.Contains, "<source bridge='br0'/>")
c.Assert(template, jc.Contains, "<source bridge='br-eth0.10'/>")
c.Assert(strings.Count(string(template), "<interface type='bridge'>"), gc.Equals, 1)
}

Expand Down
2 changes: 1 addition & 1 deletion container/kvm/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var kvmTemplate = `
<interface type='bridge'>
<mac address='{{$nic.MACAddress}}'/>
<model type='virtio'/>
<source bridge='{{$bridge}}'/>
<source bridge='{{$nic.ParentInterfaceName}}'/>
</interface>
{{end}}
</devices>
Expand Down

0 comments on commit a084e42

Please sign in to comment.