Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(941)

Unified Diff: state/addmachine.go

Issue 77820044: Add EnvironCapability to state.Policy
Patch Set: Add EnvironCapability to state.Policy Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « provider/openstack/provider.go ('k') | state/conn_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: state/addmachine.go
=== modified file 'state/addmachine.go'
--- state/addmachine.go 2014-03-25 09:15:00 +0000
+++ state/addmachine.go 2014-04-03 03:37:45 +0000
@@ -133,6 +133,13 @@
var ops []txn.Op
var mdocs []*machineDoc
for _, template := range templates {
+ // Adding a machine without any principals is
+ // only permitted unit placement is supported.
+ if len(template.principals) == 0 {
+ if err := st.supportsUnitPlacement(); err != nil {
+ return nil, err
+ }
+ }
mdoc, addOps, err := st.addMachineOps(template)
if err != nil {
return nil, err
@@ -292,6 +299,10 @@
if containerType == "" {
return nil, nil, fmt.Errorf("no container type specified")
}
+ // Adding a machine within a machine implies add-machine or placement.
+ if err := st.supportsUnitPlacement(); err != nil {
+ return nil, nil, err
+ }
// If a parent machine is specified, make sure it exists
// and can support the requested container type.
@@ -352,6 +363,10 @@
if err := st.precheckInstance(parentTemplate.Series, parentTemplate.Constraints); err != nil {
return nil, nil, err
}
+ // Adding a machine within a machine implies add-machine or placement.
+ if err := st.supportsUnitPlacement(); err != nil {
+ return nil, nil, err
+ }
}
parentDoc := machineDocForTemplate(parentTemplate, strconv.Itoa(seq))
« no previous file with comments | « provider/openstack/provider.go ('k') | state/conn_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b