'This method is to wait for sample to add it to database.
There are long time delays when using Postgresql (or Mysql)
database as ceilometer backend'

def await_samples(self, metric, query):

    timeout = CONF.compute.build_timeout
    start = timeutils.utcnow()
    while (timeutils.delta_seconds(start, timeutils.utcnow()) < timeout):
        body = self.telemetry_client.list_samples(metric, query)
        if body:
            return body
        time.sleep(CONF.compute.build_interval)
    raise lib_exc.TimeoutException(('Sample    for    metric:%s    with    query:%s    has    not    been    added    to    the    database    within    %d    seconds' % (metric, query, CONF.compute.build_timeout)))
