// NewContainerManager creates the appropriate container.Manager for the // specified container type. func NewContainerManager(forType instance.ContainerType, conf container.ManagerConfig) (container.Manager, error) { switch forType { case instance.LXC: return lxc.NewContainerManager(conf) case instance.KVM: return kvm.NewContainerManager(conf) } return nil, fmt.Errorf("unknown container type: %q", forType) }
func NewLxcBroker(api APICalls, tools *tools.Tools, agentConfig agent.Config, managerConfig container.ManagerConfig) (environs.InstanceBroker, error) { manager, err := lxc.NewContainerManager(managerConfig) if err != nil { return nil, err } return &lxcBroker{ manager: manager, api: api, tools: tools, agentConfig: agentConfig, }, nil }