~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/container/factory/factory.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
// This package exists solely to avoid circular imports.
 
5
 
 
6
package factory
 
7
 
 
8
import (
 
9
        "github.com/juju/errors"
 
10
 
 
11
        "github.com/juju/juju/container"
 
12
        "github.com/juju/juju/container/kvm"
 
13
        "github.com/juju/juju/container/lxd"
 
14
        "github.com/juju/juju/instance"
 
15
)
 
16
 
 
17
// NewContainerManager creates the appropriate container.Manager for the
 
18
// specified container type.
 
19
func NewContainerManager(forType instance.ContainerType, conf container.ManagerConfig) (container.Manager, error) {
 
20
        switch forType {
 
21
        case instance.LXD:
 
22
                return lxd.NewContainerManager(conf)
 
23
        case instance.KVM:
 
24
                return kvm.NewContainerManager(conf)
 
25
        }
 
26
        return nil, errors.Errorf("unknown container type: %q", forType)
 
27
}