1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/errors"
9
"github.com/juju/juju/constraints"
10
"github.com/juju/juju/environs/imagemetadata"
11
"github.com/juju/juju/environs/simplestreams"
12
"github.com/juju/juju/provider/common"
15
func (env *environ) SupportedArchitectures() ([]string, error) {
17
defer env.archMutex.Unlock()
18
if env.supportedArchitectures != nil {
19
return env.supportedArchitectures, nil
21
logger.Debugf("Getting supported architectures from simplestream.")
22
cloudSpec, err := env.Region()
26
imageConstraint := imagemetadata.NewImageConstraint(simplestreams.LookupParams{
28
Stream: env.Config().ImageStream(),
30
env.supportedArchitectures, err = common.SupportedArchitectures(env, imageConstraint)
31
logger.Debugf("Supported architectures: %v", env.supportedArchitectures)
32
return env.supportedArchitectures, err
35
var unsupportedConstraints = []string{
36
constraints.Container,
37
constraints.InstanceType,
41
// ConstraintsValidator returns a Validator instance which
42
// is used to validate and merge constraints.
43
func (env *environ) ConstraintsValidator() (constraints.Validator, error) {
44
validator := constraints.NewValidator()
45
validator.RegisterUnsupported(unsupportedConstraints)
46
supportedArches, err := env.SupportedArchitectures()
50
validator.RegisterVocabulary(constraints.Arch, supportedArches)
54
// SupportNetworks returns whether the environment has support to
55
// specify networks for services and machines.
56
func (env *environ) SupportNetworks() bool {
60
// SupportsUnitAssignment returns an error which, if non-nil, indicates
61
// that the environment does not support unit placement. If the environment
62
// does not support unit placement, then machines may not be created
63
// without units, and units cannot be placed explcitly.
64
func (env *environ) SupportsUnitPlacement() error {
65
return errors.NotImplementedf("SupportsUnitPlacement")