Fix clashing loop variables in TemplateResource

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

Closes-bug: #1235077
Change-Id: I5198621ce724abe9638da4a7482ae6817bbd86e7
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
Merge "Fix clashing loop variables in TemplateResource" into milestone-proposed
Merge "Add a new db api stack_get_all_by_owner_id" into milestone-proposed