Skip to content

Commit

Permalink
Merge pull request #47 from voidspace/maas2-create-device-vlan
Browse files Browse the repository at this point in the history
Use the correct VLAN in machine.CreateDevice

machine.CreateDevice was using the wrong VLAN in the update call.
  • Loading branch information
jujubot committed Apr 27, 2016
2 parents 9ec917c + 1db7b18 commit 794d847
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (m *machine) CreateDevice(args CreateMachineDeviceArgs) (_ Device, err erro
updateArgs.Name = args.InterfaceName
}
if iface.VLAN().ID() != args.Subnet.VLAN().ID() {
updateArgs.VLAN = iface.VLAN()
updateArgs.VLAN = args.Subnet.VLAN()
}
err = iface.Update(updateArgs)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ func (s *machineSuite) TestCreateDevice(c *gc.C) {
})
c.Assert(err, jc.ErrorIsNil)
c.Assert(device.InterfaceSet()[0].Name(), gc.Equals, "eth4")
c.Assert(device.InterfaceSet()[0].VLAN().ID(), gc.Equals, subnet.VLAN().ID())
}

func (s *machineSuite) TestCreateDeviceTriesToDeleteDeviceOnError(c *gc.C) {
Expand Down

0 comments on commit 794d847

Please sign in to comment.