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
Merge "Refactor total_resources"
Merge "Get InstanceGroup InstanceList from get_instances()"