'Wait until volume reaches given status.
:param volume: volume resource
:param status: expected status of volume
:param timeout: timeout in seconds
:param poll_interval: poll interval in seconds'

def wait_for_volume_status(self, volume, status, timeout=60, poll_interval=1):

    start_time = time.time()
    while ((time.time() - start_time) < timeout):
        volume = self.cinder.volumes.get(volume.id)
        if (volume.status == status):
            break
        time.sleep(poll_interval)
    else:
        self.fail(('Volume    %s    did    not    reach    status    %s    after    %d    s' % (volume.id, status, timeout)))
