Пример #1
0
func (s *configSuite) TestDefaultNetworkBridgeForLXCContainers(c *gc.C) {
	testConfig := localConfig(c, map[string]interface{}{
		"container": "lxc",
	})
	containerType, bridgeName := local.ContainerAndBridge(c, testConfig)
	c.Check(containerType, gc.Equals, string(instance.LXC))
	c.Check(bridgeName, gc.Equals, lxc.DefaultLxcBridge)
}
Пример #2
0
func (s *configSuite) TestDefaultNetworkBridgeForKVMContainers(c *gc.C) {
	testConfig := localConfig(c, map[string]interface{}{
		"container": "kvm",
	})
	containerType, bridgeName := local.ContainerAndBridge(c, testConfig)
	c.Check(containerType, gc.Equals, string(instance.KVM))
	c.Check(bridgeName, gc.Equals, kvm.DefaultKvmBridge)
}
Пример #3
0
func (s *configSuite) TestSetNetworkBridge(c *gc.C) {
	config := localConfig(c, map[string]interface{}{
		"network-bridge": "br0",
	})
	unknownAttrs := config.UnknownAttrs()
	c.Assert(unknownAttrs["network-bridge"], gc.Equals, "br0")
	_, bridgeName := local.ContainerAndBridge(c, config)
	c.Check(bridgeName, gc.Equals, "br0")
}
Пример #4
0
func (s *configSuite) TestExplicitNetworkBridgeForKVMContainers(c *gc.C) {
	testConfig := localConfig(c, map[string]interface{}{
		"container":      "kvm",
		"network-bridge": "lxcbr0",
	})
	containerType, bridgeName := local.ContainerAndBridge(c, testConfig)
	c.Check(containerType, gc.Equals, string(instance.KVM))
	c.Check(bridgeName, gc.Equals, "lxcbr0")
}