Add a new db api stack_get_all_by_owner_id

This is to get the next level of child stacks.

Partial-Bug: #1234010
Change-Id: I64b30b4040bc443b64d23d85a054010da4dd1130
Start the watcher task if a nested stack has watches

Even if the parent stack has no watches.

Change-Id: I06322f908fdbd474778776749cb3e1634183ed23
Partial-Bug: #1234010
Make sure that nested stacks have their watch rules checked

Change-Id: Iee9629739e9549e33f8ed8c4ca08098a7e4d0acf
Closes-Bug: #1234010
Refactor total_resources

Make the implementation slightly faster and more robust:

- Check that res.nested is callable
- Don't call res.nested() more than once
- Check for None explicitly
- Calculate totals directly, rather than with a for loop

Change-Id: Ib43cf5555620e54b9d4634e40cf46f75b50782ac
Get InstanceGroup InstanceList from get_instances()

Change-Id: I477aeede396e247134c838663fe7d54941758cd0
Don't iterate over Stack.resources dictionary

Now that parser.Stack is a proper Mapping, we can iterate over its
keys/values/items directly instead of accessing the resources attribute.

Change-Id: I6bd9f357c21a0e75623a71543e981d3f4f87fcbe
Implement parser.Stack.__delitem__()

Allow the update code to delete old resources from the stack without
accessing the stack's resource attribute.

Change-Id: I9dbc623d7396dd84cdbee992fa91d88b6c01a0e5
Update resource stacks automatically

When moving resources between stacks during an update, update the
resource's stack pointer automatically when adding it to its new stack.

Change-Id: I92666589fe417f5d905104d5a0890650da70e825
Fix clashing loop variables in TemplateResource

There were two loops using "v" as a variable name.

Closes-bug: #1235077
Change-Id: I5198621ce724abe9638da4a7482ae6817bbd86e7
Merge "Refactor total_resources"
Merge "Get InstanceGroup InstanceList from get_instances()"
Merge "Don't iterate over Stack.resources dictionary"
Merge "Implement parser.Stack.__delitem__()"
Merge "Update resource stacks automatically"
Merge "Fix clashing loop variables in TemplateResource"
Merge "Add a new db api stack_get_all_by_owner_id"
Merge "Start the watcher task if a nested stack has watches"
Merge "Make sure that nested stacks have their watch rules checked"