1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// This package exists solely to avoid circular imports.
package factory
import (
"github.com/juju/errors"
"github.com/juju/juju/container"
"github.com/juju/juju/container/kvm"
"github.com/juju/juju/container/lxd"
"github.com/juju/juju/instance"
)
// 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.LXD:
return lxd.NewContainerManager(conf)
case instance.KVM:
return kvm.NewContainerManager(conf)
}
return nil, errors.Errorf("unknown container type: %q", forType)
}
|