make record_metering_data concurrency safe

Recording metering might happen in parallel, and if two sqlalchemy
session try to create a source, a user, a project or a resource at the
same time, one of them fail with a IntegrityError.

This patch ensure the record_metering_data sqlalchemy session always
have the needed source, user, project and a resource by creating missing
obj in an other sqlalchemy session.

Fixes bug: #1237671

Change-Id: Ie8761ce1615c3142ad6ad2a400537f465f3bbf0a
Fixes Hyper-V Inspector cpu metrics bug

Closes-Bug: 1249959

Change-Id: I39513648ab25d46b2639b24a94e7344954ce3aeb
Merge "make record_metering_data concurrency safe"
Merge "Fixes Hyper-V Inspector cpu metrics bug"